Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3265)

Unified Diff: cc/scheduler/scheduler_state_machine.h

Issue 1055743002: Revert of cc: Make scheduling be driven by vsync for android webview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/scheduler/scheduler_state_machine.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/scheduler_state_machine.h
diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h
index 0901ca874ddeb6549ea64d8912eb67978ced3e60..3914039004dc60540f49417b76963585b07a62e4 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,
@@ -111,7 +110,6 @@
ACTION_DRAW_AND_SWAP_ABORT,
ACTION_BEGIN_OUTPUT_SURFACE_CREATION,
ACTION_PREPARE_TILES,
- ACTION_INVALIDATE_OUTPUT_SURFACE,
};
static const char* ActionToString(Action action);
@@ -124,15 +122,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 {
@@ -143,6 +144,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);
@@ -229,6 +239,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;
@@ -264,16 +276,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_;
@@ -289,14 +298,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
@@ -310,6 +318,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_;
@@ -324,8 +333,6 @@
bool children_need_begin_frames_;
bool defer_commits_;
bool last_commit_had_no_updates_;
- bool did_request_swap_in_last_frame_;
- bool did_perform_swap_in_last_draw_;
private:
DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/scheduler/scheduler_state_machine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698