Title: [281242] trunk/Source/WebKit
Revision
281242
Author
[email protected]
Date
2021-08-19 09:10:36 -0700 (Thu, 19 Aug 2021)

Log Message

Use a Ref<> argument to keep WebPage alive in TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition()
https://bugs.webkit.org/show_bug.cgi?id=229239

Reviewed by Tim Horton.

Replace a manual ref()/deref() with a makeRef() argument to the function.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (281241 => 281242)


--- trunk/Source/WebKit/ChangeLog	2021-08-19 16:08:54 UTC (rev 281241)
+++ trunk/Source/WebKit/ChangeLog	2021-08-19 16:10:36 UTC (rev 281242)
@@ -1,3 +1,15 @@
+2021-08-19  Simon Fraser  <[email protected]>
+
+        Use a Ref<> argument to keep WebPage alive in TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition()
+        https://bugs.webkit.org/show_bug.cgi?id=229239
+
+        Reviewed by Tim Horton.
+
+        Replace a manual ref()/deref() with a makeRef() argument to the function.
+
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition):
+
 2021-08-19  Kate Cheney  <[email protected]>
 
         Unable to load downloaded HTML files in Safari

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (281241 => 281242)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2021-08-19 16:08:54 UTC (rev 281241)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2021-08-19 16:10:36 UTC (rev 281242)
@@ -373,20 +373,14 @@
         return;
     }
 
-    m_webPage.ref();
     m_webPage.corePage()->scrollingCoordinator()->commitTreeStateIfNeeded();
 
     if (!m_layerTreeStateIsFrozen)
         invalidateRenderingUpdateRunLoopObserver();
 
-    // It is possible for the drawing area to be destroyed before the bound block
-    // is invoked, so grab a reference to the web page here so we can access the drawing area through it.
-    // (The web page is already kept alive by dispatchAfterEnsuringUpdatedScrollPosition).
-    WebPage* webPage = &m_webPage;
-
-    ScrollingThread::dispatchBarrier([this, webPage, function = WTFMove(function)] {
-        DrawingArea* drawingArea = webPage->drawingArea();
-        if (!drawingArea)
+    ScrollingThread::dispatchBarrier([this, retainedPage = makeRef(m_webPage), function = WTFMove(function)] {
+        // It is possible for the drawing area to be destroyed before the bound block is invoked.
+        if (!retainedPage->drawingArea())
             return;
 
         function();
@@ -393,8 +387,6 @@
 
         if (!m_layerTreeStateIsFrozen)
             scheduleRenderingUpdateRunLoopObserver();
-
-        webPage->deref();
     });
 #else
     function();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to