OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/scheduler_state_machine.h" | 7 #include "cc/scheduler_state_machine.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| 11 #include "cc/settings.h" |
11 | 12 |
12 namespace cc { | 13 namespace cc { |
13 | 14 |
14 SchedulerStateMachine::SchedulerStateMachine() | 15 SchedulerStateMachine::SchedulerStateMachine() |
15 : m_commitState(COMMIT_STATE_IDLE) | 16 : m_commitState(COMMIT_STATE_IDLE) |
16 , m_currentFrameNumber(0) | 17 , m_currentFrameNumber(0) |
17 , m_lastFrameNumberWhereDrawWasCalled(-1) | 18 , m_lastFrameNumberWhereDrawWasCalled(-1) |
18 , m_consecutiveFailedDraws(0) | 19 , m_consecutiveFailedDraws(0) |
19 , m_maximumNumberOfFailedDrawsBeforeDrawIsForced(3) | 20 , m_maximumNumberOfFailedDrawsBeforeDrawIsForced(3) |
20 , m_needsRedraw(false) | 21 , m_needsRedraw(false) |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 m_needsForcedRedraw = true; | 257 m_needsForcedRedraw = true; |
257 } | 258 } |
258 | 259 |
259 void SchedulerStateMachine::didDrawIfPossibleCompleted(bool success) | 260 void SchedulerStateMachine::didDrawIfPossibleCompleted(bool success) |
260 { | 261 { |
261 m_drawIfPossibleFailed = !success; | 262 m_drawIfPossibleFailed = !success; |
262 if (m_drawIfPossibleFailed) { | 263 if (m_drawIfPossibleFailed) { |
263 m_needsRedraw = true; | 264 m_needsRedraw = true; |
264 m_needsCommit = true; | 265 m_needsCommit = true; |
265 m_consecutiveFailedDraws++; | 266 m_consecutiveFailedDraws++; |
266 if (m_consecutiveFailedDraws >= m_maximumNumberOfFailedDrawsBeforeDrawIs
Forced) { | 267 if (!Settings::jankInsteadOfCheckerboard() && m_consecutiveFailedDraws >
= m_maximumNumberOfFailedDrawsBeforeDrawIsForced) { |
267 m_consecutiveFailedDraws = 0; | 268 m_consecutiveFailedDraws = 0; |
268 // We need to force a draw, but it doesn't make sense to do this unt
il | 269 // We need to force a draw, but it doesn't make sense to do this unt
il |
269 // we've committed and have new textures. | 270 // we've committed and have new textures. |
270 m_needsForcedRedrawAfterNextCommit = true; | 271 m_needsForcedRedrawAfterNextCommit = true; |
271 } | 272 } |
272 } else | 273 } else |
273 m_consecutiveFailedDraws = 0; | 274 m_consecutiveFailedDraws = 0; |
274 } | 275 } |
275 | 276 |
276 void SchedulerStateMachine::setNeedsCommit() | 277 void SchedulerStateMachine::setNeedsCommit() |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 m_contextState = CONTEXT_ACTIVE; | 310 m_contextState = CONTEXT_ACTIVE; |
310 setNeedsCommit(); | 311 setNeedsCommit(); |
311 } | 312 } |
312 | 313 |
313 void SchedulerStateMachine::setMaximumNumberOfFailedDrawsBeforeDrawIsForced(int
numDraws) | 314 void SchedulerStateMachine::setMaximumNumberOfFailedDrawsBeforeDrawIsForced(int
numDraws) |
314 { | 315 { |
315 m_maximumNumberOfFailedDrawsBeforeDrawIsForced = numDraws; | 316 m_maximumNumberOfFailedDrawsBeforeDrawIsForced = numDraws; |
316 } | 317 } |
317 | 318 |
318 } | 319 } |
OLD | NEW |