Changeset 238394 in webkit


Ignore:
Timestamp:
Nov 20, 2018 1:02:25 AM (5 years ago)
Author:
Antti Koivisto
Message:

Avoid potential longer than expected layer flush delays
https://bugs.webkit.org/show_bug.cgi?id=191833

Reviewed by Dean Jackson.

Layer flush throttling also stops style recalcs and layouts. Layouts schedule layer flushes. Especially
on a slow network we can in principle end up in situation where layer flush timer fires but there is no
flush scheduled and so nothing happens. However there is a pending style recalc or layout that would
actually schedule a flush (in practice various things force style recalcs and this doesn't occur
commonly).

To avoid this we should flush unconditionally when the flush timer fires. This performs any pending
style recalc and layout too. If there is nothing to do the flush will be cheap.

PLT doesn't appear to hit cases affected by this patch and there shouldn't be any impact.

  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:

Remove now unnecessary m_hasPendingFlush bit, simplifying the logic.

  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:

(WebKit::TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen):

Schedule unconditionally when unfreezing.

(WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlush):

Remove branch that starts the flush timer. It is not needed as either it was already running
or immediate flush is already scheduled and will start the timer anyway.

(WebKit::TiledCoreAnimationDrawingArea::flushLayers):
(WebKit::TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling):
(WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingTimerFired):

Flush unconditionally.

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r238389 r238394  
     12018-11-20  Antti Koivisto  <antti@apple.com>
     2
     3        Avoid potential longer than expected layer flush delays
     4        https://bugs.webkit.org/show_bug.cgi?id=191833
     5
     6        Reviewed by Dean Jackson.
     7
     8        Layer flush throttling also stops style recalcs and layouts. Layouts schedule layer flushes. Especially
     9        on a slow network we can in principle end up in situation where layer flush timer fires but there is no
     10        flush scheduled and so nothing happens. However there is a pending style recalc or layout that would
     11        actually schedule a flush (in practice various things force style recalcs and this doesn't occur
     12        commonly).
     13
     14        To avoid this we should flush unconditionally when the flush timer fires. This performs any pending
     15        style recalc and layout too. If there is nothing to do the flush will be cheap.
     16
     17        PLT doesn't appear to hit cases affected by this patch and there shouldn't be any impact.
     18
     19        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
     20
     21        Remove now unnecessary m_hasPendingFlush bit, simplifying the logic.
     22
     23        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
     24        (WebKit::TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen):
     25
     26        Schedule unconditionally when unfreezing.
     27
     28        (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlush):
     29
     30        Remove branch that starts the flush timer. It is not needed as either it was already running
     31        or immediate flush is already scheduled and will start the timer anyway.
     32
     33        (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
     34        (WebKit::TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling):
     35        (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingTimerFired):
     36
     37        Flush unconditionally.
     38
    1392018-11-19  Don Olmstead  <don.olmstead@sony.com>
    240
  • trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h

    r238178 r238394  
    178178    bool m_isThrottlingLayerFlushes { false };
    179179    bool m_isLayerFlushThrottlingTemporarilyDisabledForInteraction { false };
    180     bool m_hasPendingFlush { false };
    181180
    182181    WebCore::Timer m_layerFlushThrottlingTimer;
  • trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

    r238178 r238394  
    181181    } else {
    182182        // Immediate flush as any delay in unfreezing can result in flashes.
    183         if (m_hasPendingFlush)
    184             scheduleLayerFlushRunLoopObserver();
     183        scheduleLayerFlushRunLoopObserver();
    185184    }
    186185}
     
    197196void TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlush()
    198197{
    199     m_hasPendingFlush = true;
    200 
    201198    if (m_layerTreeStateIsFrozen) {
    202199        m_isLayerFlushThrottlingTemporarilyDisabledForInteraction = false;
     
    213210    if (m_layerFlushThrottlingTimer.isActive()) {
    214211        ASSERT(m_isThrottlingLayerFlushes);
    215         return;
    216     }
    217 
    218     if (m_isThrottlingLayerFlushes) {
    219         startLayerFlushThrottlingTimer();
    220212        return;
    221213    }
     
    488480        } forPhase:kCATransactionPhasePostCommit];
    489481
    490         m_hasPendingFlush = !m_webPage.mainFrameView()->flushCompositingStateIncludingSubframes();
     482        bool didFlushAllFrames = m_webPage.mainFrameView()->flushCompositingStateIncludingSubframes();
    491483
    492484#if ENABLE(ASYNC_SCROLLING)
     
    505497        }
    506498
    507         if (!m_hasPendingFlush)
     499        if (didFlushAllFrames)
    508500            invalidateLayerFlushRunLoopObserver();
    509501
     
    966958        invalidateLayerFlushRunLoopObserver();
    967959        startLayerFlushThrottlingTimer();
    968     } else if (m_hasPendingFlush)
     960    } else
    969961        scheduleLayerFlushRunLoopObserver();
    970962
     
    989981    if (m_layerTreeStateIsFrozen)
    990982        return;
    991     if (!m_hasPendingFlush)
    992         return;
    993983    scheduleLayerFlushRunLoopObserver();
    994984}
Note: See TracChangeset for help on using the changeset viewer.