| Index: cc/scheduler/scheduler_state_machine.h
|
| diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h
|
| index 325ac1cd35a264a392ef802fb491fac0932135b6..72928d54557f8ad42544d23be02ed7480a1f6485 100644
|
| --- a/cc/scheduler/scheduler_state_machine.h
|
| +++ b/cc/scheduler/scheduler_state_machine.h
|
| @@ -31,10 +31,22 @@ class CC_EXPORT SchedulerStateMachine {
|
| // settings must be valid for the lifetime of this class.
|
| explicit SchedulerStateMachine(const SchedulerSettings& settings);
|
|
|
| + // 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,
|
| + };
|
| +
|
| enum CommitState {
|
| COMMIT_STATE_IDLE,
|
| COMMIT_STATE_FRAME_IN_PROGRESS,
|
| COMMIT_STATE_READY_TO_COMMIT,
|
| + COMMIT_STATE_WAITING_FOR_ACTIVATION,
|
| COMMIT_STATE_WAITING_FOR_FIRST_DRAW,
|
| COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW,
|
| };
|
| @@ -80,9 +92,10 @@ class CC_EXPORT SchedulerStateMachine {
|
| // Indicates that the system has entered and left a BeginFrame callback.
|
| // The scheduler will not draw more than once in a given BeginFrame
|
| // callback.
|
| - 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);
|
| @@ -135,14 +148,15 @@ class CC_EXPORT SchedulerStateMachine {
|
| // Indicates whether drawing would, at this time, make sense.
|
| // CanDraw can be used to supress flashes or checkerboarding
|
| // when such behavior would be undesirable.
|
| - void SetCanDraw(bool can);
|
| + void SetCanDraw(bool can_draw);
|
|
|
| - // Indicates whether or not there is a pending tree. This influences
|
| - // whether or not we can succesfully commit at this time. If the
|
| + // Indicates whether or not there is a pending tree (which may be null)
|
| + // and whether the active tree is null or not. This
|
| + // influences whether or not we can succesfully commit at this time. If the
|
| // last commit is still being processed (but not blocking), it may not
|
| // be possible to take another commit yet. This overrides force commit,
|
| // as a commit is already still in flight.
|
| - void SetHasPendingTree(bool has_pending_tree);
|
| + void SetHasTrees(bool has_pending_tree, bool active_tree_is_null);
|
| bool has_pending_tree() const { return has_pending_tree_; }
|
|
|
| void DidLoseOutputSurface();
|
| @@ -161,23 +175,30 @@ class CC_EXPORT SchedulerStateMachine {
|
| protected:
|
| bool ShouldDrawForced() const;
|
| bool ScheduledToDraw() const;
|
| + bool WillDrawNewTree() const;
|
| bool ShouldDraw() const;
|
| + bool ShouldDrawInternal(BeginFrameState begin_frame_state) const;
|
| bool ShouldAttemptTreeActivation() const;
|
| bool ShouldAcquireLayerTexturesForMainThread() const;
|
| bool ShouldCheckForCompletedTileUploads() const;
|
| + bool ShouldSendBeginFrameToMainThread() const;
|
| bool HasDrawnThisFrame() const;
|
| - bool HasAttemptedTreeActivationThisFrame() const;
|
| - bool HasCheckedForCompletedTileUploadsThisFrame() const;
|
| + bool HasAttemptedTreeActivationThisDrawAttempt() const;
|
| + bool HasCheckedForCompletedTileUploadsThisDrawAttempt() const;
|
| + bool HasSentBeginFrameToMainThreadThisFrame() const;
|
|
|
| const SchedulerSettings settings_;
|
|
|
| CommitState commit_state_;
|
| int commit_count_;
|
|
|
| - int current_frame_number_;
|
| - int last_frame_number_where_draw_was_called_;
|
| - int last_frame_number_where_tree_activation_attempted_;
|
| - int last_frame_number_where_check_for_completed_tile_uploads_called_;
|
| + int begin_frame_count_;
|
| + int begin_frame_deadline_count_;
|
| + int draw_attempt_count_;
|
| + int last_begin_frame_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 consecutive_failed_draws_;
|
| int maximum_number_of_failed_draws_before_draw_is_forced_;
|
| bool needs_redraw_;
|
| @@ -188,7 +209,9 @@ class CC_EXPORT SchedulerStateMachine {
|
| bool needs_forced_commit_;
|
| bool expect_immediate_begin_frame_for_main_thread_;
|
| bool main_thread_needs_layer_textures_;
|
| - bool inside_begin_frame_;
|
| + BeginFrameState begin_frame_state_;
|
| + bool commit_tree_has_been_drawn_;
|
| + bool active_tree_has_been_drawn_;
|
| BeginFrameArgs last_begin_frame_args_;
|
| bool visible_;
|
| bool can_start_;
|
|
|