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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool RedrawPending() const { return needs_redraw_; } | 110 bool RedrawPending() const { return needs_redraw_; } |
| 111 bool PrepareTilesPending() const { return needs_prepare_tiles_; } | 111 bool PrepareTilesPending() const { return needs_prepare_tiles_; } |
| 112 | 112 |
| 113 enum Action { | 113 enum Action { |
| 114 ACTION_NONE, | 114 ACTION_NONE, |
| 115 ACTION_SEND_BEGIN_MAIN_FRAME, | 115 ACTION_SEND_BEGIN_MAIN_FRAME, |
| 116 ACTION_COMMIT, | 116 ACTION_COMMIT, |
| 117 ACTION_ACTIVATE_SYNC_TREE, | 117 ACTION_ACTIVATE_SYNC_TREE, |
| 118 ACTION_RUN_IMPL_SIDE_INVALIDATION, | |
| 118 ACTION_DRAW_IF_POSSIBLE, | 119 ACTION_DRAW_IF_POSSIBLE, |
| 119 ACTION_DRAW_FORCED, | 120 ACTION_DRAW_FORCED, |
| 120 ACTION_DRAW_ABORT, | 121 ACTION_DRAW_ABORT, |
| 121 ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION, | 122 ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION, |
| 122 ACTION_PREPARE_TILES, | 123 ACTION_PREPARE_TILES, |
| 123 ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK, | 124 ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK, |
| 124 }; | 125 }; |
| 125 static const char* ActionToString(Action action); | 126 static const char* ActionToString(Action action); |
| 126 | 127 |
| 127 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 128 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 | 243 |
| 243 // Indicates that scheduled BeginMainFrame is started. | 244 // Indicates that scheduled BeginMainFrame is started. |
| 244 void NotifyBeginMainFrameStarted(); | 245 void NotifyBeginMainFrameStarted(); |
| 245 | 246 |
| 246 // Indicates that the pending tree is ready for activation. | 247 // Indicates that the pending tree is ready for activation. |
| 247 void NotifyReadyToActivate(); | 248 void NotifyReadyToActivate(); |
| 248 | 249 |
| 249 // Indicates the active tree's visible tiles are ready to be drawn. | 250 // Indicates the active tree's visible tiles are ready to be drawn. |
| 250 void NotifyReadyToDraw(); | 251 void NotifyReadyToDraw(); |
| 251 | 252 |
| 253 void SetNeedsImplSideInvalidation(); | |
| 254 void WillRunImplSideInvalidation(); | |
|
brianderson
2017/02/03 00:54:53
To be consistent, group this with the other Will*
Khushal
2017/02/03 01:45:11
Done.
| |
| 255 | |
| 252 bool has_pending_tree() const { return has_pending_tree_; } | 256 bool has_pending_tree() const { return has_pending_tree_; } |
| 253 bool active_tree_needs_first_draw() const { | 257 bool active_tree_needs_first_draw() const { |
| 254 return active_tree_needs_first_draw_; | 258 return active_tree_needs_first_draw_; |
| 255 } | 259 } |
| 256 | 260 |
| 257 void DidPrepareTiles(); | 261 void DidPrepareTiles(); |
| 258 void DidLoseCompositorFrameSink(); | 262 void DidLoseCompositorFrameSink(); |
| 259 void DidCreateAndInitializeCompositorFrameSink(); | 263 void DidCreateAndInitializeCompositorFrameSink(); |
| 260 bool HasInitializedCompositorFrameSink() const; | 264 bool HasInitializedCompositorFrameSink() const; |
| 261 | 265 |
| 262 // True if we need to abort draws to make forward progress. | 266 // True if we need to abort draws to make forward progress. |
| 263 bool PendingDrawsShouldBeAborted() const; | 267 bool PendingDrawsShouldBeAborted() const; |
| 264 | 268 |
| 265 bool CouldSendBeginMainFrame() const; | 269 bool CouldSendBeginMainFrame() const; |
| 266 | 270 |
| 267 void SetDeferCommits(bool defer_commits); | 271 void SetDeferCommits(bool defer_commits); |
| 268 | 272 |
| 269 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); | 273 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); |
| 270 bool video_needs_begin_frames() const { return video_needs_begin_frames_; } | 274 bool video_needs_begin_frames() const { return video_needs_begin_frames_; } |
| 271 | 275 |
| 272 bool did_submit_in_last_frame() const { return did_submit_in_last_frame_; } | 276 bool did_submit_in_last_frame() const { return did_submit_in_last_frame_; } |
| 273 | 277 |
| 274 protected: | 278 protected: |
| 275 bool BeginFrameRequiredForAction() const; | 279 bool BeginFrameRequiredForAction() const; |
| 276 bool BeginFrameNeededForVideo() const; | 280 bool BeginFrameNeededForVideo() const; |
| 277 bool ProactiveBeginFrameWanted() const; | 281 bool ProactiveBeginFrameWanted() const; |
| 278 | 282 |
| 283 bool ShouldRunImplSideInvalidation() const; | |
| 284 bool CouldCreatePendingTree() const; | |
| 285 | |
| 279 bool ShouldTriggerBeginImplFrameDeadlineImmediately() const; | 286 bool ShouldTriggerBeginImplFrameDeadlineImmediately() const; |
| 280 | 287 |
| 281 // True if we need to force activations to make forward progress. | 288 // True if we need to force activations to make forward progress. |
| 282 // TODO(sunnyps): Rename this to ShouldAbortCurrentFrame or similar. | 289 // TODO(sunnyps): Rename this to ShouldAbortCurrentFrame or similar. |
| 283 bool PendingActivationsShouldBeForced() const; | 290 bool PendingActivationsShouldBeForced() const; |
| 284 | 291 |
| 285 bool ShouldBeginCompositorFrameSinkCreation() const; | 292 bool ShouldBeginCompositorFrameSinkCreation() const; |
| 286 bool ShouldDraw() const; | 293 bool ShouldDraw() const; |
| 287 bool ShouldActivatePendingTree() const; | 294 bool ShouldActivatePendingTree() const; |
| 288 bool ShouldSendBeginMainFrame() const; | 295 bool ShouldSendBeginMainFrame() const; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 306 int last_frame_number_submit_performed_; | 313 int last_frame_number_submit_performed_; |
| 307 int last_frame_number_draw_performed_; | 314 int last_frame_number_draw_performed_; |
| 308 int last_frame_number_begin_main_frame_sent_; | 315 int last_frame_number_begin_main_frame_sent_; |
| 309 int last_frame_number_invalidate_compositor_frame_sink_performed_; | 316 int last_frame_number_invalidate_compositor_frame_sink_performed_; |
| 310 | 317 |
| 311 // These are used to ensure that an action only happens once per frame, | 318 // These are used to ensure that an action only happens once per frame, |
| 312 // deadline, etc. | 319 // deadline, etc. |
| 313 bool draw_funnel_; | 320 bool draw_funnel_; |
| 314 bool send_begin_main_frame_funnel_; | 321 bool send_begin_main_frame_funnel_; |
| 315 bool invalidate_compositor_frame_sink_funnel_; | 322 bool invalidate_compositor_frame_sink_funnel_; |
| 323 bool impl_side_invalidation_funnel_; | |
| 316 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called | 324 // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called |
| 317 // and "drained" on each BeginImplFrame. If the funnel gets too full, | 325 // and "drained" on each BeginImplFrame. If the funnel gets too full, |
| 318 // we start throttling ACTION_PREPARE_TILES such that we average one | 326 // we start throttling ACTION_PREPARE_TILES such that we average one |
| 319 // PrepareTiles per BeginImplFrame. | 327 // PrepareTiles per BeginImplFrame. |
| 320 int prepare_tiles_funnel_; | 328 int prepare_tiles_funnel_; |
| 321 | 329 |
| 322 int consecutive_checkerboard_animations_; | 330 int consecutive_checkerboard_animations_; |
| 323 int pending_submit_frames_; | 331 int pending_submit_frames_; |
| 324 int submit_frames_with_current_compositor_frame_sink_; | 332 int submit_frames_with_current_compositor_frame_sink_; |
| 325 bool needs_redraw_; | 333 bool needs_redraw_; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 338 ScrollHandlerState scroll_handler_state_; | 346 ScrollHandlerState scroll_handler_state_; |
| 339 bool critical_begin_main_frame_to_activate_is_fast_; | 347 bool critical_begin_main_frame_to_activate_is_fast_; |
| 340 bool main_thread_missed_last_deadline_; | 348 bool main_thread_missed_last_deadline_; |
| 341 bool skip_next_begin_main_frame_to_reduce_latency_; | 349 bool skip_next_begin_main_frame_to_reduce_latency_; |
| 342 bool defer_commits_; | 350 bool defer_commits_; |
| 343 bool video_needs_begin_frames_; | 351 bool video_needs_begin_frames_; |
| 344 bool last_commit_had_no_updates_; | 352 bool last_commit_had_no_updates_; |
| 345 bool wait_for_ready_to_draw_; | 353 bool wait_for_ready_to_draw_; |
| 346 bool did_draw_in_last_frame_; | 354 bool did_draw_in_last_frame_; |
| 347 bool did_submit_in_last_frame_; | 355 bool did_submit_in_last_frame_; |
| 356 bool needs_impl_side_invalidation_; | |
| 357 bool run_impl_side_invalidation_after_main_frame_aborted_; | |
| 348 | 358 |
| 349 private: | 359 private: |
| 350 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 360 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
| 351 }; | 361 }; |
| 352 | 362 |
| 353 } // namespace cc | 363 } // namespace cc |
| 354 | 364 |
| 355 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 365 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
| OLD | NEW |