[webkit-reviews] review granted: [Bug 188955] [Cocoa] Adapt more WebKit code to be ARC-compatible : [Attachment 348104] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 27 07:04:25 PDT 2018


Anders Carlsson <andersca at apple.com> has granted Darin Adler
<darin at apple.com>'s request for review:
Bug 188955: [Cocoa] Adapt more WebKit code to be ARC-compatible
https://bugs.webkit.org/show_bug.cgi?id=188955

Attachment 348104: Patch

https://bugs.webkit.org/attachment.cgi?id=348104&action=review




--- Comment #6 from Anders Carlsson <andersca at apple.com> ---
Comment on attachment 348104
  --> https://bugs.webkit.org/attachment.cgi?id=348104
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=348104&action=review

> Source/WebKit/Shared/API/c/cf/WKStringCF.mm:55
> +	   CFRetain(cfString);
> +	   return toAPI(static_cast<API::String*>(&[(WKNSString *)(__bridge
NSString *)cfString _apiObject]));

I'd put the CFRetain inside the toAPI call instead of on a separate line.

> Source/WebKit/Shared/API/c/cf/WKURLCF.mm:58
> +	   CFRetain(cfURL);

Same here.

> Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:2054
> -    [[event retain] autorelease];
> +    CFRetain((__bridge CFTypeRef)event);
> +    CFAutorelease((__bridge CFTypeRef)event);

I seem to remember that you can do something like

__autoreleasing NSEvent *autoreleasedEvent = event;

(I think we've done something similar in Safari).

> Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:2074
> -    [[event retain] autorelease];
> +    CFRetain((__bridge CFTypeRef)event);
> +    CFAutorelease((__bridge CFTypeRef)event);

Same thing here.


More information about the webkit-reviews mailing list