Changeset 127556 in webkit
- Timestamp:
- Sep 4, 2012 11:07:18 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r127555 r127556 1 2012-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 1 50 2012-09-04 Adam Barth <abarth@chromium.org> 2 51 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
r127081 r127556 169 169 bool CCLayerTreeHostImpl::canDraw() 170 170 { 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 171 175 if (!m_rootLayerImpl) { 172 176 TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw no root layer"); … … 531 535 m_contentsTexturesPurged = true; 532 536 m_client->setNeedsCommitOnImplThread(); 537 m_client->onCanDrawStateChanged(canDraw()); 533 538 } 534 539 … … 670 675 671 676 m_scrollingLayerIdFromPreviousTree = -1; 677 678 m_client->onCanDrawStateChanged(canDraw()); 672 679 } 673 680 … … 732 739 m_renderer->setVisible(m_visible); 733 740 741 m_client->onCanDrawStateChanged(canDraw()); 742 734 743 return m_renderer; 744 } 745 746 void CCLayerTreeHostImpl::resetContentsTexturesPurged() 747 { 748 m_contentsTexturesPurged = false; 749 m_client->onCanDrawStateChanged(canDraw()); 735 750 } 736 751 … … 747 762 if (m_renderer) 748 763 m_renderer->viewportChanged(); 764 765 m_client->onCanDrawStateChanged(canDraw()); 749 766 } 750 767 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
r126790 r127556 58 58 virtual void onSwapBuffersCompleteOnImplThread() = 0; 59 59 virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) = 0; 60 virtual void onCanDrawStateChanged(bool canDraw) = 0; 60 61 virtual void setNeedsRedrawOnImplThread() = 0; 61 62 virtual void setNeedsCommitOnImplThread() = 0; … … 161 162 162 163 bool contentsTexturesPurged() const { return m_contentsTexturesPurged; } 163 void resetContentsTexturesPurged() { m_contentsTexturesPurged = false; }164 void resetContentsTexturesPurged(); 164 165 size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBytes; } 165 166 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp
r127476 r127556 58 58 } 59 59 60 void 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 60 70 void CCScheduler::setNeedsCommit() 61 71 { … … 151 161 } 152 162 153 CCSchedulerStateMachine::Action CCScheduler::nextAction()154 {155 m_stateMachine.setCanDraw(m_client->canDraw());156 return m_stateMachine.nextAction();157 }158 159 163 void CCScheduler::processScheduledActions() 160 164 { 161 165 // 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) { 163 167 m_frameRateController->setActive(m_stateMachine.vsyncCallbackNeeded()); 164 168 return; … … 169 173 CCSchedulerStateMachine::Action action; 170 174 do { 171 action = nextAction();175 action = m_stateMachine.nextAction(); 172 176 m_stateMachine.updateState(action); 173 177 TRACE_EVENT1("cc", "CCScheduler::processScheduledActions()", "action", action); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.h
r127476 r127556 53 53 class CCSchedulerClient { 54 54 public: 55 virtual bool canDraw() = 0;56 55 virtual bool hasMoreResourceUpdates() const = 0; 57 56 … … 81 80 82 81 void setVisible(bool); 82 void setCanDraw(bool); 83 83 84 84 void setNeedsCommit(); … … 115 115 CCScheduler(CCSchedulerClient*, PassOwnPtr<CCFrameRateController>); 116 116 117 CCSchedulerStateMachine::Action nextAction();118 117 void processScheduledActions(); 119 118 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp
r126719 r127556 26 26 27 27 #include "CCSchedulerStateMachine.h" 28 #include "TextStream.h" 29 28 30 29 31 namespace WebCore { … … 45 47 , m_visible(false) 46 48 , m_canBeginFrame(false) 47 , m_canDraw( true)49 , m_canDraw(false) 48 50 , m_drawIfPossibleFailed(false) 49 51 , m_textureState(LAYER_TEXTURE_STATE_UNLOCKED) 50 52 , m_contextState(CONTEXT_ACTIVE) 51 53 { 54 } 55 56 String 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(); 52 79 } 53 80 … … 231 258 bool CCSchedulerStateMachine::vsyncCallbackNeeded() const 232 259 { 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; 241 272 } 242 273 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSchedulerStateMachine.h
r121076 r127556 27 27 28 28 #include <wtf/Noncopyable.h> 29 #include <wtf/text/WTFString.h> 29 30 30 31 namespace WebCore { … … 149 150 void setMaximumNumberOfFailedDrawsBeforeDrawIsForced(int); 150 151 152 String toString(); 153 151 154 protected: 152 155 bool shouldDrawForced() const; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h
r127317 r127556 70 70 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { ASSERT_NOT_REACHED(); } 71 71 virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE { } 72 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { } 72 73 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_layerTreeHost->scheduleComposite(); } 73 74 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_layerTreeHost->scheduleComposite(); } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
r127476 r127556 353 353 } 354 354 355 void CCThreadProxy::onCanDrawStateChanged(bool canDraw) 356 { 357 ASSERT(isImplThread()); 358 TRACE_EVENT1("cc", "CCThreadProxy::onCanDrawStateChanged", "canDraw", canDraw); 359 m_schedulerOnImplThread->setCanDraw(canDraw); 360 } 361 355 362 void CCThreadProxy::setNeedsCommitOnImplThread() 356 363 { … … 543 550 m_forcedCommitRequested = false; 544 551 545 if (!m_layerTreeHost->initializeRendererIfNeeded()) 546 return; 552 if (!m_layerTreeHost->initializeRendererIfNeeded()) { 553 TRACE_EVENT0("cc", "EarlyOut_InitializeFailed"); 554 return; 555 } 547 556 548 557 if (request->contentsTexturesWereDeleted) … … 594 603 595 604 if (!m_layerTreeHostImpl) { 605 TRACE_EVENT0("cc", "EarlyOut_NoLayerTree"); 596 606 completion->signal(); 597 607 return; … … 629 639 return false; 630 640 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();639 641 } 640 642 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h
r127099 r127556 79 79 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE; 80 80 virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE; 81 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE; 81 82 virtual void setNeedsRedrawOnImplThread() OVERRIDE; 82 83 virtual void setNeedsCommitOnImplThread() OVERRIDE; … … 84 85 85 86 // CCSchedulerClient implementation 86 virtual bool canDraw() OVERRIDE;87 87 virtual bool hasMoreResourceUpdates() const OVERRIDE; 88 88 89 virtual void scheduledActionBeginFrame() OVERRIDE; 89 90 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE; -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
r127340 r127556 71 71 public: 72 72 CCLayerTreeHostImplTest() 73 : m_didRequestCommit(false) 73 : m_onCanDrawStateChangedCalled(false) 74 , m_didRequestCommit(false) 74 75 , m_didRequestRedraw(false) 75 76 { … … 85 86 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } 86 87 virtual void onVSyncParametersChanged(double, double) OVERRIDE { } 88 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawStateChangedCalled = true; } 87 89 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = true; } 88 90 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; } … … 186 188 187 189 OwnPtr<CCLayerTreeHostImpl> m_hostImpl; 190 bool m_onCanDrawStateChangedCalled; 188 191 bool m_didRequestCommit; 189 192 bool m_didRequestRedraw; … … 195 198 virtual bool makeContextCurrent() { return false; } 196 199 }; 200 201 TEST_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 } 197 247 198 248 TEST_F(CCLayerTreeHostImplTest, scrollDeltaNoLayers) -
trunk/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp
r126719 r127556 137 137 { 138 138 CCSchedulerStateMachine state; 139 state.setCanDraw(true); 139 140 state.setNeedsForcedRedraw(); 140 141 EXPECT_FALSE(state.redrawPending()); … … 147 148 state.setCanBeginFrame(true); 148 149 state.setVisible(true); 150 state.setCanDraw(true); 149 151 state.setNeedsRedraw(); 150 152 EXPECT_TRUE(state.redrawPending()); … … 172 174 state.setCanBeginFrame(true); 173 175 state.setVisible(true); 176 state.setCanDraw(true); 174 177 state.setNeedsRedraw(); 175 178 EXPECT_TRUE(state.redrawPending()); … … 200 203 state.setCanBeginFrame(true); 201 204 state.setVisible(true); 205 state.setCanDraw(true); 202 206 203 207 // Start a commit. … … 240 244 state.setCanBeginFrame(true); 241 245 state.setVisible(true); 246 state.setCanDraw(true); 242 247 243 248 // Start a commit. … … 291 296 state.setCanBeginFrame(true); 292 297 state.setVisible(true); 298 state.setCanDraw(true); 293 299 state.setMaximumNumberOfFailedDrawsBeforeDrawIsForced(1); 294 300 … … 333 339 state.setCanBeginFrame(true); 334 340 state.setVisible(true); 341 state.setCanDraw(true); 335 342 336 343 // Start a draw. … … 362 369 CCSchedulerStateMachine state; 363 370 state.setVisible(true); 371 state.setCanDraw(true); 364 372 state.setNeedsRedraw(); 365 373 EXPECT_TRUE(state.vsyncCallbackNeeded()); … … 414 422 for (unsigned j = 0; j < 2; ++j) { 415 423 StateMachine state; 424 state.setCanDraw(true); 416 425 state.setCommitState(allCommitStates[i]); 417 426 bool forcedDraw = j; … … 526 535 } 527 536 537 TEST(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 528 559 TEST(CCSchedulerStateMachineTest, TestUpdates_NoRedraw_OneRoundOfUpdates) 529 560 { … … 533 564 state.setUpdateMoreResourcesPending(false); 534 565 state.setVisible(true); 566 state.setCanDraw(true); 535 567 536 568 // Verify we begin update, both for vsync and not vsync. … … 561 593 state.setUpdateMoreResourcesPending(false); 562 594 state.setVisible(true); 595 state.setCanDraw(true); 563 596 564 597 // Verify the update begins, both for vsync and not vsync. … … 600 633 { 601 634 StateMachine state; 635 state.setCanDraw(true); 602 636 state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_UPDATING_RESOURCES); 603 637 state.setNeedsRedraw(false); … … 617 651 state.setUpdateMoreResourcesPending(false); 618 652 state.setVisible(true); 653 state.setCanDraw(true); 619 654 EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES, state.nextAction()); 620 655 … … 664 699 state.setNeedsCommit(true); 665 700 state.setVisible(true); 701 state.setCanDraw(true); 666 702 667 703 // Begin the frame. … … 706 742 state.setCanBeginFrame(true); 707 743 state.setVisible(true); 744 state.setCanDraw(true); 708 745 709 746 // Start clean and set commit. … … 754 791 state.setCanBeginFrame(true); 755 792 state.setVisible(true); 793 state.setCanDraw(true); 756 794 757 795 // Start clean and set commit. … … 813 851 state.setCanBeginFrame(true); 814 852 state.setVisible(true); 853 state.setCanDraw(true); 815 854 816 855 // Start clean and set commit. … … 851 890 state.setCanBeginFrame(true); 852 891 state.setVisible(true); 892 state.setCanDraw(true); 853 893 854 894 state.didLoseContext(); … … 873 913 state.setCanBeginFrame(true); 874 914 state.setVisible(true); 915 state.setCanDraw(true); 875 916 876 917 state.didLoseContext(); … … 909 950 state.setCanBeginFrame(true); 910 951 state.setVisible(true); 952 state.setCanDraw(true); 911 953 912 954 // Get a commit in flight. … … 950 992 state.setCanBeginFrame(true); 951 993 state.setVisible(true); 994 state.setCanDraw(true); 952 995 953 996 // Get a commit in flight. … … 1000 1043 StateMachine state; 1001 1044 state.setVisible(true); 1045 state.setCanDraw(true); 1002 1046 1003 1047 // Cause a lost context lost. … … 1038 1082 StateMachine state; 1039 1083 state.setVisible(true); 1084 state.setCanDraw(true); 1040 1085 state.setNeedsCommit(true); 1041 1086 state.setNeedsForcedCommit(true); … … 1070 1115 state.setCanBeginFrame(true); 1071 1116 state.setVisible(true); 1117 state.setCanDraw(true); 1072 1118 state.setNeedsCommit(true); 1073 1119 state.setNeedsForcedCommit(true); -
trunk/Source/WebKit/chromium/tests/CCSchedulerTest.cpp
r127079 r127556 45 45 m_actions.clear(); 46 46 m_hasMoreResourceUpdates = false; 47 m_canDraw = true;48 47 m_drawWillHappen = true; 49 48 m_swapWillHappenIfDrawHappens = true; … … 52 51 53 52 void setHasMoreResourceUpdates(bool b) { m_hasMoreResourceUpdates = b; } 54 void setCanDraw(bool b) { m_canDraw = b; }55 53 56 54 int numDraws() const { return m_numDraws; } … … 66 64 } 67 65 68 virtual bool canDraw() OVERRIDE { return m_canDraw; }69 66 virtual bool hasMoreResourceUpdates() const OVERRIDE { return m_hasMoreResourceUpdates; } 67 70 68 virtual void scheduledActionBeginFrame() OVERRIDE { m_actions.push_back("scheduledActionBeginFrame"); } 71 69 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE … … 92 90 protected: 93 91 bool m_hasMoreResourceUpdates; 94 bool m_canDraw;95 92 bool m_drawWillHappen; 96 93 bool m_swapWillHappenIfDrawHappens; … … 106 103 scheduler->setCanBeginFrame(true); 107 104 scheduler->setVisible(true); 105 scheduler->setCanDraw(true); 108 106 109 107 // SetNeedsCommit should begin the frame. … … 140 138 scheduler->setCanBeginFrame(true); 141 139 scheduler->setVisible(true); 140 scheduler->setCanDraw(true); 142 141 143 142 // SetNedsCommit should begin the frame. … … 173 172 scheduler->setCanBeginFrame(true); 174 173 scheduler->setVisible(true); 174 scheduler->setCanDraw(true); 175 175 176 176 scheduler->setNeedsCommit(); … … 211 211 scheduler->setCanBeginFrame(true); 212 212 scheduler->setVisible(true); 213 scheduler->setCanDraw(true); 213 214 214 215 scheduler->setNeedsCommit(); … … 274 275 scheduler->setCanBeginFrame(true); 275 276 scheduler->setVisible(true); 277 scheduler->setCanDraw(true); 276 278 277 279 scheduler->setNeedsRedraw(); … … 300 302 scheduler->setCanBeginFrame(true); 301 303 scheduler->setVisible(true); 304 scheduler->setCanDraw(true); 302 305 client.setDrawWillHappen(false); 303 306 … … 372 375 scheduler->setCanBeginFrame(true); 373 376 scheduler->setVisible(true); 377 scheduler->setCanDraw(true); 374 378 375 379 scheduler->setNeedsRedraw(); … … 399 403 scheduler->setCanBeginFrame(true); 400 404 scheduler->setVisible(true); 405 scheduler->setCanDraw(true); 401 406 client.setDrawWillHappen(false); 402 407 … … 441 446 scheduler->setCanBeginFrame(true); 442 447 scheduler->setVisible(true); 448 scheduler->setCanDraw(true); 443 449 444 450 EXPECT_EQ(0, controllerPtr->numFramesPending());
Note: See TracChangeset
for help on using the changeset viewer.