Title: [244837] trunk/Source/WebCore
Revision
244837
Author
[email protected]
Date
2019-05-01 12:31:06 -0700 (Wed, 01 May 2019)

Log Message

REGRESSION (r244182): RenderingUpdate should not be scheduled for invisible pages
https://bugs.webkit.org/show_bug.cgi?id=197451

Patch by Said Abou-Hallawa <[email protected]> on 2019-05-01
Reviewed by Simon Fraser.

Before r244182, some web pages never need to schedule a RenderingUpdate.
Only pages with rAF callbacks, web animations, intersection and resize
observers needed to do so. After r244182, all pages have to schedule a
RenderingUpdate when a page rendering update is required.

When Safari opens, it create a 'blank' web page. The blank page will not
be visible unless the user selects to show the 'Empty page' in the new
tab. Although the blank page is not visible, the loader needs to resolveStyle()
which requires to scheduleLayerFlushNow().

We need to optimize this case: calling scheduleLayerFlushNow() for invisible
pages. We do that by checking if the page is visible before scheduling
the RenderingUpdate.

Also we need to change or get rid of scheduleLayerFlushNow() since its name
has become confusing. It suggests that it is going to schedule flushing
the layer 'now'. But after r244182, it does scheduleRenderingUpdate() first.
And when it fires, scheduleCompositingLayerFlush() will be called.

* page/RenderingUpdateScheduler.cpp:
(WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::scheduleLayerFlush):
(WebCore::RenderLayerCompositor::didChangeVisibleRect):
(WebCore::RenderLayerCompositor::frameViewDidScroll):
(WebCore::RenderLayerCompositor::attachRootLayer):
(WebCore::RenderLayerCompositor::setLayerFlushThrottlingEnabled):
(WebCore::RenderLayerCompositor::layerFlushTimerFired):
(WebCore::RenderLayerCompositor::scheduleLayerFlushNow): Deleted.
* rendering/RenderLayerCompositor.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (244836 => 244837)


--- trunk/Source/WebCore/ChangeLog	2019-05-01 19:17:05 UTC (rev 244836)
+++ trunk/Source/WebCore/ChangeLog	2019-05-01 19:31:06 UTC (rev 244837)
@@ -1,3 +1,41 @@
+2019-05-01  Said Abou-Hallawa  <[email protected]>
+
+        REGRESSION (r244182): RenderingUpdate should not be scheduled for invisible pages
+        https://bugs.webkit.org/show_bug.cgi?id=197451
+
+        Reviewed by Simon Fraser.
+
+        Before r244182, some web pages never need to schedule a RenderingUpdate.
+        Only pages with rAF callbacks, web animations, intersection and resize 
+        observers needed to do so. After r244182, all pages have to schedule a
+        RenderingUpdate when a page rendering update is required.
+
+        When Safari opens, it create a 'blank' web page. The blank page will not
+        be visible unless the user selects to show the 'Empty page' in the new
+        tab. Although the blank page is not visible, the loader needs to resolveStyle()
+        which requires to scheduleLayerFlushNow(). 
+
+        We need to optimize this case: calling scheduleLayerFlushNow() for invisible
+        pages. We do that by checking if the page is visible before scheduling
+        the RenderingUpdate.
+
+        Also we need to change or get rid of scheduleLayerFlushNow() since its name
+        has become confusing. It suggests that it is going to schedule flushing
+        the layer 'now'. But after r244182, it does scheduleRenderingUpdate() first.
+        And when it fires, scheduleCompositingLayerFlush() will be called.
+
+        * page/RenderingUpdateScheduler.cpp:
+        (WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::scheduleLayerFlush):
+        (WebCore::RenderLayerCompositor::didChangeVisibleRect):
+        (WebCore::RenderLayerCompositor::frameViewDidScroll):
+        (WebCore::RenderLayerCompositor::attachRootLayer):
+        (WebCore::RenderLayerCompositor::setLayerFlushThrottlingEnabled):
+        (WebCore::RenderLayerCompositor::layerFlushTimerFired):
+        (WebCore::RenderLayerCompositor::scheduleLayerFlushNow): Deleted.
+        * rendering/RenderLayerCompositor.h:
+
 2019-05-01  Darin Adler  <[email protected]>
 
         WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support

Modified: trunk/Source/WebCore/page/RenderingUpdateScheduler.cpp (244836 => 244837)


