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

Unified Diff: cc/CCSchedulerStateMachine.cpp

Issue 10907075: Roll cc snapshot up to 127605 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months 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/CCSchedulerStateMachine.h ('k') | cc/CCSchedulerStateMachineTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/CCSchedulerStateMachine.cpp
diff --git a/cc/CCSchedulerStateMachine.cpp b/cc/CCSchedulerStateMachine.cpp
index 323a188ce6a9019b10fa0c7846c1debb7cdfca35..94f755c7bbb46ba7947d1477608e8f7d93395080 100644
--- a/cc/CCSchedulerStateMachine.cpp
+++ b/cc/CCSchedulerStateMachine.cpp
@@ -5,6 +5,8 @@
#include "config.h"
#include "CCSchedulerStateMachine.h"
+#include "TextStream.h"
+
namespace WebCore {
@@ -24,13 +26,38 @@ CCSchedulerStateMachine::CCSchedulerStateMachine()
, m_insideVSync(false)
, m_visible(false)
, m_canBeginFrame(false)
- , m_canDraw(true)
+ , m_canDraw(false)
, m_drawIfPossibleFailed(false)
, m_textureState(LAYER_TEXTURE_STATE_UNLOCKED)
, m_contextState(CONTEXT_ACTIVE)
{
}
+String CCSchedulerStateMachine::toString()
+{
+ TextStream ts;
+ ts << "m_commitState = " << m_commitState << "; ";
+ ts << "m_currentFrameNumber = " << m_currentFrameNumber << "; ";
+ ts << "m_lastFrameNumberWhereDrawWasCalled = " << m_lastFrameNumberWhereDrawWasCalled << "; ";
+ ts << "m_consecutiveFailedDraws = " << m_consecutiveFailedDraws << "; ";
+ ts << "m_maximumNumberOfFailedDrawsBeforeDrawIsForced = " << m_maximumNumberOfFailedDrawsBeforeDrawIsForced << "; ";
+ ts << "m_needsRedraw = " << m_needsRedraw << "; ";
+ ts << "m_needsForcedRedraw = " << m_needsForcedRedraw << "; ";
+ ts << "m_needsForcedRedrawAfterNextCommit = " << m_needsForcedRedrawAfterNextCommit << "; ";
+ ts << "m_needsCommit = " << m_needsCommit << "; ";
+ ts << "m_needsForcedCommit = " << m_needsForcedCommit << "; ";
+ ts << "m_mainThreadNeedsLayerTextures = " << m_mainThreadNeedsLayerTextures << "; ";
+ ts << "m_updateMoreResourcesPending = " << m_updateMoreResourcesPending << "; ";
+ ts << "m_insideVSync = " << m_insideVSync << "; ";
+ ts << "m_visible = " << m_visible << "; ";
+ ts << "m_canBeginFrame = " << m_canBeginFrame << "; ";
+ ts << "m_canDraw = " << m_canDraw << "; ";
+ ts << "m_drawIfPossibleFailed = " << m_drawIfPossibleFailed << "; ";
+ ts << "m_textureState = " << m_textureState << "; ";
+ ts << "m_contextState = " << m_contextState << "; ";
+ return ts.release();
+}
+
bool CCSchedulerStateMachine::hasDrawnThisFrame() const
{
return m_currentFrameNumber == m_lastFrameNumberWhereDrawWasCalled;
@@ -210,14 +237,18 @@ void CCSchedulerStateMachine::setMainThreadNeedsLayerTextures()
bool CCSchedulerStateMachine::vsyncCallbackNeeded() const
{
- if (!m_visible || m_contextState != CONTEXT_ACTIVE) {
- if (m_needsForcedRedraw || m_commitState == COMMIT_STATE_UPDATING_RESOURCES)
- return true;
+ // To prevent live-lock, we must always tick when updating resources.
+ if (m_updateMoreResourcesPending || m_commitState == COMMIT_STATE_UPDATING_RESOURCES)
+ return true;
+ // If we can't draw, don't tick until we are notified that we can draw again.
+ if (!m_canDraw)
return false;
- }
- return m_needsRedraw || m_needsForcedRedraw || m_commitState == COMMIT_STATE_UPDATING_RESOURCES;
+ if (m_needsForcedRedraw)
+ return true;
+
+ return m_needsRedraw && m_visible && m_contextState == CONTEXT_ACTIVE;
}
void CCSchedulerStateMachine::didEnterVSync()
« no previous file with comments | « cc/CCSchedulerStateMachine.h ('k') | cc/CCSchedulerStateMachineTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698