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_ACTIVATE_PENDING_TREE_IF_NEEDED, | 64 ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED, |
64 ACTION_DRAW_IF_POSSIBLE, | 65 ACTION_DRAW_IF_POSSIBLE, |
65 ACTION_DRAW_FORCED, | 66 ACTION_DRAW_FORCED, |
66 ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, | 67 ACTION_BEGIN_OUTPUT_SURFACE_RECREATION, |
67 ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD, | 68 ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD, |
68 }; | 69 }; |
69 Action nextAction() const; | 70 Action nextAction() const; |
70 void updateState(Action); | 71 void updateState(Action); |
71 | 72 |
72 // 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 |
73 // progress. | 74 // progress. |
74 bool vsyncCallbackNeeded() const; | 75 bool vsyncCallbackNeeded() const; |
75 | 76 |
76 // Indicates that the system has entered and left a vsync callback. | 77 // Indicates that the system has entered and left a vsync callback. |
77 // 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. |
78 void didEnterVSync(); | 79 void didEnterVSync(); |
79 void didLeaveVSync(); | 80 void didLeaveVSync(); |
80 | 81 |
81 // Indicates whether the LayerTreeHostImpl is visible. | 82 // Indicates whether the LayerTreeHostImpl is visible. |
82 void setVisible(bool); | 83 void setVisible(bool); |
83 | 84 |
84 // 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 |
85 // or the screen being damaged and simply needing redisplay. | 86 // or the screen being damaged and simply needing redisplay. |
86 void setNeedsRedraw(); | 87 void setNeedsRedraw(); |
87 | 88 |
88 // As setNeedsRedraw(), but ensures the draw will definitely happen even if | 89 // As setNeedsRedraw(), but ensures the draw will definitely happen even if |
89 // we are not visible. | 90 // we are not visible. |
90 void setNeedsForcedRedraw(); | 91 void setNeedsForcedRedraw(); |
91 | 92 |
| 93 // Indicates that a redraw is required because we are currently rendererd |
| 94 // with a low resolution or checkerboarded tile. |
| 95 void didSwapUseIncompleteTexture(); |
| 96 |
92 // 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. |
93 void didDrawIfPossibleCompleted(bool success); | 98 void didDrawIfPossibleCompleted(bool success); |
94 | 99 |
95 // 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 |
96 // 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 |
97 // thread to main. | 102 // thread to main. |
98 void setNeedsCommit(); | 103 void setNeedsCommit(); |
99 | 104 |
100 // 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 |
101 // we are not visible. | 106 // we are not visible. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 146 |
142 std::string toString(); | 147 std::string toString(); |
143 | 148 |
144 protected: | 149 protected: |
145 bool shouldDrawForced() const; | 150 bool shouldDrawForced() const; |
146 bool drawSuspendedUntilCommit() const; | 151 bool drawSuspendedUntilCommit() const; |
147 bool scheduledToDraw() const; | 152 bool scheduledToDraw() const; |
148 bool shouldDraw() const; | 153 bool shouldDraw() const; |
149 bool shouldAttemptTreeActivation() const; | 154 bool shouldAttemptTreeActivation() const; |
150 bool shouldAcquireLayerTexturesForMainThread() const; | 155 bool shouldAcquireLayerTexturesForMainThread() const; |
| 156 bool shouldCheckForNewTextures() const; |
151 bool hasDrawnThisFrame() const; | 157 bool hasDrawnThisFrame() const; |
152 bool hasAttemptedTreeActivationThisFrame() const; | 158 bool hasAttemptedTreeActivationThisFrame() const; |
| 159 bool hasCheckedForNewTexturesThisFrame() const; |
153 | 160 |
154 const SchedulerSettings m_settings; | 161 const SchedulerSettings m_settings; |
155 | 162 |
156 CommitState m_commitState; | 163 CommitState m_commitState; |
157 | 164 |
158 int m_currentFrameNumber; | 165 int m_currentFrameNumber; |
159 int m_lastFrameNumberWhereDrawWasCalled; | 166 int m_lastFrameNumberWhereDrawWasCalled; |
160 int m_lastFrameNumberWhereTreeActivationAttempted; | 167 int m_lastFrameNumberWhereTreeActivationAttempted; |
| 168 int m_lastFrameNumberWhereCheckForNewTexturesCalled; |
161 int m_consecutiveFailedDraws; | 169 int m_consecutiveFailedDraws; |
162 int m_maximumNumberOfFailedDrawsBeforeDrawIsForced; | 170 int m_maximumNumberOfFailedDrawsBeforeDrawIsForced; |
163 bool m_needsRedraw; | 171 bool m_needsRedraw; |
| 172 bool m_swapUsedIncompleteTexture; |
164 bool m_needsForcedRedraw; | 173 bool m_needsForcedRedraw; |
165 bool m_needsForcedRedrawAfterNextCommit; | 174 bool m_needsForcedRedrawAfterNextCommit; |
166 bool m_needsCommit; | 175 bool m_needsCommit; |
167 bool m_needsForcedCommit; | 176 bool m_needsForcedCommit; |
168 bool m_expectImmediateBeginFrame; | 177 bool m_expectImmediateBeginFrame; |
169 bool m_mainThreadNeedsLayerTextures; | 178 bool m_mainThreadNeedsLayerTextures; |
170 bool m_insideVSync; | 179 bool m_insideVSync; |
171 bool m_visible; | 180 bool m_visible; |
172 bool m_canBeginFrame; | 181 bool m_canBeginFrame; |
173 bool m_canDraw; | 182 bool m_canDraw; |
174 bool m_hasPendingTree; | 183 bool m_hasPendingTree; |
175 bool m_drawIfPossibleFailed; | 184 bool m_drawIfPossibleFailed; |
176 TextureState m_textureState; | 185 TextureState m_textureState; |
177 OutputSurfaceState m_outputSurfaceState; | 186 OutputSurfaceState m_outputSurfaceState; |
178 | 187 |
179 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 188 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
180 }; | 189 }; |
181 | 190 |
182 } | 191 } |
183 | 192 |
184 #endif // CC_SCHEDULER_STATE_MACHINE_H_ | 193 #endif // CC_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |