Changeset 208328 in webkit


Ignore:
Timestamp:
Nov 3, 2016, 9:19:48 AM (9 years ago)
Author:
mitz@apple.com
Message:

REGRESSION (r206247): Painting milestones can be delayed until the next layer flush
https://bugs.webkit.org/show_bug.cgi?id=164340
<rdar://problem/29074344>

Reviewed by Tim Horton.

Source/WebCore:

To give WebKit a chance to deliver the painting milestones to its client after the commit,
we must tell it about them before or during the commit. To that end, we should not defer
the call to firePaintRelatedMilestonesIfNeeded until after the commit.

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::RenderLayerCompositor): Removed

m_paintRelatedMilestonesTimer initializer.

(WebCore::RenderLayerCompositor::didPaintBacking): Call

FrameView::firePaintRelatedMilestonesIfNeeded directly from here.

(WebCore::RenderLayerCompositor::paintRelatedMilestonesTimerFired): Deleted.

  • rendering/RenderLayerCompositor.h:

Source/WebKit2:

  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: Declared new helper function.
  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:

(WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones): Helper

function that sends the message to the UI process and resets
m_pendingNewlyReachedLayoutMilestones.

(WebKit::TiledCoreAnimationDrawingArea::flushLayers): Wait until after the commit to get the

