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 #ifndef CC_SCHEDULER_STATE_MACHINE_H_ | 5 #ifndef CC_SCHEDULER_STATE_MACHINE_H_ |
6 #define CC_SCHEDULER_STATE_MACHINE_H_ | 6 #define CC_SCHEDULER_STATE_MACHINE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "cc/cc_export.h" | 11 #include "cc/cc_export.h" |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 | 14 |
15 // The SchedulerStateMachine decides how to coordinate main thread activites | 15 // The SchedulerStateMachine decides how to coordinate main thread activites |
16 // like painting/running javascript with rendering and input activities on the | 16 // like painting/running javascript with rendering and input activities on the |
17 // impl thread. | 17 // impl thread. |
18 // | 18 // |
19 // The state machine tracks internal state but is also influenced by external st
ate. | 19 // The state machine tracks internal state but is also influenced by external st
ate. |
20 // Internal state includes things like whether a frame has been requested, while | 20 // Internal state includes things like whether a frame has been requested, while |
21 // external state includes things like the current time being near to the vblank
time. | 21 // external state includes things like the current time being near to the vblank
time. |
22 // | 22 // |
23 // The scheduler seperates "what to do next" from the updating of its internal s
tate to | 23 // The scheduler seperates "what to do next" from the updating of its internal s
tate to |
24 // make testing cleaner. | 24 // make testing cleaner. |
25 class CC_EXPORT SchedulerStateMachine { | 25 class CC_EXPORT SchedulerStateMachine { |
26 public: | 26 public: |
27 SchedulerStateMachine(); | 27 SchedulerStateMachine(bool implSidePaintingEnabled); |
28 | 28 |
29 enum CommitState { | 29 enum CommitState { |
30 COMMIT_STATE_IDLE, | 30 COMMIT_STATE_IDLE, |
31 COMMIT_STATE_FRAME_IN_PROGRESS, | 31 COMMIT_STATE_FRAME_IN_PROGRESS, |
32 COMMIT_STATE_READY_TO_COMMIT, | 32 COMMIT_STATE_READY_TO_COMMIT, |
33 COMMIT_STATE_WAITING_FOR_FIRST_DRAW, | 33 COMMIT_STATE_WAITING_FOR_FIRST_DRAW, |
34 COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW, | 34 COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW, |
35 }; | 35 }; |
36 | 36 |
37 enum TextureState { | 37 enum TextureState { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 protected: | 142 protected: |
143 bool shouldDrawForced() const; | 143 bool shouldDrawForced() const; |
144 bool drawSuspendedUntilCommit() const; | 144 bool drawSuspendedUntilCommit() const; |
145 bool scheduledToDraw() const; | 145 bool scheduledToDraw() const; |
146 bool shouldDraw() const; | 146 bool shouldDraw() const; |
147 bool shouldAcquireLayerTexturesForMainThread() const; | 147 bool shouldAcquireLayerTexturesForMainThread() const; |
148 bool hasDrawnThisFrame() const; | 148 bool hasDrawnThisFrame() const; |
149 bool hasAttemptedTreeActivationThisFrame() const; | 149 bool hasAttemptedTreeActivationThisFrame() const; |
150 | 150 |
| 151 bool m_implSidePaintingEnabled; |
| 152 |
151 CommitState m_commitState; | 153 CommitState m_commitState; |
152 | 154 |
153 int m_currentFrameNumber; | 155 int m_currentFrameNumber; |
154 int m_lastFrameNumberWhereDrawWasCalled; | 156 int m_lastFrameNumberWhereDrawWasCalled; |
155 int m_lastFrameNumberWhereTreeActivationAttempted; | 157 int m_lastFrameNumberWhereTreeActivationAttempted; |
156 int m_consecutiveFailedDraws; | 158 int m_consecutiveFailedDraws; |
157 int m_maximumNumberOfFailedDrawsBeforeDrawIsForced; | 159 int m_maximumNumberOfFailedDrawsBeforeDrawIsForced; |
158 bool m_needsRedraw; | 160 bool m_needsRedraw; |
159 bool m_needsForcedRedraw; | 161 bool m_needsForcedRedraw; |
160 bool m_needsForcedRedrawAfterNextCommit; | 162 bool m_needsForcedRedrawAfterNextCommit; |
161 bool m_needsCommit; | 163 bool m_needsCommit; |
162 bool m_needsForcedCommit; | 164 bool m_needsForcedCommit; |
163 bool m_expectImmediateBeginFrame; | 165 bool m_expectImmediateBeginFrame; |
164 bool m_mainThreadNeedsLayerTextures; | 166 bool m_mainThreadNeedsLayerTextures; |
165 bool m_insideVSync; | 167 bool m_insideVSync; |
166 bool m_visible; | 168 bool m_visible; |
167 bool m_canBeginFrame; | 169 bool m_canBeginFrame; |
168 bool m_canDraw; | 170 bool m_canDraw; |
169 bool m_hasPendingTree; | 171 bool m_hasPendingTree; |
170 bool m_drawIfPossibleFailed; | 172 bool m_drawIfPossibleFailed; |
171 TextureState m_textureState; | 173 TextureState m_textureState; |
172 OutputSurfaceState m_outputSurfaceState; | 174 OutputSurfaceState m_outputSurfaceState; |
173 | 175 |
174 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 176 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
175 }; | 177 }; |
176 | 178 |
177 } | 179 } |
178 | 180 |
179 #endif // CC_SCHEDULER_STATE_MACHINE_H_ | 181 #endif // CC_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |