Changeset 127556 in webkit


Ignore:
Timestamp:
Sep 4, 2012 11:07:18 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[chromium] Prevent compositor ticking if it can't draw
https://bugs.webkit.org/show_bug.cgi?id=95399

Patch by Brian Anderson <brianderson@chromium.org> on 2012-09-04
Reviewed by James Robinson.

Background extensions had an always ticking compositor even though
they couldn't draw. This patch disables the ticks when canDraw is false
and adds a notification mechanism for when canDraw changes states so
we can recover properly.

Tests updated for new interfaces.
Regression test added to make sure ticking stops when canDraw is false.
notifyIfCanDrawChanged test added to make sure notifications are sent
for any changes that might affect canDraw.

  • platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:

(WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::notifyIfCanDrawChanged):
(WebCore):
(WebCore::CCLayerTreeHostImpl::releaseContentsTextures):
(WebCore::CCLayerTreeHostImpl::setRootLayer):
(WebCore::CCLayerTreeHostImpl::initializeRenderer):
(WebCore::CCLayerTreeHostImpl::setViewportSize):

  • platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:

(CCLayerTreeHostImplClient):
(WebCore::CCLayerTreeHostImpl::resetContentsTexturesPurged):
(CCLayerTreeHostImpl):

  • platform/graphics/chromium/cc/CCScheduler.cpp:

(WebCore::CCScheduler::setCanDraw):
(WebCore):
(WebCore::CCScheduler::processScheduledActions):

  • platform/graphics/chromium/cc/CCScheduler.h:

(CCScheduler):

  • platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp:

(WebCore::CCSchedulerStateMachine::toString):
(WebCore):
(WebCore::CCSchedulerStateMachine::vsyncCallbackNeeded):

  • platform/graphics/chromium/cc/CCSchedulerStateMachine.h:

(CCSchedulerStateMachine):

  • platform/graphics/chromium/cc/CCSingleThreadProxy.h:
  • platform/graphics/chromium/cc/CCThreadProxy.cpp:

