| 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 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 client_(client), | 37 client_(client), |
| 38 layer_tree_host_id_(layer_tree_host_id), | 38 layer_tree_host_id_(layer_tree_host_id), |
| 39 task_runner_(task_runner), | 39 task_runner_(task_runner), |
| 40 compositor_timing_history_(std::move(compositor_timing_history)), | 40 compositor_timing_history_(std::move(compositor_timing_history)), |
| 41 begin_impl_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), | 41 begin_impl_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), |
| 42 state_machine_(settings), | 42 state_machine_(settings), |
| 43 weak_factory_(this) { | 43 weak_factory_(this) { |
| 44 TRACE_EVENT1("cc", "Scheduler::Scheduler", "settings", settings_.AsValue()); | 44 TRACE_EVENT1("cc", "Scheduler::Scheduler", "settings", settings_.AsValue()); |
| 45 DCHECK(client_); | 45 DCHECK(client_); |
| 46 DCHECK(!state_machine_.BeginFrameNeeded()); | 46 DCHECK(!state_machine_.BeginFrameNeeded()); |
| 47 | |
| 48 begin_impl_frame_deadline_closure_ = base::Bind( | |
| 49 &Scheduler::OnBeginImplFrameDeadline, weak_factory_.GetWeakPtr()); | |
| 50 | |
| 51 ProcessScheduledActions(); | 47 ProcessScheduledActions(); |
| 52 } | 48 } |
| 53 | 49 |
| 54 Scheduler::~Scheduler() { | 50 Scheduler::~Scheduler() { |
| 55 SetBeginFrameSource(nullptr); | 51 SetBeginFrameSource(nullptr); |
| 56 } | 52 } |
| 57 | 53 |
| 58 void Scheduler::Stop() { | 54 void Scheduler::Stop() { |
| 59 stopped_ = true; | 55 stopped_ = true; |
| 60 } | 56 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } | 214 } |
| 219 | 215 |
| 220 void Scheduler::SetupNextBeginFrameIfNeeded() { | 216 void Scheduler::SetupNextBeginFrameIfNeeded() { |
| 221 if (state_machine_.begin_impl_frame_state() != | 217 if (state_machine_.begin_impl_frame_state() != |
| 222 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE) { | 218 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE) { |
| 223 return; | 219 return; |
| 224 } | 220 } |
| 225 | 221 |
| 226 bool needs_begin_frames = state_machine_.BeginFrameNeeded(); | 222 bool needs_begin_frames = state_machine_.BeginFrameNeeded(); |
| 227 if (needs_begin_frames && !observing_begin_frame_source_) { | 223 if (needs_begin_frames && !observing_begin_frame_source_) { |
| 228 observing_begin_frame_source_ = true; | 224 StartObservingBeginFrameSource(); |
| 229 if (begin_frame_source_) | |
| 230 begin_frame_source_->AddObserver(this); | |
| 231 devtools_instrumentation::NeedsBeginFrameChanged(layer_tree_host_id_, true); | |
| 232 } else if (!needs_begin_frames && observing_begin_frame_source_) { | 225 } else if (!needs_begin_frames && observing_begin_frame_source_) { |
| 233 observing_begin_frame_source_ = false; | 226 StopObservingBeginFrameSource(); |
| 234 if (begin_frame_source_) | 227 } |
| 235 begin_frame_source_->RemoveObserver(this); | 228 |
| 236 missed_begin_frame_task_.Cancel(); | 229 if (missed_begin_frame_args_.IsValid()) { |
| 237 BeginImplFrameNotExpectedSoon(); | 230 DCHECK(observing_begin_frame_source_); |
| 238 devtools_instrumentation::NeedsBeginFrameChanged(layer_tree_host_id_, | 231 DCHECK(missed_begin_frame_task_.IsCancelled()); |
| 239 false); | 232 missed_begin_frame_task_.Reset(base::Bind(&Scheduler::BeginImplFrameMissed, |
| 233 weak_factory_.GetWeakPtr(), |
| 234 missed_begin_frame_args_)); |
| 235 missed_begin_frame_args_ = BeginFrameArgs(); |
| 236 task_runner_->PostTask(FROM_HERE, missed_begin_frame_task_.callback()); |
| 240 } | 237 } |
| 241 } | 238 } |
| 242 | 239 |
| 240 void Scheduler::StartObservingBeginFrameSource() { |
| 241 observing_begin_frame_source_ = true; |
| 242 |
| 243 if (begin_frame_source_) |
| 244 begin_frame_source_->AddObserver(this); |
| 245 |
| 246 devtools_instrumentation::NeedsBeginFrameChanged(layer_tree_host_id_, true); |
| 247 } |
| 248 |
| 249 void Scheduler::StopObservingBeginFrameSource() { |
| 250 observing_begin_frame_source_ = false; |
| 251 |
| 252 if (begin_frame_source_) |
| 253 begin_frame_source_->RemoveObserver(this); |
| 254 |
| 255 missed_begin_frame_task_.Cancel(); |
| 256 |
| 257 if (missed_begin_frame_args_.IsValid()) { |
| 258 // We need to confirm the ignored BeginFrame, since we don't have updates. |
| 259 // To persist the confirmation for future BeginFrameAcks, we let the state |
| 260 // machine know about the BeginFrame. |
| 261 state_machine_.OnBeginFrameDroppedNotObserving( |
| 262 missed_begin_frame_args_.source_id, |
| 263 missed_begin_frame_args_.sequence_number); |
| 264 SendBeginFrameAck(missed_begin_frame_args_, kBeginFrameSkipped); |
| 265 missed_begin_frame_args_ = BeginFrameArgs(); |
| 266 } |
| 267 |
| 268 BeginImplFrameNotExpectedSoon(); |
| 269 |
| 270 devtools_instrumentation::NeedsBeginFrameChanged(layer_tree_host_id_, false); |
| 271 } |
| 272 |
| 243 void Scheduler::OnBeginFrameSourcePausedChanged(bool paused) { | 273 void Scheduler::OnBeginFrameSourcePausedChanged(bool paused) { |
| 244 if (state_machine_.begin_frame_source_paused() == paused) | 274 if (state_machine_.begin_frame_source_paused() == paused) |
| 245 return; | 275 return; |
| 246 TRACE_EVENT_INSTANT1("cc", "Scheduler::SetBeginFrameSourcePaused", | 276 TRACE_EVENT_INSTANT1("cc", "Scheduler::SetBeginFrameSourcePaused", |
| 247 TRACE_EVENT_SCOPE_THREAD, "paused", paused); | 277 TRACE_EVENT_SCOPE_THREAD, "paused", paused); |
| 248 state_machine_.SetBeginFrameSourcePaused(paused); | 278 state_machine_.SetBeginFrameSourcePaused(paused); |
| 249 ProcessScheduledActions(); | 279 ProcessScheduledActions(); |
| 250 } | 280 } |
| 251 | 281 |
| 252 // BeginFrame is the mechanism that tells us that now is a good time to start | 282 // BeginFrame is the mechanism that tells us that now is a good time to start |
| (...skipping 16 matching lines...) Expand all Loading... |
| 269 // Trace this begin frame time through the Chrome stack | 299 // Trace this begin frame time through the Chrome stack |
| 270 TRACE_EVENT_FLOW_BEGIN0( | 300 TRACE_EVENT_FLOW_BEGIN0( |
| 271 TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"), "BeginFrameArgs", | 301 TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"), "BeginFrameArgs", |
| 272 args.frame_time.ToInternalValue()); | 302 args.frame_time.ToInternalValue()); |
| 273 | 303 |
| 274 if (settings_.using_synchronous_renderer_compositor) { | 304 if (settings_.using_synchronous_renderer_compositor) { |
| 275 BeginImplFrameSynchronous(args); | 305 BeginImplFrameSynchronous(args); |
| 276 return true; | 306 return true; |
| 277 } | 307 } |
| 278 | 308 |
| 279 if (inside_process_scheduled_actions_) { | 309 // Cancel any pending missed begin frame task because we're either handling |
| 280 // The BFS can send a missed begin frame inside AddObserver. We can't handle | 310 // this begin frame immediately or saving it as a missed frame for which we |
| 281 // a begin frame inside ProcessScheduledActions so post a task. | 311 // will post a new task. |
| 282 DCHECK_EQ(args.type, BeginFrameArgs::MISSED); | 312 missed_begin_frame_task_.Cancel(); |
| 283 DCHECK(missed_begin_frame_task_.IsCancelled()); | 313 |
| 284 missed_begin_frame_task_.Reset(base::Bind( | 314 // Save args if we're inside ProcessScheduledActions or the middle of a frame. |
| 285 &Scheduler::BeginImplFrameWithDeadline, base::Unretained(this), args)); | 315 // At the end of ProcessScheduledActions and at the end of the current frame, |
| 286 task_runner_->PostTask(FROM_HERE, missed_begin_frame_task_.callback()); | 316 // we will post a task to handle the missed begin frame. |
| 317 bool inside_begin_frame = |
| 318 state_machine_.begin_impl_frame_state() == |
| 319 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME; |
| 320 if (inside_process_scheduled_actions_ || inside_begin_frame) { |
| 321 missed_begin_frame_args_ = args; |
| 322 missed_begin_frame_args_.type = BeginFrameArgs::MISSED; |
| 287 return true; | 323 return true; |
| 288 } | 324 } |
| 289 | 325 |
| 290 BeginImplFrameWithDeadline(args); | 326 BeginImplFrameWithDeadline(args); |
| 291 return true; | 327 return true; |
| 292 } | 328 } |
| 293 | 329 |
| 294 void Scheduler::SetVideoNeedsBeginFrames(bool video_needs_begin_frames) { | 330 void Scheduler::SetVideoNeedsBeginFrames(bool video_needs_begin_frames) { |
| 295 state_machine_.SetVideoNeedsBeginFrames(video_needs_begin_frames); | 331 state_machine_.SetVideoNeedsBeginFrames(video_needs_begin_frames); |
| 296 ProcessScheduledActions(); | 332 ProcessScheduledActions(); |
| 297 } | 333 } |
| 298 | 334 |
| 299 void Scheduler::OnDrawForCompositorFrameSink(bool resourceless_software_draw) { | 335 void Scheduler::OnDrawForCompositorFrameSink(bool resourceless_software_draw) { |
| 300 DCHECK(settings_.using_synchronous_renderer_compositor); | 336 DCHECK(settings_.using_synchronous_renderer_compositor); |
| 301 DCHECK_EQ(state_machine_.begin_impl_frame_state(), | 337 DCHECK_EQ(state_machine_.begin_impl_frame_state(), |
| 302 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | 338 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); |
| 303 DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); | 339 DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); |
| 304 | 340 |
| 305 state_machine_.SetResourcelessSoftwareDraw(resourceless_software_draw); | 341 state_machine_.SetResourcelessSoftwareDraw(resourceless_software_draw); |
| 306 state_machine_.OnBeginImplFrameDeadline(); | 342 state_machine_.OnBeginImplFrameDeadline(); |
| 307 ProcessScheduledActions(); | 343 ProcessScheduledActions(); |
| 308 | 344 |
| 309 state_machine_.OnBeginImplFrameIdle(); | 345 state_machine_.OnBeginImplFrameIdle(); |
| 310 ProcessScheduledActions(); | 346 ProcessScheduledActions(); |
| 311 state_machine_.SetResourcelessSoftwareDraw(false); | 347 state_machine_.SetResourcelessSoftwareDraw(false); |
| 312 } | 348 } |
| 313 | 349 |
| 350 void Scheduler::BeginImplFrameMissed(const BeginFrameArgs& args) { |
| 351 // The storage for the args is owned by the task so copy them before canceling |
| 352 // the task. |
| 353 BeginFrameArgs copy_args = args; |
| 354 missed_begin_frame_task_.Cancel(); |
| 355 BeginImplFrameWithDeadline(copy_args); |
| 356 } |
| 357 |
| 314 void Scheduler::BeginImplFrameWithDeadline(const BeginFrameArgs& args) { | 358 void Scheduler::BeginImplFrameWithDeadline(const BeginFrameArgs& args) { |
| 315 // The storage for |args| is owned by the missed begin frame task. Therefore | 359 DCHECK(!inside_process_scheduled_actions_); |
| 316 // save |args| before cancelling the task either here or in the deadline. | 360 DCHECK_EQ(state_machine_.begin_impl_frame_state(), |
| 317 BeginFrameArgs adjusted_args = args; | 361 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); |
| 318 // Cancel the missed begin frame task in case the BFS sends a begin frame | |
| 319 // before the missed frame task runs. | |
| 320 missed_begin_frame_task_.Cancel(); | |
| 321 | 362 |
| 322 base::TimeTicks now = Now(); | 363 base::TimeTicks now = Now(); |
| 323 | 364 |
| 324 // Discard missed begin frames if they are too late. | 365 // Discard missed begin frames if they are too late. |
| 325 if (adjusted_args.type == BeginFrameArgs::MISSED && | 366 if (args.type == BeginFrameArgs::MISSED && now > args.deadline) { |
| 326 now > adjusted_args.deadline) { | |
| 327 skipped_last_frame_missed_exceeded_deadline_ = true; | 367 skipped_last_frame_missed_exceeded_deadline_ = true; |
| 328 SendBeginFrameAck(adjusted_args, kBeginFrameSkipped); | 368 SendBeginFrameAck(args, kBeginFrameSkipped); |
| 329 return; | 369 return; |
| 330 } | 370 } |
| 331 | 371 |
| 332 skipped_last_frame_missed_exceeded_deadline_ = false; | 372 skipped_last_frame_missed_exceeded_deadline_ = false; |
| 333 | 373 |
| 334 // Run the previous deadline if any. | |
| 335 if (state_machine_.begin_impl_frame_state() == | |
| 336 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME) { | |
| 337 OnBeginImplFrameDeadline(); | |
| 338 // We may not need begin frames any longer. | |
| 339 if (!observing_begin_frame_source_) { | |
| 340 // We need to confirm the ignored BeginFrame, since we don't have updates. | |
| 341 // To persist the confirmation for future BeginFrameAcks, we let the state | |
| 342 // machine know about the BeginFrame. | |
| 343 state_machine_.OnBeginFrameDroppedNotObserving(args.source_id, | |
| 344 args.sequence_number); | |
| 345 SendBeginFrameAck(adjusted_args, kBeginFrameSkipped); | |
| 346 return; | |
| 347 } | |
| 348 } | |
| 349 DCHECK_EQ(state_machine_.begin_impl_frame_state(), | |
| 350 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | |
| 351 | |
| 352 bool main_thread_is_in_high_latency_mode = | 374 bool main_thread_is_in_high_latency_mode = |
| 353 state_machine_.main_thread_missed_last_deadline(); | 375 state_machine_.main_thread_missed_last_deadline(); |
| 354 TRACE_EVENT2("cc,benchmark", "Scheduler::BeginImplFrame", "args", | 376 TRACE_EVENT2("cc,benchmark", "Scheduler::BeginImplFrame", "args", |
| 355 adjusted_args.AsValue(), "main_thread_missed_last_deadline", | 377 args.AsValue(), "main_thread_missed_last_deadline", |
| 356 main_thread_is_in_high_latency_mode); | 378 main_thread_is_in_high_latency_mode); |
| 357 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), | 379 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), |
| 358 "MainThreadLatency", main_thread_is_in_high_latency_mode); | 380 "MainThreadLatency", main_thread_is_in_high_latency_mode); |
| 359 | 381 |
| 360 DCHECK_EQ(state_machine_.begin_impl_frame_state(), | 382 BeginFrameArgs adjusted_args = args; |
| 361 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | |
| 362 | |
| 363 adjusted_args.deadline -= compositor_timing_history_->DrawDurationEstimate(); | 383 adjusted_args.deadline -= compositor_timing_history_->DrawDurationEstimate(); |
| 364 adjusted_args.deadline -= kDeadlineFudgeFactor; | 384 adjusted_args.deadline -= kDeadlineFudgeFactor; |
| 365 | 385 |
| 366 base::TimeDelta bmf_start_to_activate = | 386 base::TimeDelta bmf_start_to_activate = |
| 367 compositor_timing_history_ | 387 compositor_timing_history_ |
| 368 ->BeginMainFrameStartToCommitDurationEstimate() + | 388 ->BeginMainFrameStartToCommitDurationEstimate() + |
| 369 compositor_timing_history_->CommitToReadyToActivateDurationEstimate() + | 389 compositor_timing_history_->CommitToReadyToActivateDurationEstimate() + |
| 370 compositor_timing_history_->ActivateDurationEstimate(); | 390 compositor_timing_history_->ActivateDurationEstimate(); |
| 371 | 391 |
| 372 base::TimeDelta bmf_to_activate_estimate_critical = | 392 base::TimeDelta bmf_to_activate_estimate_critical = |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 begin_main_frame_args_.on_critical_path = !ImplLatencyTakesPriority(); | 441 begin_main_frame_args_.on_critical_path = !ImplLatencyTakesPriority(); |
| 422 | 442 |
| 423 BeginImplFrame(args, Now()); | 443 BeginImplFrame(args, Now()); |
| 424 compositor_timing_history_->WillFinishImplFrame( | 444 compositor_timing_history_->WillFinishImplFrame( |
| 425 state_machine_.needs_redraw()); | 445 state_machine_.needs_redraw()); |
| 426 FinishImplFrame(); | 446 FinishImplFrame(); |
| 427 } | 447 } |
| 428 | 448 |
| 429 void Scheduler::FinishImplFrame() { | 449 void Scheduler::FinishImplFrame() { |
| 430 state_machine_.OnBeginImplFrameIdle(); | 450 state_machine_.OnBeginImplFrameIdle(); |
| 451 |
| 452 // Call this before ProcessScheduledActions because we might send an ack for |
| 453 // missed begin frame there. |
| 454 SendBeginFrameAck(begin_impl_frame_tracker_.Current(), kBeginFrameFinished); |
| 455 |
| 431 ProcessScheduledActions(); | 456 ProcessScheduledActions(); |
| 432 | 457 |
| 433 client_->DidFinishImplFrame(); | 458 client_->DidFinishImplFrame(); |
| 434 SendBeginFrameAck(begin_main_frame_args_, kBeginFrameFinished); | |
| 435 begin_impl_frame_tracker_.Finish(); | 459 begin_impl_frame_tracker_.Finish(); |
| 436 } | 460 } |
| 437 | 461 |
| 438 void Scheduler::SendBeginFrameAck(const BeginFrameArgs& args, | 462 void Scheduler::SendBeginFrameAck(const BeginFrameArgs& args, |
| 439 BeginFrameResult result) { | 463 BeginFrameResult result) { |
| 440 if (!begin_frame_source_) | 464 if (!begin_frame_source_) |
| 441 return; | 465 return; |
| 442 | 466 |
| 443 uint64_t latest_confirmed_sequence_number = | 467 uint64_t latest_confirmed_sequence_number = |
| 444 BeginFrameArgs::kInvalidFrameNumber; | 468 BeginFrameArgs::kInvalidFrameNumber; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 475 state_machine_.NewActiveTreeLikely(), args.frame_time, args.type, now); | 499 state_machine_.NewActiveTreeLikely(), args.frame_time, args.type, now); |
| 476 client_->WillBeginImplFrame(begin_impl_frame_tracker_.Current()); | 500 client_->WillBeginImplFrame(begin_impl_frame_tracker_.Current()); |
| 477 | 501 |
| 478 ProcessScheduledActions(); | 502 ProcessScheduledActions(); |
| 479 } | 503 } |
| 480 | 504 |
| 481 void Scheduler::ScheduleBeginImplFrameDeadline() { | 505 void Scheduler::ScheduleBeginImplFrameDeadline() { |
| 482 // The synchronous compositor does not post a deadline task. | 506 // The synchronous compositor does not post a deadline task. |
| 483 DCHECK(!settings_.using_synchronous_renderer_compositor); | 507 DCHECK(!settings_.using_synchronous_renderer_compositor); |
| 484 | 508 |
| 485 begin_impl_frame_deadline_task_.Cancel(); | 509 begin_impl_frame_deadline_task_.Reset(base::Bind( |
| 486 begin_impl_frame_deadline_task_.Reset(begin_impl_frame_deadline_closure_); | 510 &Scheduler::OnBeginImplFrameDeadline, weak_factory_.GetWeakPtr())); |
| 487 | 511 |
| 488 begin_impl_frame_deadline_mode_ = | 512 begin_impl_frame_deadline_mode_ = |
| 489 state_machine_.CurrentBeginImplFrameDeadlineMode(); | 513 state_machine_.CurrentBeginImplFrameDeadlineMode(); |
| 490 switch (begin_impl_frame_deadline_mode_) { | 514 switch (begin_impl_frame_deadline_mode_) { |
| 491 case SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_NONE: | 515 case SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_NONE: |
| 492 // No deadline. | 516 // No deadline. |
| 493 return; | 517 return; |
| 494 case SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE: | 518 case SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE: |
| 495 // We are ready to draw a new active tree immediately. | 519 // We are ready to draw a new active tree immediately. |
| 496 // We don't use Now() here because it's somewhat expensive to call. | 520 // We don't use Now() here because it's somewhat expensive to call. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 } | 703 } |
| 680 | 704 |
| 681 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 705 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| 682 Scheduler::AsValue() const { | 706 Scheduler::AsValue() const { |
| 683 auto state = base::MakeUnique<base::trace_event::TracedValue>(); | 707 auto state = base::MakeUnique<base::trace_event::TracedValue>(); |
| 684 AsValueInto(state.get()); | 708 AsValueInto(state.get()); |
| 685 return std::move(state); | 709 return std::move(state); |
| 686 } | 710 } |
| 687 | 711 |
| 688 void Scheduler::AsValueInto(base::trace_event::TracedValue* state) const { | 712 void Scheduler::AsValueInto(base::trace_event::TracedValue* state) const { |
| 689 base::TimeTicks now = Now(); | |
| 690 | |
| 691 state->BeginDictionary("state_machine"); | 713 state->BeginDictionary("state_machine"); |
| 692 state_machine_.AsValueInto(state); | 714 state_machine_.AsValueInto(state); |
| 693 state->EndDictionary(); | 715 state->EndDictionary(); |
| 694 | 716 |
| 695 state->SetBoolean("observing_begin_frame_source", | 717 state->SetBoolean("observing_begin_frame_source", |
| 696 observing_begin_frame_source_); | 718 observing_begin_frame_source_); |
| 697 state->SetBoolean("begin_impl_frame_deadline_task", | 719 state->SetBoolean("begin_impl_frame_deadline_task", |
| 698 !begin_impl_frame_deadline_task_.IsCancelled()); | 720 !begin_impl_frame_deadline_task_.IsCancelled()); |
| 699 state->SetBoolean("missed_begin_frame_task", | 721 state->SetBoolean("missed_begin_frame_task", |
| 700 !missed_begin_frame_task_.IsCancelled()); | 722 !missed_begin_frame_task_.IsCancelled()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 713 state->SetDouble( | 735 state->SetDouble( |
| 714 "deadline_scheduled_at_ms", | 736 "deadline_scheduled_at_ms", |
| 715 (deadline_scheduled_at_ - base::TimeTicks()).InMillisecondsF()); | 737 (deadline_scheduled_at_ - base::TimeTicks()).InMillisecondsF()); |
| 716 | 738 |
| 717 state->SetDouble("now_ms", (Now() - base::TimeTicks()).InMillisecondsF()); | 739 state->SetDouble("now_ms", (Now() - base::TimeTicks()).InMillisecondsF()); |
| 718 state->SetDouble("now_to_deadline_ms", (deadline_ - Now()).InMillisecondsF()); | 740 state->SetDouble("now_to_deadline_ms", (deadline_ - Now()).InMillisecondsF()); |
| 719 state->SetDouble("now_to_deadline_scheduled_at_ms", | 741 state->SetDouble("now_to_deadline_scheduled_at_ms", |
| 720 (deadline_scheduled_at_ - Now()).InMillisecondsF()); | 742 (deadline_scheduled_at_ - Now()).InMillisecondsF()); |
| 721 | 743 |
| 722 state->BeginDictionary("begin_impl_frame_tracker"); | 744 state->BeginDictionary("begin_impl_frame_tracker"); |
| 723 begin_impl_frame_tracker_.AsValueInto(now, state); | 745 begin_impl_frame_tracker_.AsValueInto(state); |
| 724 state->EndDictionary(); | 746 state->EndDictionary(); |
| 725 | 747 |
| 726 state->BeginDictionary("begin_impl_frame_args"); | 748 state->BeginDictionary("missed_begin_frame_args"); |
| 727 begin_impl_frame_tracker_.AsValueInto(now, state); | 749 missed_begin_frame_args_.AsValueInto(state); |
| 728 state->EndDictionary(); | 750 state->EndDictionary(); |
| 729 | 751 |
| 730 state->BeginDictionary("begin_frame_observer_state"); | 752 state->BeginDictionary("begin_frame_observer_state"); |
| 731 BeginFrameObserverBase::AsValueInto(state); | 753 BeginFrameObserverBase::AsValueInto(state); |
| 732 state->EndDictionary(); | 754 state->EndDictionary(); |
| 733 | 755 |
| 734 if (begin_frame_source_) { | 756 if (begin_frame_source_) { |
| 735 state->BeginDictionary("begin_frame_source_state"); | 757 state->BeginDictionary("begin_frame_source_state"); |
| 736 begin_frame_source_->AsValueInto(state); | 758 begin_frame_source_->AsValueInto(state); |
| 737 state->EndDictionary(); | 759 state->EndDictionary(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 } | 849 } |
| 828 | 850 |
| 829 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const { | 851 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const { |
| 830 return BeginFrameAck( | 852 return BeginFrameAck( |
| 831 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number, | 853 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number, |
| 832 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(), | 854 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(), |
| 833 true); | 855 true); |
| 834 } | 856 } |
| 835 | 857 |
| 836 } // namespace cc | 858 } // namespace cc |
| OLD | NEW |