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 "cc/scheduler_state_machine.h" | 5 #include "cc/scheduler_state_machine.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
11 | 11 |
12 SchedulerStateMachine::SchedulerStateMachine() | 12 SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) |
13 : m_commitState(COMMIT_STATE_IDLE) | 13 : m_settings(settings) |
| 14 , m_commitState(COMMIT_STATE_IDLE) |
14 , m_currentFrameNumber(0) | 15 , m_currentFrameNumber(0) |
15 , m_lastFrameNumberWhereDrawWasCalled(-1) | 16 , m_lastFrameNumberWhereDrawWasCalled(-1) |
16 , m_lastFrameNumberWhereTreeActivationAttempted(-1) | 17 , m_lastFrameNumberWhereTreeActivationAttempted(-1) |
17 , m_consecutiveFailedDraws(0) | 18 , m_consecutiveFailedDraws(0) |
18 , m_maximumNumberOfFailedDrawsBeforeDrawIsForced(3) | 19 , m_maximumNumberOfFailedDrawsBeforeDrawIsForced(3) |
19 , m_needsRedraw(false) | 20 , m_needsRedraw(false) |
20 , m_needsForcedRedraw(false) | 21 , m_needsForcedRedraw(false) |
21 , m_needsForcedRedrawAfterNextCommit(false) | 22 , m_needsForcedRedrawAfterNextCommit(false) |
22 , m_needsCommit(false) | 23 , m_needsCommit(false) |
23 , m_needsForcedCommit(false) | 24 , m_needsForcedCommit(false) |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 m_commitState = COMMIT_STATE_FRAME_IN_PROGRESS; | 203 m_commitState = COMMIT_STATE_FRAME_IN_PROGRESS; |
203 m_needsCommit = false; | 204 m_needsCommit = false; |
204 m_needsForcedCommit = false; | 205 m_needsForcedCommit = false; |
205 return; | 206 return; |
206 | 207 |
207 case ACTION_COMMIT: | 208 case ACTION_COMMIT: |
208 if (m_expectImmediateBeginFrame) | 209 if (m_expectImmediateBeginFrame) |
209 m_commitState = COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW; | 210 m_commitState = COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW; |
210 else | 211 else |
211 m_commitState = COMMIT_STATE_WAITING_FOR_FIRST_DRAW; | 212 m_commitState = COMMIT_STATE_WAITING_FOR_FIRST_DRAW; |
212 m_needsRedraw = true; | 213 // When impl-side painting, we draw on activation instead of on commit. |
| 214 if (!m_settings.implSidePainting) |
| 215 m_needsRedraw = true; |
213 if (m_drawIfPossibleFailed) | 216 if (m_drawIfPossibleFailed) |
214 m_lastFrameNumberWhereDrawWasCalled = -1; | 217 m_lastFrameNumberWhereDrawWasCalled = -1; |
215 | 218 |
216 if (m_needsForcedRedrawAfterNextCommit) { | 219 if (m_needsForcedRedrawAfterNextCommit) { |
217 m_needsForcedRedrawAfterNextCommit = false; | 220 m_needsForcedRedrawAfterNextCommit = false; |
218 m_needsForcedRedraw = true; | 221 m_needsForcedRedraw = true; |
219 } | 222 } |
220 | 223 |
221 m_textureState = LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD; | 224 m_textureState = LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD; |
222 return; | 225 return; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 m_outputSurfaceState = OUTPUT_SURFACE_ACTIVE; | 375 m_outputSurfaceState = OUTPUT_SURFACE_ACTIVE; |
373 setNeedsCommit(); | 376 setNeedsCommit(); |
374 } | 377 } |
375 | 378 |
376 void SchedulerStateMachine::setMaximumNumberOfFailedDrawsBeforeDrawIsForced(int
numDraws) | 379 void SchedulerStateMachine::setMaximumNumberOfFailedDrawsBeforeDrawIsForced(int
numDraws) |
377 { | 380 { |
378 m_maximumNumberOfFailedDrawsBeforeDrawIsForced = numDraws; | 381 m_maximumNumberOfFailedDrawsBeforeDrawIsForced = numDraws; |
379 } | 382 } |
380 | 383 |
381 } // namespace cc | 384 } // namespace cc |
OLD | NEW |