(WebCore::CCThreadProxy::onCanDrawStateChanged):
(WebCore):
(WebCore::CCThreadProxy::beginFrame):
(WebCore::CCThreadProxy::beginFrameCompleteOnImplThread):

  • platform/graphics/chromium/cc/CCThreadProxy.h:
Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r127555 r127556  
     12012-09-04  Brian Anderson  <brianderson@chromium.org>
     2
     3        [chromium] Prevent compositor ticking if it can't draw
     4        https://bugs.webkit.org/show_bug.cgi?id=95399
     5
     6        Reviewed by James Robinson.
     7
     8        Background extensions had an always ticking compositor even though
     9        they couldn't draw. This patch disables the ticks when canDraw is false
     10        and adds a notification mechanism for when canDraw changes states so
     11        we can recover properly.
     12
     13        Tests updated for new interfaces.
     14        Regression test added to make sure ticking stops when canDraw is false.
     15        notifyIfCanDrawChanged test added to make sure notifications are sent
     16        for any changes that might affect canDraw.
     17
     18        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
     19        (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
     20        (WebCore::CCLayerTreeHostImpl::notifyIfCanDrawChanged):
     21        (WebCore):
     22        (WebCore::CCLayerTreeHostImpl::releaseContentsTextures):
     23        (WebCore::CCLayerTreeHostImpl::setRootLayer):
     24        (WebCore::CCLayerTreeHostImpl::initializeRenderer):
     25        (WebCore::CCLayerTreeHostImpl::setViewportSize):
     26        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
     27        (CCLayerTreeHostImplClient):
     28        (WebCore::CCLayerTreeHostImpl::resetContentsTexturesPurged):
     29        (CCLayerTreeHostImpl):
     30        * platform/graphics/chromium/cc/CCScheduler.cpp:
     31        (WebCore::CCScheduler::setCanDraw):
     32        (WebCore):
     33        (WebCore::CCScheduler::processScheduledActions):
     34        * platform/graphics/chromium/cc/CCScheduler.h:
     35        (CCScheduler):
     36        * platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp:
     37        (WebCore::CCSchedulerStateMachine::toString):
     38        (WebCore):
     39        (WebCore::CCSchedulerStateMachine::vsyncCallbackNeeded):
     40        * platform/graphics/chromium/cc/CCSchedulerStateMachine.h:
     41        (CCSchedulerStateMachine):
     42        * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
     43        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
     44        (WebCore::CCThreadProxy::onCanDrawStateChanged):
     45        (WebCore):
     46        (WebCore::CCThreadProxy::beginFrame):
     47        (WebCore::CCThreadProxy::beginFrameCompleteOnImplThread):
     48        * platform/graphics/chromium/cc/CCThreadProxy.h:
     49
    1502012-09-04  Adam Barth  <abarth@chromium.org>
    251
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp

    r127081 r127556  
    169169bool CCLayerTreeHostImpl::canDraw()
    170170{
     171    // Note: If you are changing this function or any other function that might
     172    // affect the result of canDraw, make sure to call m_client->onCanDrawStateChanged
     173    // in the proper places and update the notifyIfCanDrawChanged test.
     174
    171175    if (!m_rootLayerImpl) {
    172176        TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw no root layer");
     
    531535    m_contentsTexturesPurged = true;
    532536    m_client->setNeedsCommitOnImplThread();
     537    m_client->onCanDrawStateChanged(canDraw());
    533538}
    534539
     
    670675
    671676    m_scrollingLayerIdFromPreviousTree = -1;
     677
     678    m_client->onCanDrawStateChanged(canDraw());
    672679}
    673680
     
    732739         m_renderer->setVisible(m_visible);
    733740
     741    m_client->onCanDrawStateChanged(canDraw());
     742
    734743    return m_renderer;
     744}
     745
     746void CCLayerTreeHostImpl::resetContentsTexturesPurged()
     747{
     748    m_contentsTexturesPurged = false;
     749    m_client->onCanDrawStateChanged(canDraw());
    735750}
    736751
     
    747762    if (m_renderer)
    748763        m_renderer->viewportChanged();
     764
     765    m_client->onCanDrawStateChanged(canDraw());
    749766}
    750767
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h

    r126790 r127556  
    5858    virtual void onSwapBuffersCompleteOnImplThread() = 0;
    5959    virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) = 0;
     60    virtual void onCanDrawStateChanged(bool canDraw) = 0;
    6061    virtual void setNeedsRedrawOnImplThread() = 0;
    6162    virtual void setNeedsCommitOnImplThread() = 0;
     
    161162
    162163    bool contentsTexturesPurged() const { return m_contentsTexturesPurged; }
    163     void resetContentsTexturesPurged() { m_contentsTexturesPurged = false; }
     164    void resetContentsTexturesPurged();
    164165    size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBytes; }
    165166
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp

    r127476 r127556  
    5858}
    5959
     60void CCScheduler::setCanDraw(bool canDraw)
     61{
     62    m_stateMachine.setCanDraw(canDraw);
     63
     64    // Defer processScheduleActions so we don't recurse and commit/draw
     65    // multiple frames. We can call processScheduledActions directly
     66    // once it is no longer re-entrant.
     67    m_frameRateController->setActive(m_stateMachine.vsyncCallbackNeeded());
     68}
     69
    6070void CCScheduler::setNeedsCommit()
    6171{
     
    151161}
    152162
    153 CCSchedulerStateMachine::Action CCScheduler::nextAction()
    154 {
    155     m_stateMachine.setCanDraw(m_client->canDraw());
    156     return m_stateMachine.nextAction();
    157 }
    158 
    159163void CCScheduler::processScheduledActions()
    160164{
    161165    // Early out so we don't spam TRACE_EVENTS with useless processScheduledActions.
    162     if (nextAction() == CCSchedulerStateMachine::ACTION_NONE) {
     166    if (m_stateMachine.nextAction() == CCSchedulerStateMachine::ACTION_NONE) {
    163167        m_frameRateController->setActive(m_stateMachine.vsyncCallbackNeeded());
    164168        return;
     
    169173    CCSchedulerStateMachine::Action action;
    170174    do {
    171         action = nextAction();
     175        action = m_stateMachine.nextAction();
    172176        m_stateMachine.updateState(action);
    173177        TRACE_EVENT1("cc", "CCScheduler::processScheduledActions()", "action", action);
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.h

    r127476 r127556  
    5353class CCSchedulerClient {
    5454public:
    55     virtual bool canDraw() = 0;
    5655    virtual bool hasMoreResourceUpdates() const = 0;
    5756
     
    8180
    8281    void setVisible(bool);
     82    void setCanDraw(bool);
    8383
    8484    void setNeedsCommit();
     
    115115    CCScheduler(CCSchedulerClient*, PassOwnPtr<CCFrameRateController>);
    116116
    117     CCSchedulerStateMachine::Action nextAction();
    118117    void processScheduledActions();
    119118
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp

    r126719 r127556  
    2626
    2727#include "CCSchedulerStateMachine.h"
     28#include "TextStream.h"
     29
    2830
    2931namespace WebCore {
     
    4547    , m_visible(false)
    4648    , m_canBeginFrame(false)
    47     , m_canDraw(true)
     49    , m_canDraw(false)
    4850    , m_drawIfPossibleFailed(false)
    4951    , m_textureState(LAYER_TEXTURE_STATE_UNLOCKED)
    5052    , m_contextState(CONTEXT_ACTIVE)
    5153{
     54}
     55
     56String CCSchedulerStateMachine::toString()
     57{
     58    TextStream ts;
     59    ts << "m_commitState = " << m_commitState << "; ";
     60    ts << "m_currentFrameNumber = " << m_currentFrameNumber << "; ";
     61    ts << "m_lastFrameNumberWhereDrawWasCalled = " << m_lastFrameNumberWhereDrawWasCalled << "; ";
     62    ts << "m_consecutiveFailedDraws = " << m_consecutiveFailedDraws << "; ";
     63    ts << "m_maximumNumberOfFailedDrawsBeforeDrawIsForced = " << m_maximumNumberOfFailedDrawsBeforeDrawIsForced << "; ";
     64    ts << "m_needsRedraw = " << m_needsRedraw << "; ";
     65    ts << "m_needsForcedRedraw = " << m_needsForcedRedraw << "; ";
     66    ts << "m_needsForcedRedrawAfterNextCommit = " << m_needsForcedRedrawAfterNextCommit << "; ";
     67    ts << "m_needsCommit = " << m_needsCommit << "; ";
     68    ts << "m_needsForcedCommit = " << m_needsForcedCommit << "; ";
     69    ts << "m_mainThreadNeedsLayerTextures = " << m_mainThreadNeedsLayerTextures << "; ";
     70    ts << "m_updateMoreResourcesPending = " << m_updateMoreResourcesPending << "; ";
     71    ts << "m_insideVSync = " << m_insideVSync << "; ";
     72    ts << "m_visible = " << m_visible << "; ";
     73    ts << "m_canBeginFrame = " << m_canBeginFrame << "; ";
     74    ts << "m_canDraw = " << m_canDraw << "; ";
     75    ts << "m_drawIfPossibleFailed = " << m_drawIfPossibleFailed << "; ";
     76    ts << "m_textureState = " << m_textureState << "; ";
     77    ts << "m_contextState = " << m_contextState << "; ";
     78    return ts.release();
    5279}
    5380
     
    231258bool CCSchedulerStateMachine::vsyncCallbackNeeded() const
    232259{
    233     if (!m_visible || m_contextState != CONTEXT_ACTIVE) {
    234         if (m_needsForcedRedraw || m_commitState == COMMIT_STATE_UPDATING_RESOURCES)
    235             return true;
    236 
    237         return false;
    238     }
    239 
    240     return m_needsRedraw || m_needsForcedRedraw || m_commitState == COMMIT_STATE_UPDATING_RESOURCES;
     260    // To prevent live-lock, we must always tick when updating resources.
     261    if (m_updateMoreResourcesPending || m_commitState == COMMIT_STATE_UPDATING_RESOURCES)
     262        return true;
     263
     264    // If we can't draw, don't tick until we are notified that we can draw again.
     265    if (!m_canDraw)
     266        return false;
     267
     268    if (m_needsForcedRedraw)
     269        return true;
     270
     271    return m_needsRedraw && m_visible && m_contextState == CONTEXT_ACTIVE;
    241272}
    242273
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSchedulerStateMachine.h

    r121076 r127556  
    2727
    2828#include <wtf/Noncopyable.h>
     29#include <wtf/text/WTFString.h>
    2930
    3031namespace WebCore {
     
    149150    void setMaximumNumberOfFailedDrawsBeforeDrawIsForced(int);
    150151
     152    String toString();
     153
    151154protected:
    152155    bool shouldDrawForced() const;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h

    r127317 r127556  
    7070    virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { ASSERT_NOT_REACHED(); }
    7171    virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE { }
     72    virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { }
    7273    virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_layerTreeHost->scheduleComposite(); }
    7374    virtual void setNeedsCommitOnImplThread() OVERRIDE { m_layerTreeHost->scheduleComposite(); }
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp

    r127476 r127556  
    353353}
    354354
     355void CCThreadProxy::onCanDrawStateChanged(bool canDraw)
     356{
     357    ASSERT(isImplThread());
     358    TRACE_EVENT1("cc", "CCThreadProxy::onCanDrawStateChanged", "canDraw", canDraw);
     359    m_schedulerOnImplThread->setCanDraw(canDraw);
     360}
     361
    355362void CCThreadProxy::setNeedsCommitOnImplThread()
    356363{
     
    543550    m_forcedCommitRequested = false;
    544551
    545     if (!m_layerTreeHost->initializeRendererIfNeeded())
    546         return;
     552    if (!m_layerTreeHost->initializeRendererIfNeeded()) {
     553        TRACE_EVENT0("cc", "EarlyOut_InitializeFailed");
     554        return;
     555    }
    547556
    548557    if (request->contentsTexturesWereDeleted)
     
    594603
    595604    if (!m_layerTreeHostImpl) {
     605        TRACE_EVENT0("cc", "EarlyOut_NoLayerTree");
    596606        completion->signal();
    597607        return;
     
    629639        return false;
    630640    return m_currentTextureUpdateControllerOnImplThread->hasMoreUpdates();
    631 }
    632 
    633 bool CCThreadProxy::canDraw()
    634 {
    635     ASSERT(isImplThread());
    636     if (!m_layerTreeHostImpl)
    637         return false;
    638     return m_layerTreeHostImpl->canDraw();
    639641}
    640642
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h

    r127099 r127556  
    7979    virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE;
    8080    virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE;
     81    virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE;
    8182    virtual void setNeedsRedrawOnImplThread() OVERRIDE;
    8283    virtual void setNeedsCommitOnImplThread() OVERRIDE;
     
    8485
    8586    // CCSchedulerClient implementation
    86     virtual bool canDraw() OVERRIDE;
    8787    virtual bool hasMoreResourceUpdates() const OVERRIDE;
     88
    8889    virtual void scheduledActionBeginFrame() OVERRIDE;
    8990    virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE;
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp

    r127340 r127556  
    7171public:
    7272    CCLayerTreeHostImplTest()
    73         : m_didRequestCommit(false)
     73        : m_onCanDrawStateChangedCalled(false)
     74        , m_didRequestCommit(false)
    7475        , m_didRequestRedraw(false)
    7576    {
     
    8586    virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { }
    8687    virtual void onVSyncParametersChanged(double, double) OVERRIDE { }
     88    virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawStateChangedCalled = true; }
    8789    virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = true; }
    8890    virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; }
     
    186188
    187189    OwnPtr<CCLayerTreeHostImpl> m_hostImpl;
     190    bool m_onCanDrawStateChangedCalled;
    188191    bool m_didRequestCommit;
    189192    bool m_didRequestRedraw;
     
    195198    virtual bool makeContextCurrent() { return false; }
    196199};
     200
     201TEST_F(CCLayerTreeHostImplTest, notifyIfCanDrawChanged)
     202{
     203    // Note: It is not possible to disable the renderer once it has been set,
     204    // so we do not need to test that disabling the renderer notifies us
     205    // that canDraw changed.
     206    EXPECT_FALSE(m_hostImpl->canDraw());
     207    m_onCanDrawStateChangedCalled = false;
     208
     209    setupScrollAndContentsLayers(IntSize(100, 100));
     210    EXPECT_TRUE(m_hostImpl->canDraw());
     211    EXPECT_TRUE(m_onCanDrawStateChangedCalled);
     212    m_onCanDrawStateChangedCalled = false;
     213
     214    // Toggle the root layer to make sure it toggles canDraw
     215    m_hostImpl->setRootLayer(adoptPtr<CCLayerImpl>(0));
     216    EXPECT_FALSE(m_hostImpl->canDraw());
     217    EXPECT_TRUE(m_onCanDrawStateChangedCalled);
     218    m_onCanDrawStateChangedCalled = false;
     219
     220    setupScrollAndContentsLayers(IntSize(100, 100));
     221    EXPECT_TRUE(m_hostImpl->canDraw());
     222    EXPECT_TRUE(m_onCanDrawStateChangedCalled);
     223    m_onCanDrawStateChangedCalled = false;
     224
     225    // Toggle the device viewport size to make sure it toggles canDraw.
     226    m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(0, 0));
     227    EXPECT_FALSE(m_hostImpl->canDraw());
     228    EXPECT_TRUE(m_onCanDrawStateChangedCalled);
     229    m_onCanDrawStateChangedCalled = false;
     230
     231    m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100));
     232    EXPECT_TRUE(m_hostImpl->canDraw());
     233    EXPECT_TRUE(m_onCanDrawStateChangedCalled);
     234    m_onCanDrawStateChangedCalled = false;
     235
     236    // Toggle contents textures purged to make sure it toggles canDraw
     237    m_hostImpl->releaseContentsTextures();
     238    EXPECT_FALSE(m_hostImpl->canDraw());
     239    EXPECT_TRUE(m_onCanDrawStateChangedCalled);
     240    m_onCanDrawStateChangedCalled = false;
     241
     242    m_hostImpl->resetContentsTexturesPurged();
     243    EXPECT_TRUE(m_hostImpl->canDraw());
     244    EXPECT_TRUE(m_onCanDrawStateChangedCalled);
     245    m_onCanDrawStateChangedCalled = false;
     246}
    197247
    198248TEST_F(CCLayerTreeHostImplTest, scrollDeltaNoLayers)
  • trunk/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp

    r126719 r127556  
    137137{
    138138    CCSchedulerStateMachine state;
     139    state.setCanDraw(true);
    139140    state.setNeedsForcedRedraw();
    140141    EXPECT_FALSE(state.redrawPending());
     
    147148    state.setCanBeginFrame(true);
    148149    state.setVisible(true);
     150    state.setCanDraw(true);
    149151    state.setNeedsRedraw();
    150152    EXPECT_TRUE(state.redrawPending());
     
    172174    state.setCanBeginFrame(true);
    173175    state.setVisible(true);
     176    state.setCanDraw(true);
    174177    state.setNeedsRedraw();
    175178    EXPECT_TRUE(state.redrawPending());
     
    200203    state.setCanBeginFrame(true);
    201204    state.setVisible(true);
     205    state.setCanDraw(true);
    202206
    203207    // Start a commit.
     
    240244    state.setCanBeginFrame(true);
    241245    state.setVisible(true);
     246    state.setCanDraw(true);
    242247
    243248    // Start a commit.
     
    291296    state.setCanBeginFrame(true);
    292297    state.setVisible(true);
     298    state.setCanDraw(true);
    293299    state.setMaximumNumberOfFailedDrawsBeforeDrawIsForced(1);
    294300
     
    333339    state.setCanBeginFrame(true);
    334340    state.setVisible(true);
     341    state.setCanDraw(true);
    335342
    336343    // Start a draw.
     
    362369    CCSchedulerStateMachine state;
    363370    state.setVisible(true);
     371    state.setCanDraw(true);
    364372    state.setNeedsRedraw();
    365373    EXPECT_TRUE(state.vsyncCallbackNeeded());
     
    414422        for (unsigned j = 0; j < 2; ++j) {
    415423            StateMachine state;
     424            state.setCanDraw(true);
    416425            state.setCommitState(allCommitStates[i]);
    417426            bool forcedDraw = j;
     
    526535}
    527536
     537TEST(CCSchedulerStateMachineTest, TestVsyncCallbackNeededOnCanDrawAndResourceUpdates)
     538{
     539    StateMachine state;
     540    state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
     541    state.setCanBeginFrame(true);
     542    state.setNeedsCommit(true);
     543    state.setNeedsRedraw(true);
     544    state.setUpdateMoreResourcesPending(false);
     545    state.setVisible(true);
     546    state.setCanDraw(false);
     547    EXPECT_FALSE(state.vsyncCallbackNeeded());
     548
     549    state.setUpdateMoreResourcesPending(true);
     550    EXPECT_TRUE(state.vsyncCallbackNeeded());
     551
     552    state.setUpdateMoreResourcesPending(false);
     553    EXPECT_FALSE(state.vsyncCallbackNeeded());
     554
     555    state.setCanDraw(true);
     556    EXPECT_TRUE(state.vsyncCallbackNeeded());
     557}
     558
    528559TEST(CCSchedulerStateMachineTest, TestUpdates_NoRedraw_OneRoundOfUpdates)
    529560{
     
    533564    state.setUpdateMoreResourcesPending(false);
    534565    state.setVisible(true);
     566    state.setCanDraw(true);
    535567
    536568    // Verify we begin update, both for vsync and not vsync.
     
    561593    state.setUpdateMoreResourcesPending(false);
    562594    state.setVisible(true);
     595    state.setCanDraw(true);
    563596
    564597    // Verify the update begins, both for vsync and not vsync.
     
    600633{
    601634    StateMachine state;
     635    state.setCanDraw(true);
    602636    state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_UPDATING_RESOURCES);
    603637    state.setNeedsRedraw(false);
     
    617651    state.setUpdateMoreResourcesPending(false);
    618652    state.setVisible(true);
     653    state.setCanDraw(true);
    619654    EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES, state.nextAction());
    620655
     
    664699    state.setNeedsCommit(true);
    665700    state.setVisible(true);
     701    state.setCanDraw(true);
    666702
    667703    // Begin the frame.
     
    706742    state.setCanBeginFrame(true);
    707743    state.setVisible(true);
     744    state.setCanDraw(true);
    708745
    709746    // Start clean and set commit.
     
    754791    state.setCanBeginFrame(true);
    755792    state.setVisible(true);
     793    state.setCanDraw(true);
    756794
    757795    // Start clean and set commit.
     
    813851    state.setCanBeginFrame(true);
    814852    state.setVisible(true);
     853    state.setCanDraw(true);
    815854
    816855    // Start clean and set commit.
     
    851890    state.setCanBeginFrame(true);
    852891    state.setVisible(true);
     892    state.setCanDraw(true);
    853893
    854894    state.didLoseContext();
     
    873913    state.setCanBeginFrame(true);
    874914    state.setVisible(true);
     915    state.setCanDraw(true);
    875916
    876917    state.didLoseContext();
     
    909950    state.setCanBeginFrame(true);
    910951    state.setVisible(true);
     952    state.setCanDraw(true);
    911953
    912954    // Get a commit in flight.
     
    950992    state.setCanBeginFrame(true);
    951993    state.setVisible(true);
     994    state.setCanDraw(true);
    952995
    953996    // Get a commit in flight.
     
    10001043    StateMachine state;
    10011044    state.setVisible(true);
     1045    state.setCanDraw(true);
    10021046
    10031047    // Cause a lost context lost.
     
    10381082    StateMachine state;
    10391083    state.setVisible(true);
     1084    state.setCanDraw(true);
    10401085    state.setNeedsCommit(true);
    10411086    state.setNeedsForcedCommit(true);
     
    10701115    state.setCanBeginFrame(true);
    10711116    state.setVisible(true);
     1117    state.setCanDraw(true);
    10721118    state.setNeedsCommit(true);
    10731119    state.setNeedsForcedCommit(true);
  • trunk/Source/WebKit/chromium/tests/CCSchedulerTest.cpp

    r127079 r127556  
    4545        m_actions.clear();
    4646        m_hasMoreResourceUpdates = false;
    47         m_canDraw = true;
    4847        m_drawWillHappen = true;
    4948        m_swapWillHappenIfDrawHappens = true;
     
    5251
    5352    void setHasMoreResourceUpdates(bool b) { m_hasMoreResourceUpdates = b; }
    54     void setCanDraw(bool b) { m_canDraw = b; }
    5553
    5654    int numDraws() const { return m_numDraws; }
     
    6664    }
    6765
    68     virtual bool canDraw() OVERRIDE { return m_canDraw; }
    6966    virtual bool hasMoreResourceUpdates() const OVERRIDE { return m_hasMoreResourceUpdates; }
     67
    7068    virtual void scheduledActionBeginFrame() OVERRIDE { m_actions.push_back("scheduledActionBeginFrame"); }
    7169    virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE
     
    9290protected:
    9391    bool m_hasMoreResourceUpdates;
    94     bool m_canDraw;
    9592    bool m_drawWillHappen;
    9693    bool m_swapWillHappenIfDrawHappens;
     
    106103    scheduler->setCanBeginFrame(true);
    107104    scheduler->setVisible(true);
     105    scheduler->setCanDraw(true);
    108106
    109107    // SetNeedsCommit should begin the frame.
     
    140138    scheduler->setCanBeginFrame(true);
    141139    scheduler->setVisible(true);
     140    scheduler->setCanDraw(true);
    142141
    143142    // SetNedsCommit should begin the frame.
     
    173172    scheduler->setCanBeginFrame(true);
    174173    scheduler->setVisible(true);
     174    scheduler->setCanDraw(true);
    175175
    176176    scheduler->setNeedsCommit();
     
    211211    scheduler->setCanBeginFrame(true);
    212212    scheduler->setVisible(true);
     213    scheduler->setCanDraw(true);
    213214
    214215    scheduler->setNeedsCommit();
     
    274275    scheduler->setCanBeginFrame(true);
    275276    scheduler->setVisible(true);
     277    scheduler->setCanDraw(true);
    276278
    277279    scheduler->setNeedsRedraw();
     
    300302    scheduler->setCanBeginFrame(true);
    301303    scheduler->setVisible(true);
     304    scheduler->setCanDraw(true);
    302305    client.setDrawWillHappen(false);
    303306
     
    372375    scheduler->setCanBeginFrame(true);
    373376    scheduler->setVisible(true);
     377    scheduler->setCanDraw(true);
    374378
    375379    scheduler->setNeedsRedraw();
     
    399403    scheduler->setCanBeginFrame(true);
    400404    scheduler->setVisible(true);
     405    scheduler->setCanDraw(true);
    401406    client.setDrawWillHappen(false);
    402407
     
    441446    scheduler->setCanBeginFrame(true);
    442447    scheduler->setVisible(true);
     448    scheduler->setCanDraw(true);
    443449
    444450    EXPECT_EQ(0, controllerPtr->numFramesPending());
Note: See TracChangeset for help on using the changeset viewer.