| Index: cc/scheduler/scheduler.cc
|
| diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
|
| index 93b91311e6e94c9f821ad8753cbe56d40d6b27b4..868df6eddcaffa1afd3c5e153f4d0c9d3249456c 100644
|
| --- a/cc/scheduler/scheduler.cc
|
| +++ b/cc/scheduler/scheduler.cc
|
| @@ -184,6 +184,12 @@ void Scheduler::BeginImplFrame(const BeginFrameArgs& args) {
|
| last_begin_impl_frame_args_ = args;
|
| last_begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate();
|
| state_machine_.OnBeginImplFrame(last_begin_impl_frame_args_);
|
| +
|
| + if (settings_.switch_to_low_latency_if_possible) {
|
| + state_machine_.SetSkipBeginMainFrameToReduceLatency(
|
| + state_machine_.InHighLatencyMode() && CanOperateInLowLatencyMode());
|
| + }
|
| +
|
| ProcessScheduledActions();
|
|
|
| if (!state_machine_.HasInitializedOutputSurface())
|
| @@ -344,4 +350,15 @@ bool Scheduler::WillDrawIfNeeded() const {
|
| return !state_machine_.PendingDrawsShouldBeAborted();
|
| }
|
|
|
| +bool Scheduler::CanOperateInLowLatencyMode() const {
|
| + // If the main thread computation and commit can be finished before the
|
| + // deadline we can operate in low latency mode.
|
| + base::TimeTicks estimated_draw_time =
|
| + last_begin_impl_frame_args_.frame_time +
|
| + client_->BeginMainFrameToCommitDurationEstimate() +
|
| + client_->CommitToActivateDurationEstimate();
|
| +
|
| + return estimated_draw_time < last_begin_impl_frame_args_.deadline;
|
| +}
|
| +
|
| } // namespace cc
|
|
|