Index: cc/CCScheduler.cpp |
diff --git a/cc/CCScheduler.cpp b/cc/CCScheduler.cpp |
index 1840b4a1dbaeb0bee461c87058d9ec3c697a4485..457cf05607a8f495cdea451a60664d3239e5795d 100644 |
--- a/cc/CCScheduler.cpp |
+++ b/cc/CCScheduler.cpp |
@@ -37,6 +37,16 @@ void CCScheduler::setVisible(bool visible) |
processScheduledActions(); |
} |
+void CCScheduler::setCanDraw(bool canDraw) |
+{ |
+ m_stateMachine.setCanDraw(canDraw); |
+ |
+ // Defer processScheduleActions so we don't recurse and commit/draw |
+ // multiple frames. We can call processScheduledActions directly |
+ // once it is no longer re-entrant. |
+ m_frameRateController->setActive(m_stateMachine.vsyncCallbackNeeded()); |
+} |
+ |
void CCScheduler::setNeedsCommit() |
{ |
m_stateMachine.setNeedsCommit(); |
@@ -86,6 +96,11 @@ void CCScheduler::setMaxFramesPending(int maxFramesPending) |
m_frameRateController->setMaxFramesPending(maxFramesPending); |
} |
+void CCScheduler::setSwapBuffersCompleteSupported(bool supported) |
+{ |
+ m_frameRateController->setSwapBuffersCompleteSupported(supported); |
+} |
+ |
void CCScheduler::didSwapBuffersComplete() |
{ |
TRACE_EVENT0("cc", "CCScheduler::didSwapBuffersComplete"); |
@@ -125,16 +140,10 @@ void CCScheduler::vsyncTick() |
m_stateMachine.didLeaveVSync(); |
} |
-CCSchedulerStateMachine::Action CCScheduler::nextAction() |
-{ |
- m_stateMachine.setCanDraw(m_client->canDraw()); |
- return m_stateMachine.nextAction(); |
-} |
- |
void CCScheduler::processScheduledActions() |
{ |
// Early out so we don't spam TRACE_EVENTS with useless processScheduledActions. |
- if (nextAction() == CCSchedulerStateMachine::ACTION_NONE) { |
+ if (m_stateMachine.nextAction() == CCSchedulerStateMachine::ACTION_NONE) { |
m_frameRateController->setActive(m_stateMachine.vsyncCallbackNeeded()); |
return; |
} |
@@ -143,7 +152,7 @@ void CCScheduler::processScheduledActions() |
// setNeedsCommit. Proceeed with caution. |
CCSchedulerStateMachine::Action action; |
do { |
- action = nextAction(); |
+ action = m_stateMachine.nextAction(); |
m_stateMachine.updateState(action); |
TRACE_EVENT1("cc", "CCScheduler::processScheduledActions()", "action", action); |