Title: [268022] trunk/Source
Revision
268022
Author
simon.fra...@apple.com
Date
2020-10-05 17:52:40 -0700 (Mon, 05 Oct 2020)

Log Message

ChromeClient::needsImmediateRenderingUpdate() only existing to work around a WebKit1 bug
https://bugs.webkit.org/show_bug.cgi?id=217338

Reviewed by Said Abou-Hallawa.

WebViewLayerFlushScheduler has a bug where scheduling inside the callback would fail
because the RunLoopObserver was always invalidate at the end of the callback.

If we fix this, we can remove ChromeClient::needsImmediateRenderingUpdate() which I believe
only existed to work around this bug.

Source/WebCore:

* page/ChromeClient.h:
(WebCore::ChromeClient::scheduleTimedRenderingUpdate):
(WebCore::ChromeClient::needsImmediateRenderingUpdate const): Deleted.
* page/RenderingUpdateScheduler.cpp:
(WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):

Source/WebKitLegacy/mac:

* WebCoreSupport/WebChromeClient.h:
* WebView/WebViewData.h:
* WebView/WebViewData.mm:
(WebViewLayerFlushScheduler::schedule):
(WebViewLayerFlushScheduler::layerFlushCallback):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (268021 => 268022)


--- trunk/Source/WebCore/ChangeLog	2020-10-06 00:44:45 UTC (rev 268021)
+++ trunk/Source/WebCore/ChangeLog	2020-10-06 00:52:40 UTC (rev 268022)
@@ -1,5 +1,24 @@
 2020-10-05  Simon Fraser  <simon.fra...@apple.com>
 
+        ChromeClient::needsImmediateRenderingUpdate() only existing to work around a WebKit1 bug
+        https://bugs.webkit.org/show_bug.cgi?id=217338
+
+        Reviewed by Said Abou-Hallawa.
+
+        WebViewLayerFlushScheduler has a bug where scheduling inside the callback would fail
+        because the RunLoopObserver was always invalidated at the end of the callback.
+
+        If we fix this, we can remove ChromeClient::needsImmediateRenderingUpdate() which I believe
+        only existed to work around this bug.
+
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::scheduleTimedRenderingUpdate):
+        (WebCore::ChromeClient::needsImmediateRenderingUpdate const): Deleted.
+        * page/RenderingUpdateScheduler.cpp:
+        (WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
+
+2020-10-05  Simon Fraser  <simon.fra...@apple.com>
+
         Rename scheduleTimedRenderingUpdate() functions related to images
         https://bugs.webkit.org/show_bug.cgi?id=217352
 

Modified: trunk/Source/WebCore/page/ChromeClient.h (268021 => 268022)


--- trunk/Source/WebCore/page/ChromeClient.h	2020-10-06 00:44:45 UTC (rev 268021)
+++ trunk/Source/WebCore/page/ChromeClient.h	2020-10-06 00:52:40 UTC (rev 268022)
@@ -327,7 +327,6 @@
     // to do an eager layout before the drawing.
     virtual void scheduleRenderingUpdate() = 0;
     virtual bool scheduleTimedRenderingUpdate() { return false; }
-    virtual bool needsImmediateRenderingUpdate() const { return false; }
     // Returns whether or not the client can render the composited layer,
     // regardless of the settings.
     virtual bool allowsAcceleratedCompositing() const { return true; }

Modified: trunk/Source/WebCore/page/RenderingUpdateScheduler.cpp (268021 => 268022)


--- trunk/Source/WebCore/page/RenderingUpdateScheduler.cpp	2020-10-06 00:44:45 UTC (rev 268021)
+++ trunk/Source/WebCore/page/RenderingUpdateScheduler.cpp	2020-10-06 00:52:40 UTC (rev 268022)
@@ -146,10 +146,7 @@
 
 void RenderingUpdateScheduler::scheduleRenderingUpdate()
 {
-    if (m_page.chrome().client().needsImmediateRenderingUpdate())
-        scheduleImmediateRenderingUpdate();
-    else
-        scheduleTimedRenderingUpdate();
+    scheduleTimedRenderingUpdate();
 }
 
 }

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (268021 => 268022)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-10-06 00:44:45 UTC (rev 268021)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-10-06 00:52:40 UTC (rev 268022)
@@ -1,3 +1,22 @@
+2020-10-05  Simon Fraser  <simon.fra...@apple.com>
+
+        ChromeClient::needsImmediateRenderingUpdate() only existing to work around a WebKit1 bug
+        https://bugs.webkit.org/show_bug.cgi?id=217338
+
+        Reviewed by Said Abou-Hallawa.
+
+        WebViewLayerFlushScheduler has a bug where scheduling inside the callback would fail
+        because the RunLoopObserver was always invalidated at the end of the callback.
+
+        If we fix this, we can remove ChromeClient::needsImmediateRenderingUpdate() which I believe
+        only existed to work around this bug.
+
+        * WebCoreSupport/WebChromeClient.h:
+        * WebView/WebViewData.h:
+        * WebView/WebViewData.mm:
+        (WebViewLayerFlushScheduler::schedule):
+        (WebViewLayerFlushScheduler::layerFlushCallback):
+
 2020-10-05  Aditya Keerthi  <akeer...@apple.com>
 
         [Contact Picker API] Introduce bindings for the Contact Picker API

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h (268021 => 268022)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2020-10-06 00:44:45 UTC (rev 268021)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2020-10-06 00:52:40 UTC (rev 268022)
@@ -175,7 +175,6 @@
     void attachViewOverlayGraphicsLayer(WebCore::GraphicsLayer*) final;
     void setNeedsOneShotDrawingSynchronization() final;
     void scheduleRenderingUpdate() final;
