OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/scheduler/scheduler.h" | 5 #include "cc/scheduler/scheduler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 base::Bind(&Scheduler::ProcessScheduledActions, | 202 base::Bind(&Scheduler::ProcessScheduledActions, |
203 base::Unretained(this))); | 203 base::Unretained(this))); |
204 } else { | 204 } else { |
205 advance_commit_state_timer_.Stop(); | 205 advance_commit_state_timer_.Stop(); |
206 } | 206 } |
207 } | 207 } |
208 } | 208 } |
209 | 209 |
210 void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { | 210 void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { |
211 TRACE_EVENT0("cc", "Scheduler::BeginImplFrame"); | 211 TRACE_EVENT0("cc", "Scheduler::BeginImplFrame"); |
212 DCHECK(state_machine_.begin_impl_frame_state() == | 212 DCHECK_EQ(state_machine_.begin_impl_frame_state(), |
213 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | 213 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); |
214 DCHECK(state_machine_.HasInitializedOutputSurface()); | 214 DCHECK(state_machine_.HasInitializedOutputSurface()); |
215 last_begin_impl_frame_args_ = args; | 215 last_begin_impl_frame_args_ = args; |
216 last_begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate(); | 216 last_begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate(); |
217 state_machine_.OnBeginImplFrame(last_begin_impl_frame_args_); | 217 state_machine_.OnBeginImplFrame(last_begin_impl_frame_args_); |
218 devtools_instrumentation::DidBeginFrame(layer_tree_host_id_); | 218 devtools_instrumentation::DidBeginFrame(layer_tree_host_id_); |
219 | 219 |
220 if (settings_.switch_to_low_latency_if_possible) { | 220 if (settings_.switch_to_low_latency_if_possible) { |
221 state_machine_.SetSkipBeginMainFrameToReduceLatency( | 221 state_machine_.SetSkipBeginMainFrameToReduceLatency( |
222 state_machine_.MainThreadIsInHighLatencyMode() && | 222 state_machine_.MainThreadIsInHighLatencyMode() && |
223 CanCommitAndActivateBeforeDeadline()); | 223 CanCommitAndActivateBeforeDeadline()); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 // impl thread's deadline. | 386 // impl thread's deadline. |
387 base::TimeTicks estimated_draw_time = | 387 base::TimeTicks estimated_draw_time = |
388 last_begin_impl_frame_args_.frame_time + | 388 last_begin_impl_frame_args_.frame_time + |
389 client_->BeginMainFrameToCommitDurationEstimate() + | 389 client_->BeginMainFrameToCommitDurationEstimate() + |
390 client_->CommitToActivateDurationEstimate(); | 390 client_->CommitToActivateDurationEstimate(); |
391 | 391 |
392 return estimated_draw_time < last_begin_impl_frame_args_.deadline; | 392 return estimated_draw_time < last_begin_impl_frame_args_.deadline; |
393 } | 393 } |
394 | 394 |
395 } // namespace cc | 395 } // namespace cc |
OLD | NEW |