pending milestones and send them to the UI process. This way we don’t miss milestones that
fire during the commit.

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r208327 r208328  
     12016-11-03  Dan Bernstein  <mitz@apple.com>
     2
     3        REGRESSION (r206247): Painting milestones can be delayed until the next layer flush
     4        https://bugs.webkit.org/show_bug.cgi?id=164340
     5        <rdar://problem/29074344>
     6
     7        Reviewed by Tim Horton.
     8
     9        To give WebKit a chance to deliver the painting milestones to its client after the commit,
     10        we must tell it about them before or during the commit. To that end, we should not defer
     11        the call to firePaintRelatedMilestonesIfNeeded until after the commit.
     12
     13        * rendering/RenderLayerCompositor.cpp:
     14        (WebCore::RenderLayerCompositor::RenderLayerCompositor): Removed
     15          m_paintRelatedMilestonesTimer initializer.
     16        (WebCore::RenderLayerCompositor::didPaintBacking): Call
     17          FrameView::firePaintRelatedMilestonesIfNeeded directly from here.
     18        (WebCore::RenderLayerCompositor::paintRelatedMilestonesTimerFired): Deleted.
     19        * rendering/RenderLayerCompositor.h:
     20
    1212016-11-03  Antti Koivisto  <antti@apple.com>
    222
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r208213 r208328  
    275275    : m_renderView(renderView)
    276276    , m_updateCompositingLayersTimer(*this, &RenderLayerCompositor::updateCompositingLayersTimerFired)
    277     , m_paintRelatedMilestonesTimer(*this, &RenderLayerCompositor::paintRelatedMilestonesTimerFired)
    278277    , m_layerFlushTimer(*this, &RenderLayerCompositor::layerFlushTimerFired)
    279278{
     
    570569    FrameView& frameView = m_renderView.frameView();
    571570    frameView.setLastPaintTime(monotonicallyIncreasingTime());
    572     if (frameView.milestonesPendingPaint() && !m_paintRelatedMilestonesTimer.isActive())
    573         m_paintRelatedMilestonesTimer.startOneShot(0);
     571    if (frameView.milestonesPendingPaint())
     572        frameView.firePaintRelatedMilestonesIfNeeded();
    574573}
    575574
     
    42014200}
    42024201
    4203 void RenderLayerCompositor::paintRelatedMilestonesTimerFired()
    4204 {
    4205     Frame& frame = m_renderView.frameView().frame();
    4206     Page* page = frame.page();
    4207     if (!page)
    4208         return;
    4209 
    4210     // If the layer tree is frozen, we'll paint when it's unfrozen and schedule the timer again.
    4211     if (page->chrome().client().layerTreeStateIsFrozen())
    4212         return;
    4213 
    4214     m_renderView.frameView().firePaintRelatedMilestonesIfNeeded();
    4215 }
    4216 
    42174202#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    42184203RefPtr<DisplayRefreshMonitor> RenderLayerCompositor::createDisplayRefreshMonitor(PlatformDisplayID displayID) const
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r206538 r208328  
    476476    void layerFlushTimerFired();
    477477
    478     void paintRelatedMilestonesTimerFired();
    479 
    480478#if !LOG_DISABLED
    481479    const char* logReasonsForCompositing(const RenderLayer&);
     
    549547    std::unique_ptr<GraphicsLayerUpdater> m_layerUpdater; // Updates tiled layer visible area periodically while animations are running.
    550548
    551     Timer m_paintRelatedMilestonesTimer;
    552549    Timer m_layerFlushTimer;
    553550
  • trunk/Source/WebKit2/ChangeLog

    r208307 r208328  
     12016-11-03  Dan Bernstein  <mitz@apple.com>
     2
     3        REGRESSION (r206247): Painting milestones can be delayed until the next layer flush
     4        https://bugs.webkit.org/show_bug.cgi?id=164340
     5        <rdar://problem/29074344>
     6
     7        Reviewed by Tim Horton.
     8
     9        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: Declared new helper function.
     10        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
     11        (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones): Helper
     12          function that sends the message to the UI process and resets
     13          m_pendingNewlyReachedLayoutMilestones.
     14        (WebKit::TiledCoreAnimationDrawingArea::flushLayers): Wait until after the commit to get the
     15          pending milestones and send them to the UI process. This way we don’t miss milestones that
     16          fire during the commit.
     17
    1182016-11-02  David Kilzer  <ddkilzer@apple.com>
    219
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h

    r208225 r208328  
    123123    void scaleViewToFitDocumentIfNeeded();
    124124
     125    void sendPendingNewlyReachedLayoutMilestones();
     126
    125127    bool m_layerTreeStateIsFrozen;
    126128    WebCore::LayerFlushScheduler m_layerFlushScheduler;
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

    r208225 r208328  
    395395}
    396396
     397void TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones()
     398{
     399    if (!m_pendingNewlyReachedLayoutMilestones)
     400        return;
     401
     402    m_webPage.send(Messages::WebPageProxy::DidReachLayoutMilestone(m_pendingNewlyReachedLayoutMilestones));
     403    m_pendingNewlyReachedLayoutMilestones = 0;
     404}
     405
    397406bool TiledCoreAnimationDrawingArea::flushLayers()
    398407{
     
    419428            m_viewOverlayRootLayer->flushCompositingState(visibleRect, m_webPage.mainFrameView()->viewportIsStable());
    420429
     430        RefPtr<WebPage> retainedPage = &m_webPage;
    421431#if TARGET_OS_IPHONE || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
    422         RefPtr<WebPage> retainedPage = &m_webPage;
    423432        [CATransaction addCommitHandler:[retainedPage] {
    424433            if (Page* corePage = retainedPage->corePage()) {
     
    426435                    corePage->inspectorController().didComposite(*coreFrame);
    427436            }
     437            if (auto drawingArea = static_cast<TiledCoreAnimationDrawingArea*>(retainedPage->drawingArea()))
     438                drawingArea->sendPendingNewlyReachedLayoutMilestones();
    428439        } forPhase:kCATransactionPhasePostCommit];
     440#else
     441        dispatch_async(dispatch_get_main_queue(), [retainedPage] {
     442            if (auto drawingArea = static_cast<TiledCoreAnimationDrawingArea*>(retainedPage->drawingArea()))
     443                drawingArea->sendPendingNewlyReachedLayoutMilestones();
     444        });
    429445#endif
    430446
     
    439455        if (m_transientZoomScale != 1)
    440456            applyTransientZoomToLayers(m_transientZoomScale, m_transientZoomOrigin);
    441 
    442         if (m_pendingNewlyReachedLayoutMilestones)
    443             m_webPage.send(Messages::WebPageProxy::DidReachLayoutMilestone(m_pendingNewlyReachedLayoutMilestones));
    444         m_pendingNewlyReachedLayoutMilestones = 0;
    445457
    446458        return returnValue;
Note: See TracChangeset for help on using the changeset viewer.