[webkit-reviews] review granted: [Bug 172228] A URL type is vended for a non-URL plain text string when starting data interaction : [Attachment 310421] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 17 12:53:37 PDT 2017


Andy Estes <aestes at apple.com> has granted Wenson Hsieh
<wenson_hsieh at apple.com>'s request for review:
Bug 172228: A URL type is vended for a non-URL plain text string when starting
data interaction
https://bugs.webkit.org/show_bug.cgi?id=172228

Attachment 310421: Patch

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




--- Comment #2 from Andy Estes <aestes at apple.com> ---
Comment on attachment 310421
  --> https://bugs.webkit.org/attachment.cgi?id=310421
Patch

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

> Source/WebCore/platform/ios/PlatformPasteboardIOS.mm:203
> +static void
addRepresentationsForPlainText(RetainPtr<WebItemProviderRegistrationInfoList>
itemsToRegister, const String& plainText)

Passing a RetainPtr by value causes retain count churn. Why not just pass a
WebItemProviderRegistrationInfoList *?

> Source/WebCore/platform/ios/PlatformPasteboardIOS.mm:209
> +    NSURL *platformURL = [NSURL URLWithString:plainText];
> +    if (URL(platformURL).isValid())

Is this materially different than constructing a URL with plainText as the
relative URL and an empty base URL? Just wondering if we can avoid creating a
transient NSURL.

> Source/WebCore/platform/ios/PlatformPasteboardIOS.mm:311
> +	       addRepresentationsForPlainText(itemsToRegister, textAsNSString);

Can you pass text as the second argument instead of textAsNSString to avoid an
unnecessary NSString-to-WTFString conversion?


More information about the webkit-reviews mailing list