Changeset 244837 in webkit


Ignore:
Timestamp:
May 1, 2019 12:31:06 PM (5 years ago)
Author:
commit-queue@webkit.org
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 <sabouhallawa@apple.com> 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:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r244828 r244837  
     12019-05-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        REGRESSION (r244182): RenderingUpdate should not be scheduled for invisible pages
     4        https://bugs.webkit.org/show_bug.cgi?id=197451
     5
     6        Reviewed by Simon Fraser.
     7
     8        Before r244182, some web pages never need to schedule a RenderingUpdate.
     9        Only pages with rAF callbacks, web animations, intersection and resize
     10        observers needed to do so. After r244182, all pages have to schedule a
     11        RenderingUpdate when a page rendering update is required.
     12
     13        When Safari opens, it create a 'blank' web page. The blank page will not
     14        be visible unless the user selects to show the 'Empty page' in the new
     15        tab. Although the blank page is not visible, the loader needs to resolveStyle()
     16        which requires to scheduleLayerFlushNow().
     17
     18        We need to optimize this case: calling scheduleLayerFlushNow() for invisible
     19        pages. We do that by checking if the page is visible before scheduling
     20        the RenderingUpdate.
     21
     22        Also we need to change or get rid of scheduleLayerFlushNow() since its name
     23        has become confusing. It suggests that it is going to schedule flushing
     24        the layer 'now'. But after r244182, it does scheduleRenderingUpdate() first.
     25        And when it fires, scheduleCompositingLayerFlush() will be called.
     26
     27        * page/RenderingUpdateScheduler.cpp:
     28        (WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
     29        * rendering/RenderLayerCompositor.cpp:
     30        (WebCore::RenderLayerCompositor::scheduleLayerFlush):
     31        (WebCore::RenderLayerCompositor::didChangeVisibleRect):
     32        (WebCore::RenderLayerCompositor::frameViewDidScroll):
     33        (WebCore::RenderLayerCompositor::attachRootLayer):
     34        (WebCore::RenderLayerCompositor::setLayerFlushThrottlingEnabled):
     35        (WebCore::RenderLayerCompositor::layerFlushTimerFired):
     36        (WebCore::RenderLayerCompositor::scheduleLayerFlushNow): Deleted.
     37        * rendering/RenderLayerCompositor.h:
     38
    1392019-05-01  Darin Adler  <darin@apple.com>
    240
  • trunk/Source/WebCore/page/RenderingUpdateScheduler.cpp

    r244182 r244837  
    4747    if (isScheduled())
    4848        return;
     49
     50    // Optimize the case when an invisible page wants just to schedule layer flush.
     51    if (!m_page.isVisible()) {
     52        scheduleCompositingLayerFlush();
     53        return;
     54    }
    4955
    5056    tracePoint(ScheduleRenderingUpdate);
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r244752 r244837  
    454454}
    455455
    456 void RenderLayerCompositor::scheduleLayerFlushNow()
    457 {
    458     m_hasPendingLayerFlush = false;
    459     page().renderingUpdateScheduler().scheduleRenderingUpdate();
    460 }
    461 
    462456void RenderLayerCompositor::scheduleLayerFlush(bool canThrottle)
    463457{
     
    467461        startInitialLayerFlushTimerIfNeeded();
    468462
    469     if (canThrottle && isThrottlingLayerFlushes()) {
     463    if (canThrottle && isThrottlingLayerFlushes())
    470464        m_hasPendingLayerFlush = true;
    471         return;
    472     }
    473     scheduleLayerFlushNow();
     465    else {
     466        m_hasPendingLayerFlush = false;
     467        page().renderingUpdateScheduler().scheduleRenderingUpdate();
     468    }
    474469}
    475470
     
    608603    LOG_WITH_STREAM(Compositing, stream << "RenderLayerCompositor::didChangeVisibleRect " << visibleRect << " requiresFlush " << requiresFlush);
    609604    if (requiresFlush)
    610         scheduleLayerFlushNow();
     605        scheduleLayerFlush();
    611606}
    612607
     
    19121907    if (hasCoordinatedScrolling()) {
    19131908        // We have to schedule a flush in order for the main TiledBacking to update its tile coverage.
    1914         scheduleLayerFlushNow();
     1909        scheduleLayerFlush();
    19151910        return;
    19161911    }
     
    38033798   
    38043799    if (m_shouldFlushOnReattach) {
    3805         scheduleLayerFlushNow();
     3800        scheduleLayerFlush();
    38063801        m_shouldFlushOnReattach = false;
    38073802    }
     
    43754370    if (!m_hasPendingLayerFlush)
    43764371        return;
    4377     scheduleLayerFlushNow();
     4372    scheduleLayerFlush();
    43784373}
    43794374
     
    44184413    if (!m_hasPendingLayerFlush)
    44194414        return;
    4420     scheduleLayerFlushNow();
     4415    scheduleLayerFlush();
    44214416}
    44224417
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r243209 r244837  
    169169    // GraphicsLayers buffer state, which gets pushed to the underlying platform layers
    170170    // at specific times.
    171     void scheduleLayerFlush(bool canThrottle);
     171    void scheduleLayerFlush(bool canThrottle = false);
    172172    void flushPendingLayerChanges(bool isFlushRoot = true);
    173173
     
    527527    bool shouldCompositeOverflowControls() const;
    528528
    529     void scheduleLayerFlushNow();
    530529    bool isThrottlingLayerFlushes() const;
    531530    void startInitialLayerFlushTimerIfNeeded();
Note: See TracChangeset for help on using the changeset viewer.