Chromium Code Reviews| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 ACTION_PREPARE_TILES, | 116 ACTION_PREPARE_TILES, |
| 117 ACTION_INVALIDATE_OUTPUT_SURFACE, | 117 ACTION_INVALIDATE_OUTPUT_SURFACE, |
| 118 }; | 118 }; |
| 119 static const char* ActionToString(Action action); | 119 static const char* ActionToString(Action action); |
| 120 | 120 |
| 121 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 121 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
| 122 void AsValueInto(base::trace_event::TracedValue* dict) const; | 122 void AsValueInto(base::trace_event::TracedValue* dict) const; |
| 123 | 123 |
| 124 Action NextAction() const; | 124 Action NextAction() const; |
| 125 void WillAction(Action action); | 125 void WillAction(Action action); |
| 126 void DidAction(Action action); | |
|
sunnyps
2015/08/25 17:23:24
nit: DidPerformAction?
| |
| 126 | 127 |
| 127 // Indicates whether the impl thread needs a BeginImplFrame callback in order | 128 // Indicates whether the impl thread needs a BeginImplFrame callback in order |
| 128 // to make progress. | 129 // to make progress. |
| 129 bool BeginFrameNeeded() const; | 130 bool BeginFrameNeeded() const; |
| 130 | 131 |
| 131 // Indicates that the system has entered and left a BeginImplFrame callback. | 132 // Indicates that the system has entered and left a BeginImplFrame callback. |
| 132 // The scheduler will not draw more than once in a given BeginImplFrame | 133 // The scheduler will not draw more than once in a given BeginImplFrame |
| 133 // callback nor send more than one BeginMainFrame message. | 134 // callback nor send more than one BeginMainFrame message. |
| 134 void OnBeginImplFrame(); | 135 void OnBeginImplFrame(); |
| 135 void OnBeginImplFrameDeadlinePending(); | 136 void OnBeginImplFrameDeadlinePending(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 | 185 |
| 185 int pending_swaps() const { return pending_swaps_; } | 186 int pending_swaps() const { return pending_swaps_; } |
| 186 | 187 |
| 187 // Indicates whether to prioritize impl thread latency (i.e., animation | 188 // Indicates whether to prioritize impl thread latency (i.e., animation |
| 188 // smoothness) over new content activation. | 189 // smoothness) over new content activation. |
| 189 void SetImplLatencyTakesPriority(bool impl_latency_takes_priority); | 190 void SetImplLatencyTakesPriority(bool impl_latency_takes_priority); |
| 190 bool impl_latency_takes_priority() const { | 191 bool impl_latency_takes_priority() const { |
| 191 return impl_latency_takes_priority_; | 192 return impl_latency_takes_priority_; |
| 192 } | 193 } |
| 193 | 194 |
| 194 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. | 195 // Indicates whether a draw request succeeded or not. |
| 195 void DidDrawIfPossibleCompleted(DrawResult result); | 196 void SetDrawResult(DrawResult result); |
| 196 | 197 |
| 197 // Indicates that a new begin main frame flow needs to be performed, either | 198 // Indicates that a new begin main frame flow needs to be performed, either |
| 198 // to pull updates from the main thread to the impl, or to push deltas from | 199 // to pull updates from the main thread to the impl, or to push deltas from |
| 199 // the impl thread to main. | 200 // the impl thread to main. |
| 200 void SetNeedsBeginMainFrame(); | 201 void SetNeedsBeginMainFrame(); |
| 201 bool needs_begin_main_frame() const { return needs_begin_main_frame_; } | 202 bool needs_begin_main_frame() const { return needs_begin_main_frame_; } |
| 202 | 203 |
| 203 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME | 204 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME |
| 204 // from NextAction. | 205 // from NextAction. |
| 205 // Indicates that all painting is complete. | 206 // Indicates that all painting is complete. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 bool ShouldActivatePendingTree() const; | 282 bool ShouldActivatePendingTree() const; |
| 282 bool ShouldSendBeginMainFrame() const; | 283 bool ShouldSendBeginMainFrame() const; |
| 283 bool ShouldCommit() const; | 284 bool ShouldCommit() const; |
| 284 bool ShouldPrepareTiles() const; | 285 bool ShouldPrepareTiles() const; |
| 285 bool ShouldInvalidateOutputSurface() const; | 286 bool ShouldInvalidateOutputSurface() const; |
| 286 | 287 |
| 287 void WillAnimate(); | 288 void WillAnimate(); |
| 288 void WillSendBeginMainFrame(); | 289 void WillSendBeginMainFrame(); |
| 289 void WillCommit(bool commit_had_no_updates); | 290 void WillCommit(bool commit_had_no_updates); |
| 290 void WillActivate(); | 291 void WillActivate(); |
| 291 void WillDraw(bool did_request_swap); | 292 void WillDraw(); |
| 292 void WillBeginOutputSurfaceCreation(); | 293 void WillBeginOutputSurfaceCreation(); |
| 293 void WillPrepareTiles(); | 294 void WillPrepareTiles(); |
| 294 void WillInvalidateOutputSurface(); | 295 void WillInvalidateOutputSurface(); |
| 295 | 296 |
| 297 void DidDraw(bool did_request_swap); | |
| 298 | |
| 296 const SchedulerSettings settings_; | 299 const SchedulerSettings settings_; |
| 297 | 300 |
| 298 OutputSurfaceState output_surface_state_; | 301 OutputSurfaceState output_surface_state_; |
| 299 BeginImplFrameState begin_impl_frame_state_; | 302 BeginImplFrameState begin_impl_frame_state_; |
| 300 BeginMainFrameState begin_main_frame_state_; | 303 BeginMainFrameState begin_main_frame_state_; |
| 301 ForcedRedrawOnTimeoutState forced_redraw_state_; | 304 ForcedRedrawOnTimeoutState forced_redraw_state_; |
| 302 | 305 |
| 303 // These are used for tracing only. | 306 // These are used for tracing only. |
| 304 int commit_count_; | 307 int commit_count_; |
| 305 int current_frame_number_; | 308 int current_frame_number_; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 319 // and "drained" on each BeginImplFrame. If the funnel gets too full, | 322 // and "drained" on each BeginImplFrame. If the funnel gets too full, |
| 320 // we start throttling ACTION_PREPARE_TILES such that we average one | 323 // we start throttling ACTION_PREPARE_TILES such that we average one |
| 321 // PrepareTiles per BeginImplFrame. | 324 // PrepareTiles per BeginImplFrame. |
| 322 int prepare_tiles_funnel_; | 325 int prepare_tiles_funnel_; |
| 323 | 326 |
| 324 int consecutive_checkerboard_animations_; | 327 int consecutive_checkerboard_animations_; |
| 325 int max_pending_swaps_; | 328 int max_pending_swaps_; |
| 326 int pending_swaps_; | 329 int pending_swaps_; |
| 327 int swaps_with_current_output_surface_; | 330 int swaps_with_current_output_surface_; |
| 328 bool needs_redraw_; | 331 bool needs_redraw_; |
| 332 DrawResult last_draw_result_; | |
| 329 bool needs_animate_; | 333 bool needs_animate_; |
| 330 bool needs_prepare_tiles_; | 334 bool needs_prepare_tiles_; |
| 331 bool needs_begin_main_frame_; | 335 bool needs_begin_main_frame_; |
| 332 bool visible_; | 336 bool visible_; |
| 333 bool can_start_; | 337 bool can_start_; |
| 334 bool can_draw_; | 338 bool can_draw_; |
| 335 bool has_pending_tree_; | 339 bool has_pending_tree_; |
| 336 bool pending_tree_is_ready_for_activation_; | 340 bool pending_tree_is_ready_for_activation_; |
| 337 bool active_tree_needs_first_draw_; | 341 bool active_tree_needs_first_draw_; |
| 338 bool did_create_and_initialize_first_output_surface_; | 342 bool did_create_and_initialize_first_output_surface_; |
| 339 bool impl_latency_takes_priority_; | 343 bool impl_latency_takes_priority_; |
| 340 bool main_thread_missed_last_deadline_; | 344 bool main_thread_missed_last_deadline_; |
| 341 bool skip_next_begin_main_frame_to_reduce_latency_; | 345 bool skip_next_begin_main_frame_to_reduce_latency_; |
| 342 bool continuous_painting_; | 346 bool continuous_painting_; |
| 343 bool children_need_begin_frames_; | 347 bool children_need_begin_frames_; |
| 344 bool defer_commits_; | 348 bool defer_commits_; |
| 345 bool video_needs_begin_frames_; | 349 bool video_needs_begin_frames_; |
| 346 bool last_commit_had_no_updates_; | 350 bool last_commit_had_no_updates_; |
| 347 bool wait_for_ready_to_draw_; | 351 bool wait_for_ready_to_draw_; |
| 348 bool did_request_swap_in_last_frame_; | 352 bool did_request_swap_in_last_frame_; |
| 349 bool did_perform_swap_in_last_draw_; | 353 bool did_perform_swap_in_last_draw_; |
| 350 | 354 |
| 351 private: | 355 private: |
| 352 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 356 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
| 353 }; | 357 }; |
| 354 | 358 |
| 355 } // namespace cc | 359 } // namespace cc |
| 356 | 360 |
| 357 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 361 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| OLD | NEW |