Changeset 150898 in webkit


Ignore:
Timestamp:
May 29, 2013 9:04:12 AM (11 years ago)
Author:
Simon Fraser
Message:

Fix the firing of m_paintRelatedMilestonesTimer
https://bugs.webkit.org/show_bug.cgi?id=116919

Reviewed by Tim Horton.

r150671 intended to change things so that paint-related milestones
only fire when painting has actually happened, so that WebKit clients
are notified when we actually have bits to present.

However, it made an incorrect assumption that painting would happen
inside of flushCompositingState(). This is not the case; flushCompositingState()
will just dirty CALayers, and later on Core Animation will ask us to paint them.

This incorrect assumption meant that we would never start the
m_paintRelatedMilestonesTimer, so never fire the milestones.

Fix by starting the m_paintRelatedMilestonesTimer via the RenderLayerBacking
paintContents call back. At this time we know we're painting, so we can both
set the FrameView's last paint time, and start up the timer. We also only
want to start the timer if there are pending milestones.

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::paintIntoLayer):
(WebCore::RenderLayerBacking::paintContents):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::flushPendingLayerChanges):
(WebCore::RenderLayerCompositor::didPaintBacking):

  • rendering/RenderLayerCompositor.h:

(RenderLayerCompositor):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150897 r150898  
     12013-05-29  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Fix the firing of m_paintRelatedMilestonesTimer
     4        https://bugs.webkit.org/show_bug.cgi?id=116919
     5
     6        Reviewed by Tim Horton.
     7
     8        r150671 intended to change things so that paint-related milestones
     9        only fire when painting has actually happened, so that WebKit clients
     10        are notified when we actually have bits to present.
     11       
     12        However, it made an incorrect assumption that painting would happen
     13        inside of flushCompositingState(). This is not the case; flushCompositingState()
     14        will just dirty CALayers, and later on Core Animation will ask us to paint them.
     15       
     16        This incorrect assumption meant that we would never start the
     17        m_paintRelatedMilestonesTimer, so never fire the milestones.
     18       
     19        Fix by starting the m_paintRelatedMilestonesTimer via the RenderLayerBacking
     20        paintContents call back. At this time we know we're painting, so we can both
     21        set the FrameView's last paint time, and start up the timer. We also only
     22        want to start the timer if there are pending milestones.
     23
     24        * rendering/RenderLayerBacking.cpp:
     25        (WebCore::RenderLayerBacking::paintIntoLayer):
     26        (WebCore::RenderLayerBacking::paintContents):
     27        * rendering/RenderLayerCompositor.cpp:
     28        (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
     29        (WebCore::RenderLayerCompositor::didPaintBacking):
     30        * rendering/RenderLayerCompositor.h:
     31        (RenderLayerCompositor):
     32
    1332013-05-29  Antti Koivisto  <antti@apple.com>
    234
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r150685 r150898  
    5959#include "StyleResolver.h"
    6060#include "TiledBacking.h"
    61 #include <wtf/CurrentTime.h>
    6261#include <wtf/text/StringBuilder.h>
    6362
     
    19791978        m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags | RenderLayer::PaintLayerPaintingOverlayScrollbars);
    19801979
     1980    compositor()->didPaintBacking(this);
     1981
    19811982    ASSERT(!m_owningLayer->m_usedTransparency);
    19821983}
     
    20182019        // We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
    20192020        paintIntoLayer(graphicsLayer, &context, dirtyRect, PaintBehaviorNormal, paintingPhase);
    2020 
    2021         if (m_usingTiledCacheLayer)
    2022             renderer()->frame()->view()->setLastPaintTime(currentTime());
    20232021
    20242022        InspectorInstrumentation::didPaint(renderer(), &context, clip);
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r150671 r150898  
    6060#include "TiledBacking.h"
    6161#include "TransformState.h"
     62#include <wtf/CurrentTime.h>
    6263#include <wtf/TemporaryChange.h>
    6364
    6465#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
    6566#include "HTMLMediaElement.h"
    66 #endif
    67 
    68 #if !LOG_DISABLED
    69 #include <wtf/CurrentTime.h>
    7067#endif
    7168
     
    374371    m_flushingLayers = false;
    375372
    376     if (!m_paintRelatedMilestonesTimer.isActive() && frameView->hasEverPainted())
    377         m_paintRelatedMilestonesTimer.startOneShot(0);
    378 
    379373    if (!m_viewportConstrainedLayersNeedingUpdate.isEmpty()) {
    380374        HashSet<RenderLayer*>::const_iterator end = m_viewportConstrainedLayersNeedingUpdate.end();
     
    395389    if (backing->backgroundLayerPaintsFixedRootBackground() && graphicsLayer == backing->backgroundLayer())
    396390        fixedRootBackgroundLayerChanged();
     391}
     392
     393void RenderLayerCompositor::didPaintBacking(RenderLayerBacking*)
     394{
     395    FrameView* frameView = m_renderView->frameView();
     396   
     397    frameView->setLastPaintTime(currentTime());
     398   
     399    if (frameView->milestonesPendingPaint() && !m_paintRelatedMilestonesTimer.isActive())
     400        m_paintRelatedMilestonesTimer.startOneShot(0);
    397401}
    398402
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r150433 r150898  
    282282    void setLayerFlushThrottlingEnabled(bool);
    283283    void disableLayerFlushThrottlingTemporarilyForInteraction();
     284   
     285    void didPaintBacking(RenderLayerBacking*);
    284286
    285287private:
Note: See TracChangeset for help on using the changeset viewer.