WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
186526
[Cocoa] Make some RetainPtr refinements to get more ready for ARC
https://bugs.webkit.org/show_bug.cgi?id=186526
Summary
[Cocoa] Make some RetainPtr refinements to get more ready for ARC
Darin Adler
Reported
2018-06-11 10:00:57 PDT
[Cocoa] Make some RetainPtr refinements to get more ready for ARC
Attachments
Patch
(14.84 KB, patch)
2018-06-11 10:05 PDT
,
Darin Adler
no flags
Details
Formatted Diff
Diff
Patch
(15.21 KB, patch)
2018-06-12 09:20 PDT
,
Darin Adler
no flags
Details
Formatted Diff
Diff
Patch
(15.25 KB, patch)
2018-06-12 09:25 PDT
,
Darin Adler
ews-watchlist
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from ews116 for mac-sierra
(3.02 MB, application/zip)
2018-06-12 12:24 PDT
,
EWS Watchlist
no flags
Details
Patch
(20.66 KB, patch)
2018-06-12 22:27 PDT
,
Darin Adler
no flags
Details
Formatted Diff
Diff
Patch
(21.23 KB, patch)
2018-06-13 19:47 PDT
,
Darin Adler
andersca
: review+
darin
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Darin Adler
Comment 1
2018-06-11 10:05:45 PDT
Comment hidden (obsolete)
Created
attachment 342440
[details]
Patch
Darin Adler
Comment 2
2018-06-11 10:06:27 PDT
As part of review, I’d like feedback on whether I should be adding these new RetainPtr members or not.
Darin Adler
Comment 3
2018-06-12 09:20:38 PDT
Comment hidden (obsolete)
Created
attachment 342548
[details]
Patch
Darin Adler
Comment 4
2018-06-12 09:22:51 PDT
I think Anders is probably the one who should review this. New patch fixes const-correctness of cast inside RetainPtr::autoreleaseCF as well as making it work correctly with nullptr, and uses autoreleaseCF in one place in iOS-specific code that I had missed in WebKitLegacy.
Darin Adler
Comment 5
2018-06-12 09:25:40 PDT
Comment hidden (obsolete)
Created
attachment 342550
[details]
Patch
EWS Watchlist
Comment 6
2018-06-12 12:24:54 PDT
Comment hidden (obsolete)
Comment on
attachment 342550
[details]
Patch
Attachment 342550
[details]
did not pass mac-debug-ews (mac): Output:
http://webkit-queues.webkit.org/results/8149429
New failing tests: media/video-buffering-allowed.html
EWS Watchlist
Comment 7
2018-06-12 12:24:55 PDT
Comment hidden (obsolete)
Created
attachment 342579
[details]
Archive of layout-test-results from ews116 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-sierra Platform: Mac OS X 10.12.6
Darin Adler
Comment 8
2018-06-12 22:27:34 PDT
Comment hidden (obsolete)
Created
attachment 342632
[details]
Patch
Anders Carlsson
Comment 9
2018-06-13 08:20:49 PDT
Comment on
attachment 342632
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=342632&action=review
> Source/WTF/ChangeLog:13 > + * wtf/RetainPtr.h: Added autoreleaseCF and bridgingAutorelease. > + The existing autorelease is for autorelease of an Objective-C type. > + The two new ones are for autorelease of CF types: We can use > + autoreleaseCF when we want an autoreleased CF type, and we can > + use bridgingAutorelease when we want to autorelease as part of > + converting from a CF type to an Objective-C type.
I think these (autoreleaseCF anyway) adds some confusion. Would it be possible to use std::enable_if to just pick the right autorelease based on the type?
Darin Adler
Comment 10
2018-06-13 09:20:37 PDT
(In reply to Anders Carlsson from
comment #9
)
> I think these (autoreleaseCF anyway) adds some confusion. Would it be > possible to use std::enable_if to just pick the right autorelease based on > the type?
I don’t know; I’ll try.
Darin Adler
Comment 11
2018-06-13 19:47:39 PDT
Created
attachment 342720
[details]
Patch
EWS Watchlist
Comment 12
2018-06-13 19:50:36 PDT
Attachment 342720
[details]
did not pass style-queue: ERROR: Source/WTF/wtf/RetainPtr.h:194: This { should be at the end of the previous line [whitespace/braces] [4] ERROR: Source/WTF/wtf/RetainPtr.h:199: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 2 in 21 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 13
2018-06-13 19:51:09 PDT
Comment on
attachment 342720
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=342720&action=review
> Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm:147 > +#if 0 && (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED == 101400) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED == 120000)
Oops, did not mean to post patch with this in it.
Darin Adler
Comment 14
2018-06-13 20:07:59 PDT
(In reply to Anders Carlsson from
comment #9
)
> Would it be > possible to use std::enable_if to just pick the right autorelease based on > the type?
Yes, I did this in the latest patch, which no longer adds autoreleaseCF.
Anders Carlsson
Comment 15
2018-06-16 09:33:18 PDT
Comment on
attachment 342720
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=342720&action=review
> Source/WTF/wtf/RetainPtr.h:150 > +#ifdef __OBJC__ > + template<typename U> typename std::enable_if<std::is_convertible<U, id>::value, PtrType>::type autoreleaseHelper(); > + template<typename U> typename std::enable_if<!std::is_convertible<U, id>::value, PtrType>::type autoreleaseHelper(); > +#endif
You can use std::enable_if_t here, and if WebKit requires C++17 you should be able to use std::is_convertible_v as well.
Darin Adler
Comment 16
2018-06-16 21:16:25 PDT
Comment on
attachment 342720
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=342720&action=review
>> Source/WTF/wtf/RetainPtr.h:150 >> +#endif > > You can use std::enable_if_t here, and if WebKit requires C++17 you should be able to use std::is_convertible_v as well.
Great, thanks for the suggestion. I will switch to those and retest before landing. Roughly speaking, WebKit does require C++17 now, but there are many exceptions to that general rule. However, since this is ObjC-only code, all that really matters is the level of support we have in clang with the option we specify (which is now C++17) and we don’t need to worry about gcc or MSVC for this code.
Darin Adler
Comment 17
2018-06-16 23:54:31 PDT
Committed
r232911
: <
https://trac.webkit.org/changeset/232911
>
Radar WebKit Bug Importer
Comment 18
2018-06-16 23:55:25 PDT
<
rdar://problem/41193181
>
Darin Adler
Comment 19
2018-06-16 23:59:55 PDT
I was unable to use std::is_convertible_v at this time because we are not yet passing in C++17 as our dialect for clang.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug