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_SCHEDULER_STATE_MACHINE_H_ | 5 #ifndef CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
6 #define CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 6 #define CC_SCHEDULER_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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 Action NextAction() const; | 72 Action NextAction() const; |
73 void UpdateState(Action action); | 73 void UpdateState(Action action); |
74 | 74 |
75 // Indicates whether the main thread needs a begin frame callback in order to | 75 // Indicates whether the main thread needs a begin frame callback in order to |
76 // make progress. | 76 // make progress. |
77 bool BeginFrameNeededToDrawByImplThread() const; | 77 bool BeginFrameNeededToDrawByImplThread() const; |
78 bool ProactiveBeginFrameWantedByImplThread() const; | 78 bool ProactiveBeginFrameWantedByImplThread() const; |
79 | 79 |
80 // Indicates that the system has entered and left a BeginFrame callback. | 80 // Indicates that the system has entered and left a BeginFrame callback. |
81 // The scheduler will not draw more than once in a given BeginFrame | 81 // The scheduler will not draw more than once in a given BeginFrame |
82 // callback. | 82 // callback nor send more than one BeginFrame message. |
83 void DidEnterBeginFrame(const BeginFrameArgs& args); | 83 void DidEnterBeginFrame(const BeginFrameArgs& args); |
84 void DidLeaveBeginFrame(); | 84 void DidLeaveBeginFrame(); |
85 bool inside_begin_frame() const { return inside_begin_frame_; } | 85 bool inside_begin_frame() const { return inside_begin_frame_; } |
86 | 86 |
87 // Indicates whether the LayerTreeHostImpl is visible. | 87 // Indicates whether the LayerTreeHostImpl is visible. |
88 void SetVisible(bool visible); | 88 void SetVisible(bool visible); |
89 | 89 |
90 // Indicates that a redraw is required, either due to the impl tree changing | 90 // Indicates that a redraw is required, either due to the impl tree changing |
91 // or the screen being damaged and simply needing redisplay. | 91 // or the screen being damaged and simply needing redisplay. |
92 void SetNeedsRedraw(); | 92 void SetNeedsRedraw(); |
(...skipping 20 matching lines...) Expand all Loading... |
113 // begin frame to finish. | 113 // begin frame to finish. |
114 void SetNeedsForcedCommit(); | 114 void SetNeedsForcedCommit(); |
115 | 115 |
116 // Call this only in response to receiving an | 116 // Call this only in response to receiving an |
117 // ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD from NextAction. | 117 // ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD from NextAction. |
118 // Indicates that all painting is complete. | 118 // Indicates that all painting is complete. |
119 void FinishCommit(); | 119 void FinishCommit(); |
120 | 120 |
121 // Call this only in response to receiving an | 121 // Call this only in response to receiving an |
122 // ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD from NextAction if the client | 122 // ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD from NextAction if the client |
123 // rejects the begin frame message. | 123 // rejects the begin frame message. If did_handle is false, then |
124 void BeginFrameAbortedByMainThread(); | 124 // another commit will be retried soon. |
| 125 void BeginFrameAbortedByMainThread(bool did_handle); |
125 | 126 |
126 // Request exclusive access to the textures that back single buffered | 127 // Request exclusive access to the textures that back single buffered |
127 // layers on behalf of the main thread. Upon acquisition, | 128 // layers on behalf of the main thread. Upon acquisition, |
128 // ACTION_DRAW_IF_POSSIBLE will not draw until the main thread releases the | 129 // ACTION_DRAW_IF_POSSIBLE will not draw until the main thread releases the |
129 // textures to the impl thread by committing the layers. | 130 // textures to the impl thread by committing the layers. |
130 void SetMainThreadNeedsLayerTextures(); | 131 void SetMainThreadNeedsLayerTextures(); |
131 | 132 |
132 // Set that we can create the first OutputSurface and start the scheduler. | 133 // Set that we can create the first OutputSurface and start the scheduler. |
133 void SetCanStart() { can_start_ = true; } | 134 void SetCanStart() { can_start_ = true; } |
134 | 135 |
(...skipping 26 matching lines...) Expand all Loading... |
161 protected: | 162 protected: |
162 bool ShouldDrawForced() const; | 163 bool ShouldDrawForced() const; |
163 bool ScheduledToDraw() const; | 164 bool ScheduledToDraw() const; |
164 bool ShouldDraw() const; | 165 bool ShouldDraw() const; |
165 bool ShouldAttemptTreeActivation() const; | 166 bool ShouldAttemptTreeActivation() const; |
166 bool ShouldAcquireLayerTexturesForMainThread() const; | 167 bool ShouldAcquireLayerTexturesForMainThread() const; |
167 bool ShouldUpdateVisibleTiles() const; | 168 bool ShouldUpdateVisibleTiles() const; |
168 bool HasDrawnThisFrame() const; | 169 bool HasDrawnThisFrame() const; |
169 bool HasAttemptedTreeActivationThisFrame() const; | 170 bool HasAttemptedTreeActivationThisFrame() const; |
170 bool HasUpdatedVisibleTilesThisFrame() const; | 171 bool HasUpdatedVisibleTilesThisFrame() const; |
| 172 void SetPostCommitFlags(); |
171 | 173 |
172 const SchedulerSettings settings_; | 174 const SchedulerSettings settings_; |
173 | 175 |
174 CommitState commit_state_; | 176 CommitState commit_state_; |
175 int commit_count_; | 177 int commit_count_; |
176 | 178 |
177 int current_frame_number_; | 179 int current_frame_number_; |
| 180 int last_frame_number_where_begin_frame_sent_to_main_thread_; |
178 int last_frame_number_where_draw_was_called_; | 181 int last_frame_number_where_draw_was_called_; |
179 int last_frame_number_where_tree_activation_attempted_; | 182 int last_frame_number_where_tree_activation_attempted_; |
180 int last_frame_number_where_update_visible_tiles_was_called_; | 183 int last_frame_number_where_update_visible_tiles_was_called_; |
181 int consecutive_failed_draws_; | 184 int consecutive_failed_draws_; |
182 int maximum_number_of_failed_draws_before_draw_is_forced_; | 185 int maximum_number_of_failed_draws_before_draw_is_forced_; |
183 bool needs_redraw_; | 186 bool needs_redraw_; |
184 bool swap_used_incomplete_tile_; | 187 bool swap_used_incomplete_tile_; |
185 bool needs_forced_redraw_; | 188 bool needs_forced_redraw_; |
186 bool needs_forced_redraw_after_next_commit_; | 189 bool needs_forced_redraw_after_next_commit_; |
| 190 bool needs_redraw_after_next_commit_; |
187 bool needs_commit_; | 191 bool needs_commit_; |
188 bool needs_forced_commit_; | 192 bool needs_forced_commit_; |
189 bool expect_immediate_begin_frame_for_main_thread_; | 193 bool expect_immediate_begin_frame_for_main_thread_; |
190 bool main_thread_needs_layer_textures_; | 194 bool main_thread_needs_layer_textures_; |
191 bool inside_begin_frame_; | 195 bool inside_begin_frame_; |
192 BeginFrameArgs last_begin_frame_args_; | 196 BeginFrameArgs last_begin_frame_args_; |
193 bool visible_; | 197 bool visible_; |
194 bool can_start_; | 198 bool can_start_; |
195 bool can_draw_; | 199 bool can_draw_; |
196 bool has_pending_tree_; | 200 bool has_pending_tree_; |
197 bool draw_if_possible_failed_; | 201 bool draw_if_possible_failed_; |
198 TextureState texture_state_; | 202 TextureState texture_state_; |
199 OutputSurfaceState output_surface_state_; | 203 OutputSurfaceState output_surface_state_; |
200 bool did_create_and_initialize_first_output_surface_; | 204 bool did_create_and_initialize_first_output_surface_; |
201 | 205 |
202 private: | 206 private: |
203 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 207 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
204 }; | 208 }; |
205 | 209 |
206 } // namespace cc | 210 } // namespace cc |
207 | 211 |
208 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 212 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |