Chromium Code Reviews| Index: cc/scheduler/scheduler_state_machine.cc |
| diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc |
| index 94016f3d5eb297c62ec496543749905254c4eba9..2cb2311f6de364d544c059a81d73c62126390224 100644 |
| --- a/cc/scheduler/scheduler_state_machine.cc |
| +++ b/cc/scheduler/scheduler_state_machine.cc |
| @@ -49,7 +49,8 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) |
| skip_next_begin_main_frame_to_reduce_latency_(false), |
| skip_begin_main_frame_to_reduce_latency_(false), |
| continuous_painting_(false), |
| - impl_latency_takes_priority_on_battery_(false) { |
| + impl_latency_takes_priority_on_battery_(false), |
| + defer_commits_(false) { |
| } |
| const char* SchedulerStateMachine::OutputSurfaceStateToString( |
| @@ -241,6 +242,7 @@ void SchedulerStateMachine::AsValueInto(base::debug::TracedValue* state, |
| state->SetBoolean("continuous_painting", continuous_painting_); |
| state->SetBoolean("impl_latency_takes_priority_on_battery", |
| impl_latency_takes_priority_on_battery_); |
| + state->SetBoolean("defer_commits", defer_commits_); |
| state->EndDictionary(); |
| } |
| @@ -442,6 +444,10 @@ bool SchedulerStateMachine::CouldSendBeginMainFrame() const { |
| if (!visible_) |
| return false; |
| + // We do not need new commits if it is deferred. |
| + if (defer_commits_) |
| + return false; |
| + |
| return true; |
| } |
| @@ -754,6 +760,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 { |
| @@ -762,6 +772,10 @@ bool SchedulerStateMachine::BeginFrameNeededToAnimateOrDraw() const { |
| if (!HasInitializedOutputSurface()) |
| return false; |
| + // New BeginFrame should not be triggered during the commit is deferred. |
| + if (defer_commits_) |
|
danakj
2014/11/19 16:31:33
Why is the ShouldSendBeginMainFrame() change not e
brianderson
2014/11/19 19:55:07
Agree that this check isn't needed. Deferring comm
simonhong
2014/11/26 15:52:53
Yep, I think you're right.
Deferring commit should
|
| + 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) |
| @@ -790,6 +804,10 @@ bool SchedulerStateMachine::ProactiveBeginFrameWanted() const { |
| if (!visible_) |
| return false; |
| + // New BeginFrame should not be triggered during the commit is deferred. |
|
danakj
2014/11/19 16:31:33
ditto?
brianderson
2014/11/19 19:55:07
ditto.
simonhong
2014/11/26 15:52:53
Done.
|
| + 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) |