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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED || | 101 commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED || |
102 commit_state_ == COMMIT_STATE_READY_TO_COMMIT; | 102 commit_state_ == COMMIT_STATE_READY_TO_COMMIT; |
103 } | 103 } |
104 CommitState commit_state() const { return commit_state_; } | 104 CommitState commit_state() const { return commit_state_; } |
105 | 105 |
106 bool RedrawPending() const { return needs_redraw_; } | 106 bool RedrawPending() const { return needs_redraw_; } |
107 bool ManageTilesPending() const { return needs_manage_tiles_; } | 107 bool ManageTilesPending() const { return needs_manage_tiles_; } |
108 | 108 |
109 enum Action { | 109 enum Action { |
110 ACTION_NONE, | 110 ACTION_NONE, |
| 111 ACTION_ANIMATE, |
111 ACTION_SEND_BEGIN_MAIN_FRAME, | 112 ACTION_SEND_BEGIN_MAIN_FRAME, |
112 ACTION_COMMIT, | 113 ACTION_COMMIT, |
113 ACTION_UPDATE_VISIBLE_TILES, | 114 ACTION_UPDATE_VISIBLE_TILES, |
114 ACTION_ACTIVATE_PENDING_TREE, | 115 ACTION_ACTIVATE_PENDING_TREE, |
115 ACTION_DRAW_AND_SWAP_IF_POSSIBLE, | 116 ACTION_DRAW_AND_SWAP_IF_POSSIBLE, |
116 ACTION_DRAW_AND_SWAP_FORCED, | 117 ACTION_DRAW_AND_SWAP_FORCED, |
117 ACTION_DRAW_AND_SWAP_ABORT, | 118 ACTION_DRAW_AND_SWAP_ABORT, |
118 ACTION_DRAW_AND_READBACK, | 119 ACTION_DRAW_AND_READBACK, |
119 ACTION_BEGIN_OUTPUT_SURFACE_CREATION, | 120 ACTION_BEGIN_OUTPUT_SURFACE_CREATION, |
120 ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD, | 121 ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 166 } |
166 | 167 |
167 // Indicates whether the LayerTreeHostImpl is visible. | 168 // Indicates whether the LayerTreeHostImpl is visible. |
168 void SetVisible(bool visible); | 169 void SetVisible(bool visible); |
169 | 170 |
170 // Indicates that a redraw is required, either due to the impl tree changing | 171 // Indicates that a redraw is required, either due to the impl tree changing |
171 // or the screen being damaged and simply needing redisplay. | 172 // or the screen being damaged and simply needing redisplay. |
172 void SetNeedsRedraw(); | 173 void SetNeedsRedraw(); |
173 bool needs_redraw() const { return needs_redraw_; } | 174 bool needs_redraw() const { return needs_redraw_; } |
174 | 175 |
| 176 void SetNeedsAnimate(); |
| 177 bool needs_animate() const { return needs_animate_; } |
| 178 |
175 // Indicates that manage-tiles is required. This guarantees another | 179 // Indicates that manage-tiles is required. This guarantees another |
176 // ManageTiles will occur shortly (even if no redraw is required). | 180 // ManageTiles will occur shortly (even if no redraw is required). |
177 void SetNeedsManageTiles(); | 181 void SetNeedsManageTiles(); |
178 | 182 |
179 // Indicates whether a redraw is required because we are currently rendering | 183 // Indicates whether a redraw is required because we are currently rendering |
180 // with a low resolution or checkerboarded tile. | 184 // with a low resolution or checkerboarded tile. |
181 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); | 185 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); |
182 | 186 |
183 // Indicates whether to prioritize animation smoothness over new content | 187 // Indicates whether to prioritize animation smoothness over new content |
184 // activation. | 188 // activation. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 251 |
248 bool SupportsProactiveBeginImplFrame() const; | 252 bool SupportsProactiveBeginImplFrame() const; |
249 | 253 |
250 protected: | 254 protected: |
251 bool BeginImplFrameNeededToDraw() const; | 255 bool BeginImplFrameNeededToDraw() const; |
252 bool ProactiveBeginImplFrameWanted() const; | 256 bool ProactiveBeginImplFrameWanted() const; |
253 | 257 |
254 // True if we need to force activations to make forward progress. | 258 // True if we need to force activations to make forward progress. |
255 bool PendingActivationsShouldBeForced() const; | 259 bool PendingActivationsShouldBeForced() const; |
256 | 260 |
| 261 bool ShouldAnimate() const; |
257 bool ShouldBeginOutputSurfaceCreation() const; | 262 bool ShouldBeginOutputSurfaceCreation() const; |
258 bool ShouldDrawForced() const; | 263 bool ShouldDrawForced() const; |
259 bool ShouldDraw() const; | 264 bool ShouldDraw() const; |
260 bool ShouldActivatePendingTree() const; | 265 bool ShouldActivatePendingTree() const; |
261 bool ShouldAcquireLayerTexturesForMainThread() const; | 266 bool ShouldAcquireLayerTexturesForMainThread() const; |
262 bool ShouldUpdateVisibleTiles() const; | 267 bool ShouldUpdateVisibleTiles() const; |
263 bool ShouldSendBeginMainFrame() const; | 268 bool ShouldSendBeginMainFrame() const; |
264 bool ShouldCommit() const; | 269 bool ShouldCommit() const; |
265 bool ShouldManageTiles() const; | 270 bool ShouldManageTiles() const; |
266 | 271 |
(...skipping 14 matching lines...) Expand all Loading... |
281 BeginImplFrameState begin_impl_frame_state_; | 286 BeginImplFrameState begin_impl_frame_state_; |
282 CommitState commit_state_; | 287 CommitState commit_state_; |
283 TextureState texture_state_; | 288 TextureState texture_state_; |
284 ForcedRedrawOnTimeoutState forced_redraw_state_; | 289 ForcedRedrawOnTimeoutState forced_redraw_state_; |
285 SynchronousReadbackState readback_state_; | 290 SynchronousReadbackState readback_state_; |
286 | 291 |
287 BeginFrameArgs last_begin_impl_frame_args_; | 292 BeginFrameArgs last_begin_impl_frame_args_; |
288 | 293 |
289 int commit_count_; | 294 int commit_count_; |
290 int current_frame_number_; | 295 int current_frame_number_; |
| 296 int last_frame_number_animate_performed_; |
291 int last_frame_number_swap_performed_; | 297 int last_frame_number_swap_performed_; |
292 int last_frame_number_begin_main_frame_sent_; | 298 int last_frame_number_begin_main_frame_sent_; |
293 int last_frame_number_update_visible_tiles_was_called_; | 299 int last_frame_number_update_visible_tiles_was_called_; |
294 | 300 |
295 // manage_tiles_funnel_ is "filled" each time ManageTiles is called | 301 // manage_tiles_funnel_ is "filled" each time ManageTiles is called |
296 // and "drained" on each BeginImplFrame. If the funnel gets too full, | 302 // and "drained" on each BeginImplFrame. If the funnel gets too full, |
297 // we start throttling ACTION_MANAGE_TILES such that we average one | 303 // we start throttling ACTION_MANAGE_TILES such that we average one |
298 // ManageTile per BeginImplFrame. | 304 // ManageTile per BeginImplFrame. |
299 int manage_tiles_funnel_; | 305 int manage_tiles_funnel_; |
300 int consecutive_checkerboard_animations_; | 306 int consecutive_checkerboard_animations_; |
301 bool needs_redraw_; | 307 bool needs_redraw_; |
| 308 bool needs_animate_; |
302 bool needs_manage_tiles_; | 309 bool needs_manage_tiles_; |
303 bool swap_used_incomplete_tile_; | 310 bool swap_used_incomplete_tile_; |
304 bool needs_commit_; | 311 bool needs_commit_; |
305 bool main_thread_needs_layer_textures_; | 312 bool main_thread_needs_layer_textures_; |
306 bool inside_poll_for_anticipated_draw_triggers_; | 313 bool inside_poll_for_anticipated_draw_triggers_; |
307 bool visible_; | 314 bool visible_; |
308 bool can_start_; | 315 bool can_start_; |
309 bool can_draw_; | 316 bool can_draw_; |
310 bool has_pending_tree_; | 317 bool has_pending_tree_; |
311 bool pending_tree_is_ready_for_activation_; | 318 bool pending_tree_is_ready_for_activation_; |
312 bool active_tree_needs_first_draw_; | 319 bool active_tree_needs_first_draw_; |
313 bool draw_if_possible_failed_; | 320 bool draw_if_possible_failed_; |
314 bool did_create_and_initialize_first_output_surface_; | 321 bool did_create_and_initialize_first_output_surface_; |
315 bool smoothness_takes_priority_; | 322 bool smoothness_takes_priority_; |
316 bool skip_next_begin_main_frame_to_reduce_latency_; | 323 bool skip_next_begin_main_frame_to_reduce_latency_; |
317 bool skip_begin_main_frame_to_reduce_latency_; | 324 bool skip_begin_main_frame_to_reduce_latency_; |
318 | 325 |
319 private: | 326 private: |
320 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 327 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
321 }; | 328 }; |
322 | 329 |
323 } // namespace cc | 330 } // namespace cc |
324 | 331 |
325 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 332 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |