Index: cc/scheduler/scheduler_state_machine.cc |
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc |
index dea25b40871b440405ed48ea51300224770c26cb..7f97aa016bd59189b721d6dc54fd55e6d5f41878 100644 |
--- a/cc/scheduler/scheduler_state_machine.cc |
+++ b/cc/scheduler/scheduler_state_machine.cc |
@@ -46,7 +46,8 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) |
smoothness_takes_priority_(false), |
skip_next_begin_main_frame_to_reduce_latency_(false), |
skip_begin_main_frame_to_reduce_latency_(false), |
- continuous_painting_(false) { |
+ continuous_painting_(false), |
+ defer_commits_(false) { |
} |
const char* SchedulerStateMachine::OutputSurfaceStateToString( |
@@ -236,6 +237,7 @@ scoped_ptr<base::Value> SchedulerStateMachine::AsValue() const { |
minor_state->SetBoolean("skip_next_begin_main_frame_to_reduce_latency", |
skip_next_begin_main_frame_to_reduce_latency_); |
minor_state->SetBoolean("continuous_painting", continuous_painting_); |
+ minor_state->SetBoolean("defer_commits", defer_commits_); |
state->Set("minor_state", minor_state.release()); |
return state.PassAs<base::Value>(); |
@@ -438,6 +440,10 @@ bool SchedulerStateMachine::ShouldSendBeginMainFrame() const { |
if (!visible_) |
return false; |
+ // We do not need commits if commits are deferred. |
+ if (defer_commits_) |
+ return false; |
+ |
// We want to start the first commit after we get a new output surface ASAP. |
if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT) |
return true; |
@@ -734,6 +740,10 @@ bool SchedulerStateMachine::SupportsProactiveBeginFrame() const { |
return !settings_.using_synchronous_renderer_compositor; |
} |
+void SchedulerStateMachine::SetDeferCommits(bool defer_commits) { |
+ defer_commits_ = defer_commits; |
+} |
+ |
// These are the cases where we definitely (or almost definitely) have a |
// new frame to animate and/or draw and can draw. |
bool SchedulerStateMachine::BeginFrameNeededToAnimateOrDraw() const { |
@@ -746,6 +756,10 @@ bool SchedulerStateMachine::BeginFrameNeededToAnimateOrDraw() const { |
if (!can_draw_) |
return false; |
+ // New BeginFrame should not be triggered when we need to defer commits. |
+ if (defer_commits_) |
+ return false; |
+ |
// The forced draw respects our normal draw scheduling, so we need to |
// request a BeginImplFrame for it. |
if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) |
@@ -781,6 +795,10 @@ bool SchedulerStateMachine::ProactiveBeginFrameWanted() const { |
if (!visible_) |
return false; |
+ // New BeginFrame should not be triggered when we need to defer commits. |
+ if (defer_commits_) |
+ return false; |
+ |
// We should proactively request a BeginImplFrame if a commit is pending |
// because we will want to draw if the commit completes quickly. |
if (needs_commit_ || commit_state_ != COMMIT_STATE_IDLE) |