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

Unified Diff: cc/scheduler/scheduler_state_machine.h

Issue 817603002: cc: Make scheduling be driven by vsync for android webview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
Index: cc/scheduler/scheduler_state_machine.h
diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h
index 7ee039aee056e7fac0346232fee8843d897ed21e..3cc49cbece3fe60bc3afbe60da4bca309c916021 100644
--- a/cc/scheduler/scheduler_state_machine.h
+++ b/cc/scheduler/scheduler_state_machine.h
@@ -63,7 +63,8 @@ class CC_EXPORT SchedulerStateMachine {
static const char* BeginImplFrameStateToString(BeginImplFrameState state);
enum BeginImplFrameDeadlineMode {
- BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE,
+ BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE_SYNCHRONOUS,
+ BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE_ASYNCHRONOUS,
BEGIN_IMPL_FRAME_DEADLINE_MODE_REGULAR,
BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE,
};
@@ -110,6 +111,7 @@ class CC_EXPORT SchedulerStateMachine {
ACTION_DRAW_AND_SWAP_ABORT,
ACTION_BEGIN_OUTPUT_SURFACE_CREATION,
ACTION_PREPARE_TILES,
+ ACTION_INVALIDATE_OUTPUT_SURFACE,
};
static const char* ActionToString(Action action);
@@ -123,12 +125,6 @@ class CC_EXPORT SchedulerStateMachine {
// 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.
@@ -145,15 +141,6 @@ class CC_EXPORT SchedulerStateMachine {
// 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);
@@ -162,6 +149,8 @@ class CC_EXPORT SchedulerStateMachine {
void SetNeedsRedraw();
bool needs_redraw() const { return needs_redraw_; }
+ void OutputSurfaceDidRequestDraw();
+
void SetNeedsAnimate();
bool needs_animate() const { return needs_animate_; }
@@ -238,8 +227,6 @@ class CC_EXPORT SchedulerStateMachine {
// 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;
}
@@ -279,12 +266,14 @@ class CC_EXPORT SchedulerStateMachine {
bool ShouldSendBeginMainFrame() const;
bool ShouldCommit() const;
bool ShouldPrepareTiles() const;
+ bool ShouldInvalidateOutputSurface() const;
void AdvanceCurrentFrameNumber();
bool HasAnimatedThisFrame() const;
bool HasSentBeginMainFrameThisFrame() const;
bool HasRequestedSwapThisFrame() const;
bool HasSwappedThisFrame() const;
+ bool HasInvalidatedOutputSurfaceThisFrame() const;
void UpdateStateOnCommit(bool commit_was_aborted);
void UpdateStateOnActivation();
@@ -306,6 +295,7 @@ class CC_EXPORT SchedulerStateMachine {
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_;
// prepare_tiles_funnel_ is "filled" each time PrepareTiles is called
// and "drained" on each BeginImplFrame. If the funnel gets too full,
@@ -319,7 +309,6 @@ class CC_EXPORT SchedulerStateMachine {
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_;
@@ -334,6 +323,7 @@ class CC_EXPORT SchedulerStateMachine {
bool continuous_painting_;
bool impl_latency_takes_priority_on_battery_;
bool children_need_begin_frames_;
+ bool output_surface_did_request_draw_;
private:
DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);

Powered by Google App Engine
This is Rietveld 408576698