RESOLVED FIXED 133929
Add an autorelease() member function to RetainPtr
https://bugs.webkit.org/show_bug.cgi?id=133929
Summary Add an autorelease() member function to RetainPtr
Anders Carlsson
Reported 2014-06-15 12:17:32 PDT
Add an autorelease() member function to RetainPtr
Attachments
Patch (15.24 KB, patch)
2014-06-15 12:19 PDT, Anders Carlsson
mitz: review+
Anders Carlsson
Comment 1 2014-06-15 12:19:47 PDT
WebKit Commit Bot
Comment 2 2014-06-15 12:21:51 PDT
Attachment 233145 [details] did not pass style-queue: ERROR: Source/WTF/wtf/RetainPtr.h:171: Extra space before [ [whitespace/braces] [5] Total errors found: 1 in 14 files If any of these errors are false positives, please file a bug against check-webkit-style.
mitz
Comment 3 2014-06-15 12:28:27 PDT
Comment on attachment 233145 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=233145&action=review > Source/WTF/wtf/RetainPtr.h:172 > +#if __has_feature(objc_arc) > + return ptr; > +#else > + return [(id)CFMakeCollectable(ptr) autorelease]; > +#endif Can this be written more concisely as return CFBridgingRelease(ptr); ?
Anders Carlsson
Comment 4 2014-06-15 12:30:26 PDT
(In reply to comment #3) > (From update of attachment 233145 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=233145&action=review > > > Source/WTF/wtf/RetainPtr.h:172 > > +#if __has_feature(objc_arc) > > + return ptr; > > +#else > > + return [(id)CFMakeCollectable(ptr) autorelease]; > > +#endif > > Can this be written more concisely as > return CFBridgingRelease(ptr); > ? Yes, that's the function I was looking for!
Benjamin Poulain
Comment 5 2014-06-15 12:30:53 PDT
Comment on attachment 233145 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=233145&action=review > Source/WTF/wtf/RetainPtr.h:171 > + return [(id)CFMakeCollectable(ptr) autorelease]; We use CFRetain/CFRelease everywhere, shouldn't this be CFAutorelease?
mitz
Comment 6 2014-06-15 12:31:58 PDT
Comment on attachment 233145 [details] Patch r=me with CFBridgingRelease.
Anders Carlsson
Comment 7 2014-06-15 12:34:43 PDT
(In reply to comment #5) > (From update of attachment 233145 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=233145&action=review > > > Source/WTF/wtf/RetainPtr.h:171 > > + return [(id)CFMakeCollectable(ptr) autorelease]; > > We use CFRetain/CFRelease everywhere, shouldn't this be CFAutorelease? It can't be CFAutorelease because: 1. It's not available on 10.8 2. I don't think it does the right thing for garbage collected Objective-C apps using WebKit.
Anders Carlsson
Comment 8 2014-06-15 16:16:57 PDT
mitz
Comment 9 2014-06-15 20:31:14 PDT
(In reply to comment #8) > Committed r169995: <http://trac.webkit.org/changeset/169995> This broke the iOS build with: In file included from Source/WebCore/bindings/objc/DOM.mm:32: In file included from Source/WebCore/loader/cache/CachedImage.h:26: In file included from Source/WebCore/loader/cache/CachedResource.h:29: In file included from Source/WebCore/platform/network/cf/ResourceError.h:31: WebKitBuild/Release-iphonesimulator/usr/local/include/wtf/RetainPtr.h:166:16: error: cannot initialize return object of type 'PtrType' (aka 'CGImage *') with an rvalue of type 'id' Source/WebCore/bindings/objc/DOM.mm:613:68: note: in instantiation of member function 'WTF::RetainPtr<CGImage *>::autorelease' requested here
mitz
Comment 10 2014-06-15 21:10:24 PDT
(In reply to comment #9) > (In reply to comment #8) > > Committed r169995: <http://trac.webkit.org/changeset/169995> > > This broke the iOS build with: > > In file included from Source/WebCore/bindings/objc/DOM.mm:32: > In file included from Source/WebCore/loader/cache/CachedImage.h:26: > In file included from Source/WebCore/loader/cache/CachedResource.h:29: > In file included from Source/WebCore/platform/network/cf/ResourceError.h:31: > WebKitBuild/Release-iphonesimulator/usr/local/include/wtf/RetainPtr.h:166:16: error: cannot initialize return object of type 'PtrType' (aka 'CGImage *') with an rvalue of type 'id' > Source/WebCore/bindings/objc/DOM.mm:613:68: note: in instantiation of member function 'WTF::RetainPtr<CGImage *>::autorelease' requested here I tried to fix that in <http://trac.webkit.org/r169999>.
Note You need to log in before you can comment on or make changes to this bug.