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" |
11 #include "cc/debug/devtools_instrumentation.h" | 11 #include "cc/debug/devtools_instrumentation.h" |
12 #include "cc/debug/traced_value.h" | 12 #include "cc/debug/traced_value.h" |
13 #include "ui/gfx/frame_time.h" | 13 #include "ui/gfx/frame_time.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 Scheduler::Scheduler( | 17 Scheduler::Scheduler( |
18 SchedulerClient* client, | 18 SchedulerClient* client, |
19 const SchedulerSettings& scheduler_settings, | 19 const SchedulerSettings& scheduler_settings, |
20 int layer_tree_host_id, | 20 int layer_tree_host_id, |
21 const scoped_refptr<base::SequencedTaskRunner>& impl_task_runner) | 21 const scoped_refptr<base::SequencedTaskRunner>& impl_task_runner) |
22 : settings_(scheduler_settings), | 22 : settings_(scheduler_settings), |
23 client_(client), | 23 client_(client), |
24 layer_tree_host_id_(layer_tree_host_id), | 24 layer_tree_host_id_(layer_tree_host_id), |
25 impl_task_runner_(impl_task_runner), | 25 impl_task_runner_(impl_task_runner), |
26 last_set_needs_begin_impl_frame_(false), | 26 last_set_needs_begin_frame_(false), |
27 begin_retro_frame_posted_(false), | |
27 state_machine_(scheduler_settings), | 28 state_machine_(scheduler_settings), |
28 inside_process_scheduled_actions_(false), | 29 inside_process_scheduled_actions_(false), |
29 inside_action_(SchedulerStateMachine::ACTION_NONE), | 30 inside_action_(SchedulerStateMachine::ACTION_NONE), |
30 weak_factory_(this) { | 31 weak_factory_(this) { |
31 DCHECK(client_); | 32 DCHECK(client_); |
32 DCHECK(!state_machine_.BeginImplFrameNeeded()); | 33 DCHECK(!state_machine_.BeginFrameNeeded()); |
33 if (settings_.main_frame_before_activation_enabled) { | 34 if (settings_.main_frame_before_activation_enabled) { |
34 DCHECK(settings_.main_frame_before_draw_enabled); | 35 DCHECK(settings_.main_frame_before_draw_enabled); |
35 } | 36 } |
36 } | 37 } |
37 | 38 |
38 Scheduler::~Scheduler() {} | 39 Scheduler::~Scheduler() {} |
39 | 40 |
40 void Scheduler::SetCanStart() { | 41 void Scheduler::SetCanStart() { |
41 state_machine_.SetCanStart(); | 42 state_machine_.SetCanStart(); |
42 ProcessScheduledActions(); | 43 ProcessScheduledActions(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 ProcessScheduledActions(); | 110 ProcessScheduledActions(); |
110 } | 111 } |
111 | 112 |
112 void Scheduler::DidManageTiles() { | 113 void Scheduler::DidManageTiles() { |
113 state_machine_.DidManageTiles(); | 114 state_machine_.DidManageTiles(); |
114 } | 115 } |
115 | 116 |
116 void Scheduler::DidLoseOutputSurface() { | 117 void Scheduler::DidLoseOutputSurface() { |
117 TRACE_EVENT0("cc", "Scheduler::DidLoseOutputSurface"); | 118 TRACE_EVENT0("cc", "Scheduler::DidLoseOutputSurface"); |
118 state_machine_.DidLoseOutputSurface(); | 119 state_machine_.DidLoseOutputSurface(); |
119 last_set_needs_begin_impl_frame_ = false; | 120 last_set_needs_begin_frame_ = false; |
120 ProcessScheduledActions(); | 121 ProcessScheduledActions(); |
121 } | 122 } |
122 | 123 |
123 void Scheduler::DidCreateAndInitializeOutputSurface() { | 124 void Scheduler::DidCreateAndInitializeOutputSurface() { |
124 TRACE_EVENT0("cc", "Scheduler::DidCreateAndInitializeOutputSurface"); | 125 TRACE_EVENT0("cc", "Scheduler::DidCreateAndInitializeOutputSurface"); |
125 DCHECK(!last_set_needs_begin_impl_frame_); | 126 DCHECK(!last_set_needs_begin_frame_); |
126 DCHECK(begin_impl_frame_deadline_closure_.IsCancelled()); | 127 DCHECK(begin_impl_frame_deadline_closure_.IsCancelled()); |
127 state_machine_.DidCreateAndInitializeOutputSurface(); | 128 state_machine_.DidCreateAndInitializeOutputSurface(); |
128 ProcessScheduledActions(); | 129 ProcessScheduledActions(); |
129 } | 130 } |
130 | 131 |
131 void Scheduler::NotifyBeginMainFrameStarted() { | 132 void Scheduler::NotifyBeginMainFrameStarted() { |
132 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted"); | 133 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted"); |
133 state_machine_.NotifyBeginMainFrameStarted(); | 134 state_machine_.NotifyBeginMainFrameStarted(); |
134 } | 135 } |
135 | 136 |
136 base::TimeTicks Scheduler::AnticipatedDrawTime() const { | 137 base::TimeTicks Scheduler::AnticipatedDrawTime() const { |
137 if (!last_set_needs_begin_impl_frame_ || | 138 if (!last_set_needs_begin_frame_ || |
138 last_begin_impl_frame_args_.interval <= base::TimeDelta()) | 139 begin_impl_frame_args_.interval <= base::TimeDelta()) |
139 return base::TimeTicks(); | 140 return base::TimeTicks(); |
140 | 141 |
141 base::TimeTicks now = gfx::FrameTime::Now(); | 142 base::TimeTicks now = gfx::FrameTime::Now(); |
142 base::TimeTicks timebase = std::max(last_begin_impl_frame_args_.frame_time, | 143 base::TimeTicks timebase = std::max(begin_impl_frame_args_.frame_time, |
143 last_begin_impl_frame_args_.deadline); | 144 begin_impl_frame_args_.deadline); |
144 int64 intervals = | 145 int64 intervals = 1 + ((now - timebase) / begin_impl_frame_args_.interval); |
145 1 + ((now - timebase) / last_begin_impl_frame_args_.interval); | 146 return timebase + (begin_impl_frame_args_.interval * intervals); |
146 return timebase + (last_begin_impl_frame_args_.interval * intervals); | |
147 } | 147 } |
148 | 148 |
149 base::TimeTicks Scheduler::LastBeginImplFrameTime() { | 149 base::TimeTicks Scheduler::LastBeginImplFrameTime() { |
150 return last_begin_impl_frame_args_.frame_time; | 150 return begin_impl_frame_args_.frame_time; |
151 } | 151 } |
152 | 152 |
153 void Scheduler::SetupNextBeginImplFrameIfNeeded() { | 153 void Scheduler::SetupNextBeginFrameIfNeeded() { |
154 bool needs_begin_impl_frame = | 154 bool needs_begin_frame = state_machine_.BeginFrameNeeded(); |
155 state_machine_.BeginImplFrameNeeded(); | 155 if (needs_begin_frame != last_set_needs_begin_frame_) { |
156 client_->SetNeedsBeginFrame(needs_begin_frame); | |
157 last_set_needs_begin_frame_ = needs_begin_frame; | |
158 } | |
156 | 159 |
157 bool at_end_of_deadline = | 160 // Handle Retroactive BeginFrames |
Sami
2014/04/01 13:09:10
nit: Add '.'.
| |
158 state_machine_.begin_impl_frame_state() == | 161 if (state_machine_.begin_impl_frame_state() == |
159 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE; | 162 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE && |
160 | 163 begin_retro_frame_args_.IsValid()) { |
Sami
2014/04/01 13:09:10
Do we also need to check for needs_begin_frame?
brianderson
2014/04/01 19:12:53
That would be better, yes. I was thinking that we
brianderson
2014/04/02 04:15:57
Done.
| |
161 bool should_call_set_needs_begin_impl_frame = | 164 begin_retro_frame_posted_ = true; |
162 // Always request the BeginImplFrame immediately if it wasn't needed | 165 begin_frame_args_ = begin_retro_frame_args_; |
163 // before. | 166 begin_retro_frame_args_ = BeginFrameArgs(); |
164 (needs_begin_impl_frame && !last_set_needs_begin_impl_frame_) || | 167 impl_task_runner_->PostTask( |
165 // We always need to explicitly request our next BeginImplFrame. | 168 FROM_HERE, |
166 at_end_of_deadline; | 169 base::Bind(&Scheduler::BeginRetroFrame, weak_factory_.GetWeakPtr())); |
167 | |
168 if (should_call_set_needs_begin_impl_frame) { | |
169 client_->SetNeedsBeginImplFrame(needs_begin_impl_frame); | |
170 last_set_needs_begin_impl_frame_ = needs_begin_impl_frame; | |
171 } | 170 } |
172 | 171 |
173 bool needs_advance_commit_state_timer = false; | 172 bool needs_advance_commit_state_timer = false; |
174 // Setup PollForAnticipatedDrawTriggers if we need to monitor state but | 173 // Setup PollForAnticipatedDrawTriggers if we need to monitor state but |
175 // aren't expecting any more BeginImplFrames. This should only be needed by | 174 // aren't expecting any more BeginFrames. This should only be needed by |
176 // the synchronous compositor when BeginImplFrameNeeded is false. | 175 // the synchronous compositor when BeginFrameNeeded is false. |
177 if (state_machine_.ShouldPollForAnticipatedDrawTriggers()) { | 176 if (state_machine_.ShouldPollForAnticipatedDrawTriggers()) { |
178 DCHECK(!state_machine_.SupportsProactiveBeginImplFrame()); | 177 DCHECK(!state_machine_.SupportsProactiveBeginFrame()); |
179 DCHECK(!needs_begin_impl_frame); | 178 DCHECK(!needs_begin_frame); |
180 if (poll_for_draw_triggers_closure_.IsCancelled()) { | 179 if (poll_for_draw_triggers_closure_.IsCancelled()) { |
181 poll_for_draw_triggers_closure_.Reset( | 180 poll_for_draw_triggers_closure_.Reset( |
182 base::Bind(&Scheduler::PollForAnticipatedDrawTriggers, | 181 base::Bind(&Scheduler::PollForAnticipatedDrawTriggers, |
183 weak_factory_.GetWeakPtr())); | 182 weak_factory_.GetWeakPtr())); |
184 impl_task_runner_->PostDelayedTask( | 183 impl_task_runner_->PostDelayedTask( |
185 FROM_HERE, | 184 FROM_HERE, |
186 poll_for_draw_triggers_closure_.callback(), | 185 poll_for_draw_triggers_closure_.callback(), |
187 last_begin_impl_frame_args_.interval); | 186 begin_impl_frame_args_.interval); |
188 } | 187 } |
189 } else { | 188 } else { |
190 poll_for_draw_triggers_closure_.Cancel(); | 189 poll_for_draw_triggers_closure_.Cancel(); |
191 | 190 |
192 // At this point we'd prefer to advance through the commit flow by | 191 // At this point we'd prefer to advance through the commit flow by |
193 // drawing a frame, however it's possible that the frame rate controller | 192 // drawing a frame, however it's possible that the frame rate controller |
194 // will not give us a BeginImplFrame until the commit completes. See | 193 // will not give us a BeginFrame until the commit completes. See |
195 // crbug.com/317430 for an example of a swap ack being held on commit. Thus | 194 // crbug.com/317430 for an example of a swap ack being held on commit. Thus |
196 // we set a repeating timer to poll on ProcessScheduledActions until we | 195 // we set a repeating timer to poll on ProcessScheduledActions until we |
197 // successfully reach BeginImplFrame. Synchronous compositor does not use | 196 // successfully reach BeginFrame. Synchronous compositor does not use |
198 // frame rate controller or have the circular wait in the bug. | 197 // frame rate controller or have the circular wait in the bug. |
199 if (IsBeginMainFrameSentOrStarted() && | 198 if (IsBeginMainFrameSentOrStarted() && |
200 !settings_.using_synchronous_renderer_compositor) { | 199 !settings_.using_synchronous_renderer_compositor) { |
201 needs_advance_commit_state_timer = true; | 200 needs_advance_commit_state_timer = true; |
202 } | 201 } |
203 } | 202 } |
204 if (needs_advance_commit_state_timer != | 203 if (needs_advance_commit_state_timer != |
205 advance_commit_state_timer_.IsRunning()) { | 204 advance_commit_state_timer_.IsRunning()) { |
206 if (needs_advance_commit_state_timer && | 205 if (needs_advance_commit_state_timer && begin_impl_frame_args_.IsValid()) { |
207 last_begin_impl_frame_args_.IsValid()) { | |
208 // Since we'd rather get a BeginImplFrame by the normal mechanism, we | 206 // Since we'd rather get a BeginImplFrame by the normal mechanism, we |
209 // set the interval to twice the interval from the previous frame. | 207 // set the interval to twice the interval from the previous frame. |
210 advance_commit_state_timer_.Start( | 208 advance_commit_state_timer_.Start( |
211 FROM_HERE, | 209 FROM_HERE, |
212 last_begin_impl_frame_args_.interval * 2, | 210 begin_impl_frame_args_.interval * 2, |
213 base::Bind(&Scheduler::ProcessScheduledActions, | 211 base::Bind(&Scheduler::ProcessScheduledActions, |
214 base::Unretained(this))); | 212 base::Unretained(this))); |
215 } else { | 213 } else { |
216 advance_commit_state_timer_.Stop(); | 214 advance_commit_state_timer_.Stop(); |
217 } | 215 } |
218 } | 216 } |
219 } | 217 } |
220 | 218 |
221 void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { | 219 void Scheduler::BeginFrame(const BeginFrameArgs& args) { |
222 TRACE_EVENT0("cc", "Scheduler::BeginImplFrame"); | 220 if (!begin_retro_frame_posted_ && |
221 state_machine_.begin_impl_frame_state() == | |
222 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE) { | |
223 TRACE_EVENT0("cc", "Scheduler::BeginImplFrame"); | |
224 begin_frame_args_ = args; | |
225 BeginImplFrame(); | |
226 } else { | |
227 TRACE_EVENT0("cc", "Scheduler::BeginFrame deferred"); | |
228 begin_retro_frame_args_ = args; | |
229 } | |
230 } | |
231 | |
232 void Scheduler::BeginRetroFrame() { | |
233 TRACE_EVENT0("cc", "Scheduler::BeginRetroFrame"); | |
234 begin_retro_frame_posted_ = false; | |
235 BeginImplFrame(); | |
236 } | |
237 | |
238 void Scheduler::BeginImplFrame() { | |
223 DCHECK(state_machine_.begin_impl_frame_state() == | 239 DCHECK(state_machine_.begin_impl_frame_state() == |
224 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | 240 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); |
225 DCHECK(state_machine_.HasInitializedOutputSurface()); | 241 DCHECK(state_machine_.HasInitializedOutputSurface()); |
226 | 242 |
227 last_begin_impl_frame_args_ = args; | 243 begin_impl_frame_args_ = begin_frame_args_; |
228 last_begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate(); | 244 begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate(); |
229 | 245 |
230 if (!state_machine_.smoothness_takes_priority() && | 246 if (!state_machine_.smoothness_takes_priority() && |
231 state_machine_.MainThreadIsInHighLatencyMode() && | 247 state_machine_.MainThreadIsInHighLatencyMode() && |
232 CanCommitAndActivateBeforeDeadline()) { | 248 CanCommitAndActivateBeforeDeadline()) { |
233 state_machine_.SetSkipNextBeginMainFrameToReduceLatency(); | 249 state_machine_.SetSkipNextBeginMainFrameToReduceLatency(); |
234 } | 250 } |
235 | 251 |
236 state_machine_.OnBeginImplFrame(last_begin_impl_frame_args_); | 252 client_->OnBeginImplFrame(begin_impl_frame_args_); |
253 state_machine_.OnBeginImplFrame(begin_impl_frame_args_); | |
237 devtools_instrumentation::DidBeginFrame(layer_tree_host_id_); | 254 devtools_instrumentation::DidBeginFrame(layer_tree_host_id_); |
238 | 255 |
239 ProcessScheduledActions(); | 256 ProcessScheduledActions(); |
240 | 257 |
241 if (!state_machine_.HasInitializedOutputSurface()) | 258 if (!state_machine_.HasInitializedOutputSurface()) |
242 return; | 259 return; |
243 | 260 |
244 state_machine_.OnBeginImplFrameDeadlinePending(); | 261 state_machine_.OnBeginImplFrameDeadlinePending(); |
245 base::TimeTicks adjusted_deadline = AdjustedBeginImplFrameDeadline(); | 262 base::TimeTicks adjusted_deadline = AdjustedBeginImplFrameDeadline(); |
246 ScheduleBeginImplFrameDeadline(adjusted_deadline); | 263 ScheduleBeginImplFrameDeadline(adjusted_deadline); |
247 } | 264 } |
248 | 265 |
249 base::TimeTicks Scheduler::AdjustedBeginImplFrameDeadline() const { | 266 base::TimeTicks Scheduler::AdjustedBeginImplFrameDeadline() const { |
250 if (settings_.using_synchronous_renderer_compositor) { | 267 if (settings_.using_synchronous_renderer_compositor) { |
251 // The synchronous compositor needs to draw right away. | 268 // The synchronous compositor needs to draw right away. |
252 return base::TimeTicks(); | 269 return base::TimeTicks(); |
253 } else if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly()) { | 270 } else if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly()) { |
254 // We are ready to draw a new active tree immediately. | 271 // We are ready to draw a new active tree immediately. |
255 return base::TimeTicks(); | 272 return base::TimeTicks(); |
256 } else if (state_machine_.needs_redraw()) { | 273 } else if (state_machine_.needs_redraw()) { |
257 // We have an animation or fast input path on the impl thread that wants | 274 // We have an animation or fast input path on the impl thread that wants |
258 // to draw, so don't wait too long for a new active tree. | 275 // to draw, so don't wait too long for a new active tree. |
259 return last_begin_impl_frame_args_.deadline; | 276 return begin_impl_frame_args_.deadline; |
260 } else { | 277 } else { |
261 // The impl thread doesn't have anything it wants to draw and we are just | 278 // The impl thread doesn't have anything it wants to draw and we are just |
262 // waiting for a new active tree, so post the deadline for the next | 279 // waiting for a new active tree, so post the deadline for the next |
263 // expected BeginImplFrame start. This allows us to draw immediately when | 280 // expected BeginImplFrame start. This allows us to draw immediately when |
264 // there is a new active tree, instead of waiting for the next | 281 // there is a new active tree, instead of waiting for the next |
265 // BeginImplFrame. | 282 // BeginImplFrame. |
266 // TODO(brianderson): Handle long deadlines (that are past the next frame's | 283 // TODO(brianderson): Handle long deadlines (that are past the next frame's |
267 // frame time) properly instead of using this hack. | 284 // frame time) properly instead of using this hack. |
268 return last_begin_impl_frame_args_.frame_time + | 285 return begin_impl_frame_args_.frame_time + begin_impl_frame_args_.interval; |
269 last_begin_impl_frame_args_.interval; | |
270 } | 286 } |
271 } | 287 } |
272 | 288 |
273 void Scheduler::ScheduleBeginImplFrameDeadline(base::TimeTicks deadline) { | 289 void Scheduler::ScheduleBeginImplFrameDeadline(base::TimeTicks deadline) { |
274 if (settings_.using_synchronous_renderer_compositor) { | 290 if (settings_.using_synchronous_renderer_compositor) { |
275 // The synchronous renderer compositor has to make its GL calls | 291 // The synchronous renderer compositor has to make its GL calls |
276 // within this call. | 292 // within this call. |
277 // TODO(brianderson): Have the OutputSurface initiate the deadline tasks | 293 // TODO(brianderson): Have the OutputSurface initiate the deadline tasks |
278 // so the sychronous renderer compositor can take advantage of splitting | 294 // so the sychronous renderer compositor can take advantage of splitting |
279 // up the BeginImplFrame and deadline as well. | 295 // up the BeginImplFrame and deadline as well. |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 break; | 407 break; |
392 case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: | 408 case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: |
393 client_->ScheduledActionAcquireLayerTexturesForMainThread(); | 409 client_->ScheduledActionAcquireLayerTexturesForMainThread(); |
394 break; | 410 break; |
395 case SchedulerStateMachine::ACTION_MANAGE_TILES: | 411 case SchedulerStateMachine::ACTION_MANAGE_TILES: |
396 client_->ScheduledActionManageTiles(); | 412 client_->ScheduledActionManageTiles(); |
397 break; | 413 break; |
398 } | 414 } |
399 } while (action != SchedulerStateMachine::ACTION_NONE); | 415 } while (action != SchedulerStateMachine::ACTION_NONE); |
400 | 416 |
401 SetupNextBeginImplFrameIfNeeded(); | 417 SetupNextBeginFrameIfNeeded(); |
402 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); | 418 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); |
403 | 419 |
404 if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly()) { | 420 if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly()) { |
405 DCHECK(!settings_.using_synchronous_renderer_compositor); | 421 DCHECK(!settings_.using_synchronous_renderer_compositor); |
406 ScheduleBeginImplFrameDeadline(base::TimeTicks()); | 422 ScheduleBeginImplFrameDeadline(base::TimeTicks()); |
407 } | 423 } |
408 } | 424 } |
409 | 425 |
410 bool Scheduler::WillDrawIfNeeded() const { | 426 bool Scheduler::WillDrawIfNeeded() const { |
411 return !state_machine_.PendingDrawsShouldBeAborted(); | 427 return !state_machine_.PendingDrawsShouldBeAborted(); |
(...skipping 16 matching lines...) Expand all Loading... | |
428 "commit_to_activate_duration_estimate_ms", | 444 "commit_to_activate_duration_estimate_ms", |
429 client_->CommitToActivateDurationEstimate().InMillisecondsF()); | 445 client_->CommitToActivateDurationEstimate().InMillisecondsF()); |
430 state->Set("client_state", client_state.release()); | 446 state->Set("client_state", client_state.release()); |
431 return state.PassAs<base::Value>(); | 447 return state.PassAs<base::Value>(); |
432 } | 448 } |
433 | 449 |
434 bool Scheduler::CanCommitAndActivateBeforeDeadline() const { | 450 bool Scheduler::CanCommitAndActivateBeforeDeadline() const { |
435 // Check if the main thread computation and commit can be finished before the | 451 // Check if the main thread computation and commit can be finished before the |
436 // impl thread's deadline. | 452 // impl thread's deadline. |
437 base::TimeTicks estimated_draw_time = | 453 base::TimeTicks estimated_draw_time = |
438 last_begin_impl_frame_args_.frame_time + | 454 begin_impl_frame_args_.frame_time + |
439 client_->BeginMainFrameToCommitDurationEstimate() + | 455 client_->BeginMainFrameToCommitDurationEstimate() + |
440 client_->CommitToActivateDurationEstimate(); | 456 client_->CommitToActivateDurationEstimate(); |
441 | 457 |
442 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), | 458 TRACE_EVENT2( |
443 "CanCommitAndActivateBeforeDeadline", | 459 TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), |
444 "time_left_after_drawing_ms", | 460 "CanCommitAndActivateBeforeDeadline", |
445 (last_begin_impl_frame_args_.deadline - estimated_draw_time) | 461 "time_left_after_drawing_ms", |
446 .InMillisecondsF(), | 462 (begin_impl_frame_args_.deadline - estimated_draw_time).InMillisecondsF(), |
447 "state", | 463 "state", |
448 TracedValue::FromValue(StateAsValue().release())); | 464 TracedValue::FromValue(StateAsValue().release())); |
449 | 465 |
450 return estimated_draw_time < last_begin_impl_frame_args_.deadline; | 466 return estimated_draw_time < begin_impl_frame_args_.deadline; |
451 } | 467 } |
452 | 468 |
453 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 469 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
454 return (state_machine_.commit_state() == | 470 return (state_machine_.commit_state() == |
455 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 471 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
456 state_machine_.commit_state() == | 472 state_machine_.commit_state() == |
457 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 473 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
458 } | 474 } |
459 | 475 |
460 } // namespace cc | 476 } // namespace cc |
OLD | NEW |