-    bool needsImmediateRenderingUpdate() const final { return true; }
 
     CompositingTriggerFlags allowedCompositingTriggers() const final
     {

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebViewData.h (268021 => 268022)


--- trunk/Source/WebKitLegacy/mac/WebView/WebViewData.h	2020-10-06 00:44:45 UTC (rev 268021)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebViewData.h	2020-10-06 00:52:40 UTC (rev 268022)
@@ -121,6 +121,8 @@
     
     LayerFlushController* m_flushController;
     std::unique_ptr<WebCore::RunLoopObserver> m_runLoopObserver;
+    bool m_insideCallback { false };
+    bool m_rescheduledInsideCallback { false };
 };
 
 class LayerFlushController : public RefCounted<LayerFlushController> {

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebViewData.mm (268021 => 268022)


--- trunk/Source/WebKitLegacy/mac/WebView/WebViewData.mm	2020-10-06 00:44:45 UTC (rev 268021)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebViewData.mm	2020-10-06 00:52:40 UTC (rev 268022)
@@ -43,6 +43,7 @@
 #import <WebCore/WebCoreJITOperations.h>
 #import <wtf/MainThread.h>
 #import <wtf/RunLoop.h>
+#import <wtf/SetForScope.h>
 
 #if PLATFORM(IOS_FAMILY)
 #import "WebGeolocationProviderIOS.h"
@@ -108,6 +109,9 @@
 
 void WebViewLayerFlushScheduler::schedule()
 {
+    if (m_insideCallback)
+        m_rescheduledInsideCallback = true;
+
     m_runLoopObserver->schedule(currentRunLoop());
 }
 
@@ -120,7 +124,11 @@
 {
     @autoreleasepool {
         RefPtr<LayerFlushController> protector = m_flushController;
-        if (m_flushController->flushLayers())
+
+        SetForScope<bool> insideCallbackScope(m_insideCallback, true);
+        m_rescheduledInsideCallback = false;
+
+        if (m_flushController->flushLayers() && !m_rescheduledInsideCallback)
             invalidate();
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to