| 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 24 matching lines...) Expand all Loading... |
| 35 // near to the vblank time. | 35 // near to the vblank time. |
| 36 // | 36 // |
| 37 // The scheduler seperates "what to do next" from the updating of its internal | 37 // The scheduler seperates "what to do next" from the updating of its internal |
| 38 // state to make testing cleaner. | 38 // state to make testing cleaner. |
| 39 class CC_EXPORT SchedulerStateMachine { | 39 class CC_EXPORT SchedulerStateMachine { |
| 40 public: | 40 public: |
| 41 // settings must be valid for the lifetime of this class. | 41 // settings must be valid for the lifetime of this class. |
| 42 explicit SchedulerStateMachine(const SchedulerSettings& settings); | 42 explicit SchedulerStateMachine(const SchedulerSettings& settings); |
| 43 | 43 |
| 44 enum OutputSurfaceState { | 44 enum OutputSurfaceState { |
| 45 OUTPUT_SURFACE_NONE, |
| 45 OUTPUT_SURFACE_ACTIVE, | 46 OUTPUT_SURFACE_ACTIVE, |
| 46 OUTPUT_SURFACE_LOST, | |
| 47 OUTPUT_SURFACE_CREATING, | 47 OUTPUT_SURFACE_CREATING, |
| 48 OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT, | 48 OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT, |
| 49 OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION, | 49 OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION, |
| 50 }; | 50 }; |
| 51 static const char* OutputSurfaceStateToString(OutputSurfaceState state); | 51 static const char* OutputSurfaceStateToString(OutputSurfaceState state); |
| 52 | 52 |
| 53 // Note: BeginImplFrameState does not cycle through these states in a fixed | 53 // Note: BeginImplFrameState does not cycle through these states in a fixed |
| 54 // order on all platforms. It's up to the scheduler to set these correctly. | 54 // order on all platforms. It's up to the scheduler to set these correctly. |
| 55 // TODO(sunnyps): Rename the states to IDLE, ANIMATE, WAITING_FOR_DEADLINE and | 55 // TODO(sunnyps): Rename the states to IDLE, ANIMATE, WAITING_FOR_DEADLINE and |
| 56 // DRAW. | 56 // DRAW. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME | 210 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME |
| 211 // from NextAction. | 211 // from NextAction. |
| 212 // Indicates that all painting is complete. | 212 // Indicates that all painting is complete. |
| 213 void NotifyReadyToCommit(); | 213 void NotifyReadyToCommit(); |
| 214 | 214 |
| 215 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME | 215 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME |
| 216 // from NextAction if the client rejects the BeginMainFrame message. | 216 // from NextAction if the client rejects the BeginMainFrame message. |
| 217 void BeginMainFrameAborted(CommitEarlyOutReason reason); | 217 void BeginMainFrameAborted(CommitEarlyOutReason reason); |
| 218 | 218 |
| 219 // Set that we can create the first OutputSurface and start the scheduler. | |
| 220 void SetCanStart() { can_start_ = true; } | |
| 221 // Allow access of the can_start_ state in tests. | |
| 222 bool CanStartForTesting() const { return can_start_; } | |
| 223 | |
| 224 // Indicates production should be skipped to recover latency. | 219 // Indicates production should be skipped to recover latency. |
| 225 void SetSkipNextBeginMainFrameToReduceLatency(); | 220 void SetSkipNextBeginMainFrameToReduceLatency(); |
| 226 | 221 |
| 227 // Indicates whether drawing would, at this time, make sense. | 222 // Indicates whether drawing would, at this time, make sense. |
| 228 // CanDraw can be used to suppress flashes or checkerboarding | 223 // CanDraw can be used to suppress flashes or checkerboarding |
| 229 // when such behavior would be undesirable. | 224 // when such behavior would be undesirable. |
| 230 void SetCanDraw(bool can); | 225 void SetCanDraw(bool can); |
| 231 | 226 |
| 232 // Indicates that scheduled BeginMainFrame is started. | 227 // Indicates that scheduled BeginMainFrame is started. |
| 233 void NotifyBeginMainFrameStarted(); | 228 void NotifyBeginMainFrameStarted(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 312 |
| 318 int consecutive_checkerboard_animations_; | 313 int consecutive_checkerboard_animations_; |
| 319 int max_pending_swaps_; | 314 int max_pending_swaps_; |
| 320 int pending_swaps_; | 315 int pending_swaps_; |
| 321 int swaps_with_current_output_surface_; | 316 int swaps_with_current_output_surface_; |
| 322 bool needs_redraw_; | 317 bool needs_redraw_; |
| 323 bool needs_animate_; | 318 bool needs_animate_; |
| 324 bool needs_prepare_tiles_; | 319 bool needs_prepare_tiles_; |
| 325 bool needs_begin_main_frame_; | 320 bool needs_begin_main_frame_; |
| 326 bool visible_; | 321 bool visible_; |
| 327 bool can_start_; | |
| 328 bool can_draw_; | 322 bool can_draw_; |
| 329 bool has_pending_tree_; | 323 bool has_pending_tree_; |
| 330 bool pending_tree_is_ready_for_activation_; | 324 bool pending_tree_is_ready_for_activation_; |
| 331 bool active_tree_needs_first_draw_; | 325 bool active_tree_needs_first_draw_; |
| 332 bool did_create_and_initialize_first_output_surface_; | 326 bool did_create_and_initialize_first_output_surface_; |
| 333 bool impl_latency_takes_priority_; | 327 bool impl_latency_takes_priority_; |
| 334 bool main_thread_missed_last_deadline_; | 328 bool main_thread_missed_last_deadline_; |
| 335 bool skip_next_begin_main_frame_to_reduce_latency_; | 329 bool skip_next_begin_main_frame_to_reduce_latency_; |
| 336 bool children_need_begin_frames_; | 330 bool children_need_begin_frames_; |
| 337 bool defer_commits_; | 331 bool defer_commits_; |
| 338 bool video_needs_begin_frames_; | 332 bool video_needs_begin_frames_; |
| 339 bool last_commit_had_no_updates_; | 333 bool last_commit_had_no_updates_; |
| 340 bool wait_for_ready_to_draw_; | 334 bool wait_for_ready_to_draw_; |
| 341 bool did_request_swap_in_last_frame_; | 335 bool did_request_swap_in_last_frame_; |
| 342 bool did_perform_swap_in_last_draw_; | 336 bool did_perform_swap_in_last_draw_; |
| 343 | 337 |
| 344 private: | 338 private: |
| 345 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 339 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
| 346 }; | 340 }; |
| 347 | 341 |
| 348 } // namespace cc | 342 } // namespace cc |
| 349 | 343 |
| 350 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 344 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| OLD | NEW |