Title: [215290] trunk/Source
Revision
215290
Author
ander...@apple.com
Date
2017-04-12 14:08:15 -0700 (Wed, 12 Apr 2017)

Log Message

Tweak WebCore::setMetadataURL function
https://bugs.webkit.org/show_bug.cgi?id=170786

Reviewed by Beth Dakin.

Source/WebCore:

Get rid of the "referrer" parameter, it isn't used. Make the remaining parameters const. Swap the
urlString and path parameters since that makes more sense. Use String instead of NSString in the call to WKSetMetadataURL.

* platform/FileSystem.cpp:
(WebCore::setMetadataURL): Deleted.
* platform/FileSystem.h:
* platform/mac/FileSystemMac.mm:
(WebCore::setMetadataURL):

Source/WebKit2:

Update for WebCore changes.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::namesOfPromisedFilesDroppedAtDestination):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (215289 => 215290)


--- trunk/Source/WebCore/ChangeLog	2017-04-12 21:04:18 UTC (rev 215289)
+++ trunk/Source/WebCore/ChangeLog	2017-04-12 21:08:15 UTC (rev 215290)
@@ -1,3 +1,19 @@
+2017-04-12  Anders Carlsson  <ander...@apple.com>
+
+        Tweak WebCore::setMetadataURL function
+        https://bugs.webkit.org/show_bug.cgi?id=170786
+
+        Reviewed by Beth Dakin.
+
+        Get rid of the "referrer" parameter, it isn't used. Make the remaining parameters const. Swap the
+        urlString and path parameters since that makes more sense. Use String instead of NSString in the call to WKSetMetadataURL.
+
+        * platform/FileSystem.cpp:
+        (WebCore::setMetadataURL): Deleted.
+        * platform/FileSystem.h:
+        * platform/mac/FileSystemMac.mm:
+        (WebCore::setMetadataURL):
+
 2017-04-12  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Well-known variations should clamp to the values listed in the @font-face block

Modified: trunk/Source/WebCore/platform/FileSystem.cpp (215289 => 215290)


--- trunk/Source/WebCore/platform/FileSystem.cpp	2017-04-12 21:04:18 UTC (rev 215289)
+++ trunk/Source/WebCore/platform/FileSystem.cpp	2017-04-12 21:08:15 UTC (rev 215290)
@@ -255,7 +255,7 @@
 
 #if !PLATFORM(MAC)
 
-void setMetadataURL(String&, const String&, const String&)
+void setMetadataURL(const String&, const String&)
 {
 }
 

Modified: trunk/Source/WebCore/platform/FileSystem.h (215289 => 215290)


--- trunk/Source/WebCore/platform/FileSystem.h	2017-04-12 21:04:18 UTC (rev 215289)
+++ trunk/Source/WebCore/platform/FileSystem.h	2017-04-12 21:08:15 UTC (rev 215290)
@@ -146,7 +146,7 @@
 WEBCORE_EXPORT bool getVolumeFreeSpace(const String&, uint64_t&);
 WEBCORE_EXPORT std::optional<int32_t> getFileDeviceId(const CString&);
 
-WEBCORE_EXPORT void setMetadataURL(String& URLString, const String& referrer, const String& path);
+WEBCORE_EXPORT void setMetadataURL(const String& path, const String& urlString);
 
 bool canExcludeFromBackup(); // Returns true if any file can ever be excluded from backup.
 bool excludeFromBackup(const String&); // Returns true if successful.

Modified: trunk/Source/WebCore/platform/mac/FileSystemMac.mm (215289 => 215290)


--- trunk/Source/WebCore/platform/mac/FileSystemMac.mm	2017-04-12 21:04:18 UTC (rev 215289)
+++ trunk/Source/WebCore/platform/mac/FileSystemMac.mm	2017-04-12 21:08:15 UTC (rev 215290)
@@ -48,18 +48,17 @@
     return !rmdir(fileSystemRepresentation(path).data());
 }
 
-void setMetadataURL(String& URLString, const String& referrer, const String& path)
+void setMetadataURL(const String& path, const String& metadataURLString)
 {
-    NSURL *URL = "" nil);
-    if (URL)
-        URLString = userVisibleString(URLByRemovingUserInfo(URL));
+    String urlString;
+    if (NSURL *url = "" nil))
+        urlString = userVisibleString(URLByRemovingUserInfo(url));
+    else
+        urlString = metadataURLString;
 
     // Call WKSetMetadataURL on a background queue because it can take some time.
-    NSString *URLStringCopy = URLString;
-    NSString *referrerCopy = referrer;
-    NSString *pathCopy = path;
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        wkSetMetadataURL(URLStringCopy, referrerCopy, [NSString stringWithUTF8String:[pathCopy fileSystemRepresentation]]);
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), [path = path.isolatedCopy(), urlString = urlString.isolatedCopy()] {
+        wkSetMetadataURL(urlString, nil, [NSString stringWithUTF8String:[path fileSystemRepresentation]]);
     });
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (215289 => 215290)


--- trunk/Source/WebKit2/ChangeLog	2017-04-12 21:04:18 UTC (rev 215289)
+++ trunk/Source/WebKit2/ChangeLog	2017-04-12 21:08:15 UTC (rev 215290)
@@ -1,3 +1,15 @@
+2017-04-12  Anders Carlsson  <ander...@apple.com>
+
+        Tweak WebCore::setMetadataURL function
+        https://bugs.webkit.org/show_bug.cgi?id=170786
+
+        Reviewed by Beth Dakin.
+
+        Update for WebCore changes.
+
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::namesOfPromisedFilesDroppedAtDestination):
+
 2017-04-12  Brent Fulgham  <bfulg...@apple.com>
 
         [WK2][Mac] Stop allowing access to disk arbitration process

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (215289 => 215290)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2017-04-12 21:04:18 UTC (rev 215289)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2017-04-12 21:08:15 UTC (rev 215290)
@@ -3912,7 +3912,7 @@
         LOG_ERROR("Failed to create image file via -[NSFileWrapper writeToURL:options:originalContentsURL:error:]");
 
     if (!m_promisedURL.isEmpty())
-        WebCore::setMetadataURL(m_promisedURL, "", String(path));
+        WebCore::setMetadataURL(String(path), m_promisedURL);
     
     return [NSArray arrayWithObject:[path lastPathComponent]];
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to