Title: [216094] trunk/Source/WebCore
Revision
216094
Author
wenson_hs...@apple.com
Date
2017-05-02 14:13:04 -0700 (Tue, 02 May 2017)

Log Message

Remove an extraneous call to dispatch_group_async in WebItemProviderPasteboard.mm
https://bugs.webkit.org/show_bug.cgi?id=171561

Reviewed by Tim Horton.

In -[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:], the lifetime of the dispatch group
`fileLoadingGroup` is already guarded by dispatch_group_enter/leave calls when beginning and concluding an
item provider load, respectively. As such, the call to dispatch_group_async serves no purpose and should be removed.

No new tests, since there is no change in behavior.

* platform/ios/WebItemProviderPasteboard.mm:
(-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (216093 => 216094)


--- trunk/Source/WebCore/ChangeLog	2017-05-02 21:04:49 UTC (rev 216093)
+++ trunk/Source/WebCore/ChangeLog	2017-05-02 21:13:04 UTC (rev 216094)
@@ -1,3 +1,19 @@
+2017-05-02  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Remove an extraneous call to dispatch_group_async in WebItemProviderPasteboard.mm
+        https://bugs.webkit.org/show_bug.cgi?id=171561
+
+        Reviewed by Tim Horton.
+
+        In -[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:], the lifetime of the dispatch group
+        `fileLoadingGroup` is already guarded by dispatch_group_enter/leave calls when beginning and concluding an
+        item provider load, respectively. As such, the call to dispatch_group_async serves no purpose and should be removed.
+
+        No new tests, since there is no change in behavior.
+
+        * platform/ios/WebItemProviderPasteboard.mm:
+        (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
+
 2017-05-02  Youenn Fablet  <you...@apple.com>
 
         [LibWebRTC] Set explicitly logging level in debug mode

Modified: trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm (216093 => 216094)


--- trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm	2017-05-02 21:04:49 UTC (rev 216093)
+++ trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm	2017-05-02 21:13:04 UTC (rev 216094)
@@ -471,23 +471,21 @@
         NSUInteger indexInItemProviderArray = [[indicesOfItemProvidersWithFiles objectAtIndex:index] unsignedIntegerValue];
         RetainPtr<NSString> suggestedName = [itemProvider suggestedName];
         dispatch_group_enter(fileLoadingGroup.get());
-        dispatch_group_async(fileLoadingGroup.get(), dispatch_get_main_queue(), [indexInItemProviderArray, itemProvider, typeIdentifier, suggestedName, typeToFileURLMaps, fileLoadingGroup] {
-            [itemProvider loadFileRepresentationForTypeIdentifier:typeIdentifier.get() completionHandler:[indexInItemProviderArray, suggestedName, typeIdentifier, typeToFileURLMaps, fileLoadingGroup] (NSURL *url, NSError *error) {
-                // After executing this completion block, UIKit removes the file at the given URL. However, we need this data to persist longer for the web content process.
-                // To address this, we hard link the given URL to a new temporary file in the temporary directory. This follows the same flow as regular file upload, in
-                // WKFileUploadPanel.mm. The temporary files are cleaned up by the system at a later time.
-                RetainPtr<NSURL> destinationURL = temporaryFileURLForDataInteractionContent(url.pathExtension, suggestedName.get());
-                if (!destinationURL || error || ![[NSFileManager defaultManager] linkItemAtURL:url toURL:destinationURL.get() error:nil]) {
-                    dispatch_group_leave(fileLoadingGroup.get());
-                    return;
-                }
+        [itemProvider loadFileRepresentationForTypeIdentifier:typeIdentifier.get() completionHandler:[indexInItemProviderArray, suggestedName, typeIdentifier, typeToFileURLMaps, fileLoadingGroup] (NSURL *url, NSError *error) {
+            // After executing this completion block, UIKit removes the file at the given URL. However, we need this data to persist longer for the web content process.
+            // To address this, we hard link the given URL to a new temporary file in the temporary directory. This follows the same flow as regular file upload, in
+            // WKFileUploadPanel.mm. The temporary files are cleaned up by the system at a later time.
+            RetainPtr<NSURL> destinationURL = temporaryFileURLForDataInteractionContent(url.pathExtension, suggestedName.get());
+            if (!destinationURL || error || ![[NSFileManager defaultManager] linkItemAtURL:url toURL:destinationURL.get() error:nil]) {
+                dispatch_group_leave(fileLoadingGroup.get());
+                return;
+            }
 
-                dispatch_async(dispatch_get_main_queue(), [indexInItemProviderArray, typeIdentifier, destinationURL, typeToFileURLMaps, fileLoadingGroup] {
-                    [typeToFileURLMaps setObject:[NSDictionary dictionaryWithObject:destinationURL.get() forKey:typeIdentifier.get()] atIndexedSubscript:indexInItemProviderArray];
-                    dispatch_group_leave(fileLoadingGroup.get());
-                });
-            }];
-        });
+            dispatch_async(dispatch_get_main_queue(), [indexInItemProviderArray, typeIdentifier, destinationURL, typeToFileURLMaps, fileLoadingGroup] {
+                [typeToFileURLMaps setObject:[NSDictionary dictionaryWithObject:destinationURL.get() forKey:typeIdentifier.get()] atIndexedSubscript:indexInItemProviderArray];
+                dispatch_group_leave(fileLoadingGroup.get());
+            });
+        }];
     }
 
     RetainPtr<WebItemProviderPasteboard> retainedSelf = self;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to