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" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS || | 53 return m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS || |
54 m_commitState == COMMIT_STATE_READY_TO_COMMIT; | 54 m_commitState == COMMIT_STATE_READY_TO_COMMIT; |
55 } | 55 } |
56 | 56 |
57 bool redrawPending() const { return m_needsRedraw; } | 57 bool redrawPending() const { return m_needsRedraw; } |
58 | 58 |
59 enum Action { | 59 enum Action { |
60 ACTION_NONE, | 60 ACTION_NONE, |
61 ACTION_BEGIN_FRAME, | 61 ACTION_BEGIN_FRAME, |
62 ACTION_COMMIT, | 62 ACTION_COMMIT, |
63 ACTION_CHECK_FOR_NEW_TEXTURES, | 63 ACTION_CHECK_FOR_COMPLETED_TILE_UPLOADS, |
64 ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED, | 64 ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED, |
65 ACTION_DRAW_IF_POSSIBLE, | 65 ACTION_DRAW_IF_POSSIBLE, |
66 ACTION_DRAW_FORCED, | 66 ACTION_DRAW_FORCED, |
67 ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, | 67 ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, |
68 ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD, | 68 ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD, |
69 }; | 69 }; |
70 Action nextAction() const; | 70 Action nextAction() const; |
71 void updateState(Action); | 71 void updateState(Action); |
72 | 72 |
73 // Indicates whether the scheduler needs a vsync callback in order to make | 73 // Indicates whether the scheduler needs a vsync callback in order to make |
74 // progress. | 74 // progress. |
75 bool vsyncCallbackNeeded() const; | 75 bool vsyncCallbackNeeded() const; |
76 | 76 |
77 // Indicates that the system has entered and left a vsync callback. | 77 // Indicates that the system has entered and left a vsync callback. |
78 // The scheduler will not draw more than once in a given vsync callback. | 78 // The scheduler will not draw more than once in a given vsync callback. |
79 void didEnterVSync(); | 79 void didEnterVSync(); |
80 void didLeaveVSync(); | 80 void didLeaveVSync(); |
81 | 81 |
82 // Indicates whether the LayerTreeHostImpl is visible. | 82 // Indicates whether the LayerTreeHostImpl is visible. |
83 void setVisible(bool); | 83 void setVisible(bool); |
84 | 84 |
85 // Indicates that a redraw is required, either due to the impl tree changing | 85 // Indicates that a redraw is required, either due to the impl tree changing |
86 // or the screen being damaged and simply needing redisplay. | 86 // or the screen being damaged and simply needing redisplay. |
87 void setNeedsRedraw(); | 87 void setNeedsRedraw(); |
88 | 88 |
89 // As setNeedsRedraw(), but ensures the draw will definitely happen even if | 89 // As setNeedsRedraw(), but ensures the draw will definitely happen even if |
90 // we are not visible. | 90 // we are not visible. |
91 void setNeedsForcedRedraw(); | 91 void setNeedsForcedRedraw(); |
92 | 92 |
93 // Indicates that a redraw is required because we are currently rendererd | 93 // Indicates that a redraw is required because we are currently rendering |
94 // with a low resolution or checkerboarded tile. | 94 // with a low resolution or checkerboarded tile. |
95 void didSwapUseIncompleteTexture(); | 95 void didSwapUseIncompleteTile(); |
96 | 96 |
97 // Indicates whether ACTION_DRAW_IF_POSSIBLE drew to the screen or not. | 97 // Indicates whether ACTION_DRAW_IF_POSSIBLE drew to the screen or not. |
98 void didDrawIfPossibleCompleted(bool success); | 98 void didDrawIfPossibleCompleted(bool success); |
99 | 99 |
100 // Indicates that a new commit flow needs to be performed, either to pull | 100 // Indicates that a new commit flow needs to be performed, either to pull |
101 // updates from the main thread to the impl, or to push deltas from the impl | 101 // updates from the main thread to the impl, or to push deltas from the impl |
102 // thread to main. | 102 // thread to main. |
103 void setNeedsCommit(); | 103 void setNeedsCommit(); |
104 | 104 |
105 // As setNeedsCommit(), but ensures the beginFrame will definitely happen ev
en if | 105 // As setNeedsCommit(), but ensures the beginFrame will definitely happen ev
en if |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 std::string toString(); | 147 std::string toString(); |
148 | 148 |
149 protected: | 149 protected: |
150 bool shouldDrawForced() const; | 150 bool shouldDrawForced() const; |
151 bool drawSuspendedUntilCommit() const; | 151 bool drawSuspendedUntilCommit() const; |
152 bool scheduledToDraw() const; | 152 bool scheduledToDraw() const; |
153 bool shouldDraw() const; | 153 bool shouldDraw() const; |
154 bool shouldAttemptTreeActivation() const; | 154 bool shouldAttemptTreeActivation() const; |
155 bool shouldAcquireLayerTexturesForMainThread() const; | 155 bool shouldAcquireLayerTexturesForMainThread() const; |
156 bool shouldCheckForCompletedTextures() const; | 156 bool shouldCheckForCompletedTileUploads() const; |
157 bool hasDrawnThisFrame() const; | 157 bool hasDrawnThisFrame() const; |
158 bool hasAttemptedTreeActivationThisFrame() const; | 158 bool hasAttemptedTreeActivationThisFrame() const; |
159 bool hasCheckedForCompletedTexturesThisFrame() const; | 159 bool hasCheckedForCompletedTileUploadsThisFrame() const; |
160 | 160 |
161 const SchedulerSettings m_settings; | 161 const SchedulerSettings m_settings; |
162 | 162 |
163 CommitState m_commitState; | 163 CommitState m_commitState; |
164 | 164 |
165 int m_currentFrameNumber; | 165 int m_currentFrameNumber; |
166 int m_lastFrameNumberWhereDrawWasCalled; | 166 int m_lastFrameNumberWhereDrawWasCalled; |
167 int m_lastFrameNumberWhereTreeActivationAttempted; | 167 int m_lastFrameNumberWhereTreeActivationAttempted; |
168 int m_lastFrameNumberWhereCheckForCompletedTexturesCalled; | 168 int m_lastFrameNumberWhereCheckForCompletedTileUploadsCalled; |
169 int m_consecutiveFailedDraws; | 169 int m_consecutiveFailedDraws; |
170 int m_maximumNumberOfFailedDrawsBeforeDrawIsForced; | 170 int m_maximumNumberOfFailedDrawsBeforeDrawIsForced; |
171 bool m_needsRedraw; | 171 bool m_needsRedraw; |
172 bool m_swapUsedIncompleteTexture; | 172 bool m_swapUsedIncompleteTile; |
173 bool m_needsForcedRedraw; | 173 bool m_needsForcedRedraw; |
174 bool m_needsForcedRedrawAfterNextCommit; | 174 bool m_needsForcedRedrawAfterNextCommit; |
175 bool m_needsCommit; | 175 bool m_needsCommit; |
176 bool m_needsForcedCommit; | 176 bool m_needsForcedCommit; |
177 bool m_expectImmediateBeginFrame; | 177 bool m_expectImmediateBeginFrame; |
178 bool m_mainThreadNeedsLayerTextures; | 178 bool m_mainThreadNeedsLayerTextures; |
179 bool m_insideVSync; | 179 bool m_insideVSync; |
180 bool m_visible; | 180 bool m_visible; |
181 bool m_canBeginFrame; | 181 bool m_canBeginFrame; |
182 bool m_canDraw; | 182 bool m_canDraw; |
183 bool m_hasPendingTree; | 183 bool m_hasPendingTree; |
184 bool m_drawIfPossibleFailed; | 184 bool m_drawIfPossibleFailed; |
185 TextureState m_textureState; | 185 TextureState m_textureState; |
186 OutputSurfaceState m_outputSurfaceState; | 186 OutputSurfaceState m_outputSurfaceState; |
187 | 187 |
188 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 188 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
189 }; | 189 }; |
190 | 190 |
191 } | 191 } |
192 | 192 |
193 #endif // CC_SCHEDULER_STATE_MACHINE_H_ | 193 #endif // CC_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |