Title: [278754] trunk/Source/WebKit
Revision
278754
Author
[email protected]
Date
2021-06-10 22:03:17 -0700 (Thu, 10 Jun 2021)

Log Message

takeSnapshotWithConfiguration() should wait for the next flush before it does callSnapshotRect()
https://bugs.webkit.org/show_bug.cgi?id=226257
<rdar://76411685>

Reviewed by Simon Fraser.

This will ensure the latest IOSurfaces are pushed to backboardd before
taking the snapshot.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (278753 => 278754)


--- trunk/Source/WebKit/ChangeLog	2021-06-11 04:52:23 UTC (rev 278753)
+++ trunk/Source/WebKit/ChangeLog	2021-06-11 05:03:17 UTC (rev 278754)
@@ -1,3 +1,17 @@
+2021-06-10  Said Abou-Hallawa  <[email protected]>
+
+        takeSnapshotWithConfiguration() should wait for the next flush before it does callSnapshotRect()
+        https://bugs.webkit.org/show_bug.cgi?id=226257
+        <rdar://76411685>
+
+        Reviewed by Simon Fraser.
+
+        This will ensure the latest IOSurfaces are pushed to backboardd before
+        taking the snapshot.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
+
 2021-06-10  Chris Dumez  <[email protected]>
 
         Unreviewed macOS build fix.

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (278753 => 278754)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-06-11 04:52:23 UTC (rev 278753)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-06-11 05:03:17 UTC (rev 278754)
@@ -1218,13 +1218,17 @@
         return;
     }
 
-    _page->callAfterNextPresentationUpdate([callSnapshotRect = WTFMove(callSnapshotRect), handler](WebKit::CallbackBase::Error error) {
+    _page->callAfterNextPresentationUpdate([callSnapshotRect = WTFMove(callSnapshotRect), handler](WebKit::CallbackBase::Error error) mutable {
         if (error != WebKit::CallbackBase::Error::None) {
             tracePoint(TakeSnapshotEnd, snapshotFailedTraceValue);
             handler(nil, createNSError(WKErrorUnknown).get());
             return;
         }
-        callSnapshotRect();
+
+        // Wait for the next flush to ensure the latest IOSurfaces are pushed to backboardd before taking the snapshot.
+        [CATransaction addCommitHandler:[callSnapshotRect = WTFMove(callSnapshotRect)] {
+            callSnapshotRect();
+        } forPhase:kCATransactionPhasePostCommit];
     });
 #endif
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to