--- trunk/Source/WebCore/page/RenderingUpdateScheduler.cpp	2019-05-01 19:17:05 UTC (rev 244836)
+++ trunk/Source/WebCore/page/RenderingUpdateScheduler.cpp	2019-05-01 19:31:06 UTC (rev 244837)
@@ -47,6 +47,12 @@
     if (isScheduled())
         return;
 
+    // Optimize the case when an invisible page wants just to schedule layer flush.
+    if (!m_page.isVisible()) {
+        scheduleCompositingLayerFlush();
+        return;
+    }
+
     tracePoint(ScheduleRenderingUpdate);
 
 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (244836 => 244837)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-05-01 19:17:05 UTC (rev 244836)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-05-01 19:31:06 UTC (rev 244837)
@@ -453,12 +453,6 @@
     scheduleLayerFlush(layer->canThrottleLayerFlush());
 }
 
-void RenderLayerCompositor::scheduleLayerFlushNow()
-{
-    m_hasPendingLayerFlush = false;
-    page().renderingUpdateScheduler().scheduleRenderingUpdate();
-}
-
 void RenderLayerCompositor::scheduleLayerFlush(bool canThrottle)
 {
     ASSERT(!m_flushingLayers);
@@ -466,11 +460,12 @@
     if (canThrottle)
         startInitialLayerFlushTimerIfNeeded();
 
-    if (canThrottle && isThrottlingLayerFlushes()) {
+    if (canThrottle && isThrottlingLayerFlushes())
         m_hasPendingLayerFlush = true;
-        return;
+    else {
+        m_hasPendingLayerFlush = false;
+        page().renderingUpdateScheduler().scheduleRenderingUpdate();
     }
-    scheduleLayerFlushNow();
 }
 
 FloatRect RenderLayerCompositor::visibleRectForLayerFlushing() const
@@ -607,7 +602,7 @@
     bool requiresFlush = rootLayer->visibleRectChangeRequiresFlush(visibleRect);
     LOG_WITH_STREAM(Compositing, stream << "RenderLayerCompositor::didChangeVisibleRect " << visibleRect << " requiresFlush " << requiresFlush);
     if (requiresFlush)
-        scheduleLayerFlushNow();
+        scheduleLayerFlush();
 }
 
 void RenderLayerCompositor::notifyFlushBeforeDisplayRefresh(const GraphicsLayer*)
@@ -1911,7 +1906,7 @@
     // it will also manage updating the scroll layer position.
     if (hasCoordinatedScrolling()) {
         // We have to schedule a flush in order for the main TiledBacking to update its tile coverage.
-        scheduleLayerFlushNow();
+        scheduleLayerFlush();
         return;
     }
 
@@ -3802,7 +3797,7 @@
     rootLayerAttachmentChanged();
     
     if (m_shouldFlushOnReattach) {
-        scheduleLayerFlushNow();
+        scheduleLayerFlush();
         m_shouldFlushOnReattach = false;
     }
 }
@@ -4374,7 +4369,7 @@
     m_layerFlushTimer.stop();
     if (!m_hasPendingLayerFlush)
         return;
-    scheduleLayerFlushNow();
+    scheduleLayerFlush();
 }
 
 void RenderLayerCompositor::disableLayerFlushThrottlingTemporarilyForInteraction()
@@ -4417,7 +4412,7 @@
 {
     if (!m_hasPendingLayerFlush)
         return;
-    scheduleLayerFlushNow();
+    scheduleLayerFlush();
 }
 
 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (244836 => 244837)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2019-05-01 19:17:05 UTC (rev 244836)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2019-05-01 19:31:06 UTC (rev 244837)
@@ -168,7 +168,7 @@
 
     // GraphicsLayers buffer state, which gets pushed to the underlying platform layers
     // at specific times.
-    void scheduleLayerFlush(bool canThrottle);
+    void scheduleLayerFlush(bool canThrottle = false);
     void flushPendingLayerChanges(bool isFlushRoot = true);
 
     // Called when the GraphicsLayer for the given RenderLayer has flushed changes inside of flushPendingLayerChanges().
@@ -526,7 +526,6 @@
 
     bool shouldCompositeOverflowControls() const;
 
-    void scheduleLayerFlushNow();
     bool isThrottlingLayerFlushes() const;
     void startInitialLayerFlushTimerIfNeeded();
     void startLayerFlushTimerIfNeeded();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to