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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 209 } |
210 | 210 |
211 void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { | 211 void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { |
212 TRACE_EVENT0("cc", "Scheduler::BeginImplFrame"); | 212 TRACE_EVENT0("cc", "Scheduler::BeginImplFrame"); |
213 DCHECK(state_machine_.begin_impl_frame_state() == | 213 DCHECK(state_machine_.begin_impl_frame_state() == |
214 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | 214 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); |
215 DCHECK(state_machine_.HasInitializedOutputSurface()); | 215 DCHECK(state_machine_.HasInitializedOutputSurface()); |
216 last_begin_impl_frame_args_ = args; | 216 last_begin_impl_frame_args_ = args; |
217 last_begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate(); | 217 last_begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate(); |
218 state_machine_.OnBeginImplFrame(last_begin_impl_frame_args_); | 218 state_machine_.OnBeginImplFrame(last_begin_impl_frame_args_); |
| 219 devtools_instrumentation::didBeginFrame(layer_tree_host_id_); |
219 | 220 |
220 if (settings_.switch_to_low_latency_if_possible) { | 221 if (settings_.switch_to_low_latency_if_possible) { |
221 state_machine_.SetSkipBeginMainFrameToReduceLatency( | 222 state_machine_.SetSkipBeginMainFrameToReduceLatency( |
222 state_machine_.MainThreadIsInHighLatencyMode() && | 223 state_machine_.MainThreadIsInHighLatencyMode() && |
223 CanCommitAndActivateBeforeDeadline()); | 224 CanCommitAndActivateBeforeDeadline()); |
224 } | 225 } |
225 | 226 |
226 ProcessScheduledActions(); | 227 ProcessScheduledActions(); |
227 | 228 |
228 if (!state_machine_.HasInitializedOutputSurface()) | 229 if (!state_machine_.HasInitializedOutputSurface()) |
229 return; | 230 return; |
230 | 231 |
231 state_machine_.OnBeginImplFrameDeadlinePending(); | 232 state_machine_.OnBeginImplFrameDeadlinePending(); |
232 devtools_instrumentation::didBeginFrame(layer_tree_host_id_); | |
233 if (settings_.using_synchronous_renderer_compositor) { | 233 if (settings_.using_synchronous_renderer_compositor) { |
234 // The synchronous renderer compositor has to make its GL calls | 234 // The synchronous renderer compositor has to make its GL calls |
235 // within this call to BeginImplFrame. | 235 // within this call to BeginImplFrame. |
236 // TODO(brianderson): Have the OutputSurface initiate the deadline tasks | 236 // TODO(brianderson): Have the OutputSurface initiate the deadline tasks |
237 // so the sychronous renderer compositor can take advantage of splitting | 237 // so the sychronous renderer compositor can take advantage of splitting |
238 // up the BeginImplFrame and deadline as well. | 238 // up the BeginImplFrame and deadline as well. |
239 OnBeginImplFrameDeadline(); | 239 OnBeginImplFrameDeadline(); |
240 } else if (!settings_.deadline_scheduling_enabled) { | 240 } else if (!settings_.deadline_scheduling_enabled) { |
241 // We emulate the old non-deadline scheduler here by posting the | 241 // We emulate the old non-deadline scheduler here by posting the |
242 // deadline task without any delay. | 242 // deadline task without any delay. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // impl thread's deadline. | 387 // impl thread's deadline. |
388 base::TimeTicks estimated_draw_time = | 388 base::TimeTicks estimated_draw_time = |
389 last_begin_impl_frame_args_.frame_time + | 389 last_begin_impl_frame_args_.frame_time + |
390 client_->BeginMainFrameToCommitDurationEstimate() + | 390 client_->BeginMainFrameToCommitDurationEstimate() + |
391 client_->CommitToActivateDurationEstimate(); | 391 client_->CommitToActivateDurationEstimate(); |
392 | 392 |
393 return estimated_draw_time < last_begin_impl_frame_args_.deadline; | 393 return estimated_draw_time < last_begin_impl_frame_args_.deadline; |
394 } | 394 } |
395 | 395 |
396 } // namespace cc | 396 } // namespace cc |
OLD | NEW |