| Index: cc/scheduler/scheduler_state_machine.h
|
| diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h
|
| index ad2cf65c3e6c91f7d623af3b95b327f31473fef6..95566a408e044a3415ac4160a2a4e7b62bf65403 100644
|
| --- a/cc/scheduler/scheduler_state_machine.h
|
| +++ b/cc/scheduler/scheduler_state_machine.h
|
| @@ -45,6 +45,18 @@ class CC_EXPORT SchedulerStateMachine {
|
| };
|
| static const char* OutputSurfaceStateToString(OutputSurfaceState state);
|
|
|
| + // Note: BeginFrameState will always cycle through all the states in order.
|
| + // Whether or not it actually waits or draws, it will at least try to wait in
|
| + // BEGIN_FRAME_STATE_DEADLINE_PENDING and try to draw in
|
| + // BEGIN_FRAME_STATE_INSIDE_DEADLINE
|
| + enum BeginFrameState {
|
| + BEGIN_FRAME_STATE_IDLE,
|
| + BEGIN_FRAME_STATE_INSIDE_BEGIN_FRAME,
|
| + BEGIN_FRAME_STATE_DEADLINE_PENDING,
|
| + BEGIN_FRAME_STATE_INSIDE_DEADLINE,
|
| + };
|
| + static const char* BeginFrameStateToString(BeginFrameState state);
|
| +
|
| enum CommitState {
|
| COMMIT_STATE_IDLE,
|
| COMMIT_STATE_FRAME_IN_PROGRESS,
|
| @@ -82,8 +94,7 @@ class CC_EXPORT SchedulerStateMachine {
|
| ForcedRedrawOnTimeoutState state);
|
|
|
| bool CommitPending() const {
|
| - return commit_state_ == COMMIT_STATE_FRAME_IN_PROGRESS ||
|
| - commit_state_ == COMMIT_STATE_READY_TO_COMMIT;
|
| + return commit_state_ == COMMIT_STATE_FRAME_IN_PROGRESS;
|
| }
|
|
|
| bool RedrawPending() const { return needs_redraw_; }
|
| @@ -107,19 +118,23 @@ class CC_EXPORT SchedulerStateMachine {
|
|
|
| Action NextAction() const;
|
| void UpdateState(Action action);
|
| + void AdvanceBeginFrameStateWhenNoActionsRemain();
|
| +
|
| void CheckInvariants();
|
|
|
| // Indicates whether the main thread needs a begin frame callback in order to
|
| // make progress.
|
| + bool BeginFrameNeededByImplThread() const;
|
| bool BeginFrameNeededToDrawByImplThread() const;
|
| bool ProactiveBeginFrameWantedByImplThread() const;
|
|
|
| // Indicates that the system has entered and left a BeginFrame callback.
|
| // The scheduler will not draw more than once in a given BeginFrame
|
| // callback nor send more than one BeginFrame message.
|
| - void DidEnterBeginFrame(const BeginFrameArgs& args);
|
| - void DidLeaveBeginFrame();
|
| - bool inside_begin_frame() const { return inside_begin_frame_; }
|
| + void OnBeginFrame(const BeginFrameArgs& args);
|
| + void OnBeginFrameDeadline();
|
| + bool ShouldTriggerBeginFrameDeadlineEarly() const;
|
| + bool InsideBeginFrame() const;
|
|
|
| // Indicates whether the LayerTreeHostImpl is visible.
|
| void SetVisible(bool visible);
|
| @@ -127,13 +142,13 @@ class CC_EXPORT SchedulerStateMachine {
|
| // Indicates that a redraw is required, either due to the impl tree changing
|
| // or the screen being damaged and simply needing redisplay.
|
| void SetNeedsRedraw();
|
| + bool needs_redraw() const { return needs_redraw_; }
|
|
|
| // Indicates that a redraw is required because we are currently rendering
|
| // with a low resolution or checkerboarded tile.
|
| void DidSwapUseIncompleteTile();
|
|
|
| - // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen or
|
| - // not.
|
| + // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen.
|
| void DidDrawIfPossibleCompleted(bool success);
|
|
|
| // Indicates that a new commit flow needs to be performed, either to pull
|
| @@ -202,9 +217,11 @@ class CC_EXPORT SchedulerStateMachine {
|
| bool ShouldCommit() const;
|
|
|
| bool HasDrawnThisFrame() const;
|
| + bool HasDrawnThisDrawAttempt() const;
|
| bool HasActivatedPendingTreeThisFrame() const;
|
| - bool HasUpdatedVisibleTilesThisFrame() const;
|
| + bool HasUpdatedVisibleTilesThisDrawAttempt() const;
|
| bool HasSentBeginFrameToMainThreadThisFrame() const;
|
| + bool HasActivatedPendingTreeThisDrawAttempt() const;
|
|
|
| void UpdateStateOnCommit(bool commit_was_aborted);
|
| void UpdateStateOnActivation();
|
| @@ -213,24 +230,31 @@ class CC_EXPORT SchedulerStateMachine {
|
| const SchedulerSettings settings_;
|
|
|
| OutputSurfaceState output_surface_state_;
|
| + BeginFrameState begin_frame_state_;
|
| CommitState commit_state_;
|
| TextureState texture_state_;
|
| ForcedRedrawOnTimeoutState forced_redraw_state_;
|
| SynchronousReadbackState readback_state_;
|
|
|
| + BeginFrameArgs last_begin_frame_args_;
|
| +
|
| int commit_count_;
|
| - int current_frame_number_;
|
| - int last_frame_number_where_begin_frame_sent_to_main_thread_;
|
| - int last_frame_number_swap_performed_;
|
| - int last_frame_number_where_update_visible_tiles_was_called_;
|
| + int begin_frame_count_;
|
| + int draw_attempt_count_;
|
| + int last_begin_frame_count_swap_performed_;
|
| + int last_draw_attempt_count_draw_was_called_;
|
| + int last_begin_frame_count_begin_frame_sent_to_main_thread_;
|
| + int last_draw_attempt_count_tree_activation_attempted_;
|
| + int last_draw_attempt_count_completed_tile_uploads_checked_;
|
| + int last_draw_attempt_count_update_visible_tiles_was_called_;
|
| +
|
| int consecutive_failed_draws_;
|
| int maximum_number_of_failed_draws_before_draw_is_forced_;
|
| +
|
| bool needs_redraw_;
|
| bool swap_used_incomplete_tile_;
|
| bool needs_commit_;
|
| bool main_thread_needs_layer_textures_;
|
| - bool inside_begin_frame_;
|
| - BeginFrameArgs last_begin_frame_args_;
|
| bool visible_;
|
| bool can_start_;
|
| bool can_draw_;
|
|
|