Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(957)

Unified Diff: cc/scheduler_state_machine.cc

Issue 11362054: Use message passing for BeginFrameAndCommitState and clean up forced commit logic (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix windows signed/unsigned warning Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/scheduler_state_machine.h ('k') | cc/scheduler_state_machine_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler_state_machine.cc
diff --git a/cc/scheduler_state_machine.cc b/cc/scheduler_state_machine.cc
index d0a3577074748461f950e92409b293fc7b8fcbee..f70d1ad9e76f499df4ad0ee3114272c7cb8df76a 100644
--- a/cc/scheduler_state_machine.cc
+++ b/cc/scheduler_state_machine.cc
@@ -21,6 +21,7 @@ SchedulerStateMachine::SchedulerStateMachine()
, m_needsForcedRedrawAfterNextCommit(false)
, m_needsCommit(false)
, m_needsForcedCommit(false)
+ , m_expectImmediateBeginFrame(false)
, m_mainThreadNeedsLayerTextures(false)
, m_insideVSync(false)
, m_visible(false)
@@ -45,6 +46,7 @@ std::string SchedulerStateMachine::toString()
base::StringAppendF(&str, "m_needsForcedRedrawAfterNextCommit = %d; ", m_needsForcedRedrawAfterNextCommit);
base::StringAppendF(&str, "m_needsCommit = %d; ", m_needsCommit);
base::StringAppendF(&str, "m_needsForcedCommit = %d; ", m_needsForcedCommit);
+ base::StringAppendF(&str, "m_expectImmediateBeginFrame = %d; ", m_expectImmediateBeginFrame);
base::StringAppendF(&str, "m_mainThreadNeedsLayerTextures = %d; ", m_mainThreadNeedsLayerTextures);
base::StringAppendF(&str, "m_insideVSync = %d; ", m_insideVSync);
base::StringAppendF(&str, "m_visible = %d; ", m_visible);
@@ -189,8 +191,13 @@ void SchedulerStateMachine::updateState(Action action)
m_drawIfPossibleFailed = false;
if (m_insideVSync)
m_lastFrameNumberWhereDrawWasCalled = m_currentFrameNumber;
- if (m_commitState == COMMIT_STATE_WAITING_FOR_FIRST_DRAW)
- m_commitState = COMMIT_STATE_IDLE;
+ if (m_commitState == COMMIT_STATE_WAITING_FOR_FIRST_DRAW) {
+ if (m_expectImmediateBeginFrame) {
+ m_commitState = COMMIT_STATE_FRAME_IN_PROGRESS;
+ m_expectImmediateBeginFrame = false;
+ } else
+ m_commitState = COMMIT_STATE_IDLE;
+ }
if (m_textureState == LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD)
m_textureState = LAYER_TEXTURE_STATE_UNLOCKED;
return;
@@ -280,19 +287,25 @@ void SchedulerStateMachine::setNeedsCommit()
void SchedulerStateMachine::setNeedsForcedCommit()
{
m_needsForcedCommit = true;
+ m_expectImmediateBeginFrame = true;
}
void SchedulerStateMachine::beginFrameComplete()
{
- DCHECK(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS);
+ DCHECK(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS ||
+ (m_expectImmediateBeginFrame && m_commitState != COMMIT_STATE_IDLE)) << toString();
m_commitState = COMMIT_STATE_READY_TO_COMMIT;
}
void SchedulerStateMachine::beginFrameAborted()
{
DCHECK(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS);
- m_commitState = COMMIT_STATE_IDLE;
- setNeedsCommit();
+ if (m_expectImmediateBeginFrame)
+ m_expectImmediateBeginFrame = false;
+ else {
+ m_commitState = COMMIT_STATE_IDLE;
+ setNeedsCommit();
+ }
}
void SchedulerStateMachine::didLoseContext()
« no previous file with comments | « cc/scheduler_state_machine.h ('k') | cc/scheduler_state_machine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698