| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 bool ShouldAnimate() const; | 272 bool ShouldAnimate() const; |
| 273 bool ShouldBeginOutputSurfaceCreation() const; | 273 bool ShouldBeginOutputSurfaceCreation() const; |
| 274 bool ShouldDraw() const; | 274 bool ShouldDraw() const; |
| 275 bool ShouldActivatePendingTree() const; | 275 bool ShouldActivatePendingTree() const; |
| 276 bool ShouldSendBeginMainFrame() const; | 276 bool ShouldSendBeginMainFrame() const; |
| 277 bool ShouldCommit() const; | 277 bool ShouldCommit() const; |
| 278 bool ShouldPrepareTiles() const; | 278 bool ShouldPrepareTiles() const; |
| 279 | 279 |
| 280 void AdvanceCurrentFrameNumber(); | 280 void AdvanceCurrentFrameNumber(); |
| 281 bool HasAnimatedThisFrame() const; | |
| 282 bool HasSentBeginMainFrameThisFrame() const; | |
| 283 bool HasRequestedSwapThisFrame() const; | |
| 284 bool HasSwappedThisFrame() const; | |
| 285 | 281 |
| 286 void UpdateStateOnCommit(bool commit_had_no_updates); | 282 void UpdateStateOnCommit(bool commit_had_no_updates); |
| 287 void UpdateStateOnActivation(); | 283 void UpdateStateOnActivation(); |
| 288 void UpdateStateOnDraw(bool did_request_swap); | 284 void UpdateStateOnDraw(bool did_request_swap); |
| 289 void UpdateStateOnPrepareTiles(); | 285 void UpdateStateOnPrepareTiles(); |
| 290 | 286 |
| 291 const SchedulerSettings settings_; | 287 const SchedulerSettings settings_; |
| 292 | 288 |
| 293 OutputSurfaceState output_surface_state_; | 289 OutputSurfaceState output_surface_state_; |
| 294 BeginImplFrameState begin_impl_frame_state_; | 290 BeginImplFrameState begin_impl_frame_state_; |
| 295 CommitState commit_state_; | 291 CommitState commit_state_; |
| 296 ForcedRedrawOnTimeoutState forced_redraw_state_; | 292 ForcedRedrawOnTimeoutState forced_redraw_state_; |
| 297 | 293 |
| 294 // These are used for tracing only. |
| 298 int commit_count_; | 295 int commit_count_; |
| 299 int current_frame_number_; | 296 int current_frame_number_; |
| 300 int last_frame_number_animate_performed_; | 297 int last_frame_number_animate_performed_; |
| 301 int last_frame_number_swap_performed_; | 298 int last_frame_number_swap_performed_; |
| 302 int last_frame_number_swap_requested_; | 299 int last_frame_number_swap_requested_; |
| 303 int last_frame_number_begin_main_frame_sent_; | 300 int last_frame_number_begin_main_frame_sent_; |
| 304 | 301 |
| 302 // These are used to ensure that an action only happens once per frame, |
| 303 // deadline, etc. |
| 304 bool animate_funnel_; |
| 305 bool perform_swap_funnel_; |
| 306 bool request_swap_funnel_; |
| 307 bool send_begin_main_frame_funnel_; |
| 305 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called | 308 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called |
| 306 // and "drained" on each BeginImplFrame. If the funnel gets too full, | 309 // and "drained" on each BeginImplFrame. If the funnel gets too full, |
| 307 // we start throttling ACTION_PREPARE_TILES such that we average one | 310 // we start throttling ACTION_PREPARE_TILES such that we average one |
| 308 // PrepareTiles per BeginImplFrame. | 311 // PrepareTiles per BeginImplFrame. |
| 309 int prepare_tiles_funnel_; | 312 int prepare_tiles_funnel_; |
| 313 |
| 310 int consecutive_checkerboard_animations_; | 314 int consecutive_checkerboard_animations_; |
| 311 int max_pending_swaps_; | 315 int max_pending_swaps_; |
| 312 int pending_swaps_; | 316 int pending_swaps_; |
| 313 bool needs_redraw_; | 317 bool needs_redraw_; |
| 314 bool needs_animate_; | 318 bool needs_animate_; |
| 315 bool needs_prepare_tiles_; | 319 bool needs_prepare_tiles_; |
| 316 bool needs_commit_; | 320 bool needs_commit_; |
| 317 bool inside_poll_for_anticipated_draw_triggers_; | 321 bool inside_poll_for_anticipated_draw_triggers_; |
| 318 bool visible_; | 322 bool visible_; |
| 319 bool can_start_; | 323 bool can_start_; |
| 320 bool can_draw_; | 324 bool can_draw_; |
| 321 bool has_pending_tree_; | 325 bool has_pending_tree_; |
| 322 bool pending_tree_is_ready_for_activation_; | 326 bool pending_tree_is_ready_for_activation_; |
| 323 bool active_tree_needs_first_draw_; | 327 bool active_tree_needs_first_draw_; |
| 324 bool did_commit_after_animating_; | |
| 325 bool did_create_and_initialize_first_output_surface_; | 328 bool did_create_and_initialize_first_output_surface_; |
| 326 bool impl_latency_takes_priority_; | 329 bool impl_latency_takes_priority_; |
| 327 bool skip_next_begin_main_frame_to_reduce_latency_; | 330 bool skip_next_begin_main_frame_to_reduce_latency_; |
| 328 bool skip_begin_main_frame_to_reduce_latency_; | 331 bool skip_begin_main_frame_to_reduce_latency_; |
| 329 bool continuous_painting_; | 332 bool continuous_painting_; |
| 330 bool children_need_begin_frames_; | 333 bool children_need_begin_frames_; |
| 331 bool defer_commits_; | 334 bool defer_commits_; |
| 332 | 335 |
| 333 private: | 336 private: |
| 334 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 337 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
| 335 }; | 338 }; |
| 336 | 339 |
| 337 } // namespace cc | 340 } // namespace cc |
| 338 | 341 |
| 339 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 342 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| OLD | NEW |