| Index: cc/scheduler/scheduler_state_machine.h
|
| diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h
|
| index 39f9faa23d1713ada6b7189753912053da658577..f568665d293903f8124e611db4fb10bc8d4042e7 100644
|
| --- a/cc/scheduler/scheduler_state_machine.h
|
| +++ b/cc/scheduler/scheduler_state_machine.h
|
| @@ -50,10 +50,10 @@
|
| };
|
| static const char* OutputSurfaceStateToString(OutputSurfaceState state);
|
|
|
| - // Note: BeginImplFrameState does not cycle through these states in a fixed
|
| - // order on all platforms. It's up to the scheduler to set these correctly.
|
| - // TODO(sunnyps): Rename the states to IDLE, ANIMATE, WAITING_FOR_DEADLINE and
|
| - // DRAW.
|
| + // Note: BeginImplFrameState 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_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME and try to draw in
|
| + // BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE
|
| enum BeginImplFrameState {
|
| BEGIN_IMPL_FRAME_STATE_IDLE,
|
| BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING,
|
| @@ -63,7 +63,6 @@
|
| static const char* BeginImplFrameStateToString(BeginImplFrameState state);
|
|
|
| enum BeginImplFrameDeadlineMode {
|
| - BEGIN_IMPL_FRAME_DEADLINE_MODE_NONE,
|
| BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE,
|
| BEGIN_IMPL_FRAME_DEADLINE_MODE_REGULAR,
|
| BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE,
|
| @@ -112,7 +111,6 @@
|
| ACTION_DRAW_AND_SWAP_ABORT,
|
| ACTION_BEGIN_OUTPUT_SURFACE_CREATION,
|
| ACTION_PREPARE_TILES,
|
| - ACTION_INVALIDATE_OUTPUT_SURFACE,
|
| };
|
| static const char* ActionToString(Action action);
|
|
|
| @@ -125,15 +123,18 @@
|
| // Indicates whether the impl thread needs a BeginImplFrame callback in order
|
| // to make progress.
|
| bool BeginFrameNeeded() const;
|
| +
|
| + // Indicates that we need to independently poll for new state and actions
|
| + // because we can't expect a BeginImplFrame. This is mostly used to avoid
|
| + // drawing repeat frames with the synchronous compositor without dropping
|
| + // necessary actions on the floor.
|
| + bool ShouldPollForAnticipatedDrawTriggers() const;
|
|
|
| // Indicates that the system has entered and left a BeginImplFrame callback.
|
| // The scheduler will not draw more than once in a given BeginImplFrame
|
| // callback nor send more than one BeginMainFrame message.
|
| void OnBeginImplFrame();
|
| void OnBeginImplFrameDeadlinePending();
|
| - // Indicates that the scheduler has entered the draw phase. The scheduler
|
| - // will not draw more than once in a single draw phase.
|
| - // TODO(sunnyps): Rename OnBeginImplFrameDeadline to OnDraw or similar.
|
| void OnBeginImplFrameDeadline();
|
| void OnBeginImplFrameIdle();
|
| BeginImplFrameState begin_impl_frame_state() const {
|
| @@ -144,6 +145,15 @@
|
| // If the main thread didn't manage to produce a new frame in time for the
|
| // impl thread to draw, it is in a high latency mode.
|
| bool MainThreadIsInHighLatencyMode() const;
|
| +
|
| + // PollForAnticipatedDrawTriggers is used by the synchronous compositor to
|
| + // avoid requesting BeginImplFrames when we won't actually draw but still
|
| + // need to advance our state at vsync intervals.
|
| + void DidEnterPollForAnticipatedDrawTriggers();
|
| + void DidLeavePollForAnticipatedDrawTriggers();
|
| + bool inside_poll_for_anticipated_draw_triggers() const {
|
| + return inside_poll_for_anticipated_draw_triggers_;
|
| + }
|
|
|
| // Indicates whether the LayerTreeHostImpl is visible.
|
| void SetVisible(bool visible);
|
| @@ -236,6 +246,8 @@
|
|
|
| // True if we need to abort draws to make forward progress.
|
| bool PendingDrawsShouldBeAborted() const;
|
| +
|
| + bool SupportsProactiveBeginFrame() const;
|
|
|
| void SetContinuousPainting(bool continuous_painting) {
|
| continuous_painting_ = continuous_painting;
|
| @@ -271,16 +283,13 @@
|
| bool ShouldSendBeginMainFrame() const;
|
| bool ShouldCommit() const;
|
| bool ShouldPrepareTiles() const;
|
| - bool ShouldInvalidateOutputSurface() const;
|
| -
|
| - void UpdateStateOnAnimate();
|
| - void UpdateStateOnSendBeginMainFrame();
|
| +
|
| + void AdvanceCurrentFrameNumber();
|
| +
|
| void UpdateStateOnCommit(bool commit_had_no_updates);
|
| void UpdateStateOnActivation();
|
| void UpdateStateOnDraw(bool did_request_swap);
|
| - void UpdateStateOnBeginOutputSurfaceCreation();
|
| void UpdateStateOnPrepareTiles();
|
| - void UpdateStateOnInvalidateOutputSurface();
|
|
|
| const SchedulerSettings settings_;
|
|
|
| @@ -296,14 +305,13 @@
|
| int last_frame_number_swap_performed_;
|
| int last_frame_number_swap_requested_;
|
| int last_frame_number_begin_main_frame_sent_;
|
| - int last_frame_number_invalidate_output_surface_performed_;
|
|
|
| // These are used to ensure that an action only happens once per frame,
|
| // deadline, etc.
|
| bool animate_funnel_;
|
| + bool perform_swap_funnel_;
|
| bool request_swap_funnel_;
|
| bool send_begin_main_frame_funnel_;
|
| - bool invalidate_output_surface_funnel_;
|
| // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called
|
| // and "drained" on each BeginImplFrame. If the funnel gets too full,
|
| // we start throttling ACTION_PREPARE_TILES such that we average one
|
| @@ -317,6 +325,7 @@
|
| bool needs_animate_;
|
| bool needs_prepare_tiles_;
|
| bool needs_commit_;
|
| + bool inside_poll_for_anticipated_draw_triggers_;
|
| bool visible_;
|
| bool can_start_;
|
| bool can_draw_;
|
| @@ -332,8 +341,6 @@
|
| bool defer_commits_;
|
| bool last_commit_had_no_updates_;
|
| bool wait_for_active_tree_ready_to_draw_;
|
| - bool did_request_swap_in_last_frame_;
|
| - bool did_perform_swap_in_last_draw_;
|
|
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);
|
|
|