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