RESOLVED FIXED186314
[Cocoa] More preparation for ARC, focusing on WebKit and smart pointers
https://bugs.webkit.org/show_bug.cgi?id=186314
Summary [Cocoa] More preparation for ARC, focusing on WebKit and smart pointers
Darin Adler
Reported 2018-06-05 12:14:52 PDT
[Cocoa] More preparation for ARC, focusing on WebKit and smart pointers
Attachments
Patch (96.09 KB, patch)
2018-06-05 12:46 PDT, Darin Adler
andersca: review+
Darin Adler
Comment 1 2018-06-05 12:46:17 PDT
Anders Carlsson
Comment 2 2018-06-05 13:09:51 PDT
Comment on attachment 341984 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=341984&action=review > Source/WTF/wtf/BlockPtr.h:100 > +#if defined(__OBJC__) && __has_feature(objc_arc) __has_feature(objc_arc) always implies __OBJC__ being defined, so you don't need to check for __OBJC__ here (or anywhere else). > Source/WTF/wtf/OSObjectPtr.h:120 > + OSObjectPtr ptr = other; I think you can use std::move(other) here - under ARC Objective-C pointers have implicit move constructors.
Darin Adler
Comment 3 2018-06-05 13:57:12 PDT
Comment on attachment 341984 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=341984&action=review >> Source/WTF/wtf/BlockPtr.h:100 >> +#if defined(__OBJC__) && __has_feature(objc_arc) > > __has_feature(objc_arc) always implies __OBJC__ being defined, so you don't need to check for __OBJC__ here (or anywhere else). That’s great. I will fix that everywhere. I had copied the #if from RetainPtr. I think I’ll use a separate patch for that. >> Source/WTF/wtf/OSObjectPtr.h:120 >> + OSObjectPtr ptr = other; > > I think you can use std::move(other) here - under ARC Objective-C pointers have implicit move constructors. That’s great news. Given that, maybe I should do a version that takes T&& too? For now I won’t do either of those things, but I will come back and do it as an optimization. Maybe with a unit test.
Darin Adler
Comment 4 2018-06-05 13:58:23 PDT
Radar WebKit Bug Importer
Comment 5 2018-06-05 13:59:19 PDT
mitz
Comment 6 2018-06-06 23:40:22 PDT
Comment on attachment 341984 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=341984&action=review > Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm:482 > - IPC::encode(encoder, reinterpret_cast<CFDataRef>(archiver.get().encodedData)); > + IPC::encode(encoder, (__bridge CFArrayRef)archiver.get().encodedData); OOPS! This caused bug 186385.
Darin Adler
Comment 7 2018-06-07 09:03:47 PDT
Comment on attachment 341984 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=341984&action=review >> Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm:482 >> + IPC::encode(encoder, (__bridge CFArrayRef)archiver.get().encodedData); > > OOPS! This caused bug 186385. Darn, why didn’t I spot that!?
Note You need to log in before you can comment on or make changes to this bug.