| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 "Scheduler::Scheduler", | 101 "Scheduler::Scheduler", |
| 102 "settings", | 102 "settings", |
| 103 settings_.AsValue()); | 103 settings_.AsValue()); |
| 104 DCHECK(client_); | 104 DCHECK(client_); |
| 105 DCHECK(!state_machine_.BeginFrameNeeded()); | 105 DCHECK(!state_machine_.BeginFrameNeeded()); |
| 106 | 106 |
| 107 begin_retro_frame_closure_ = | 107 begin_retro_frame_closure_ = |
| 108 base::Bind(&Scheduler::BeginRetroFrame, weak_factory_.GetWeakPtr()); | 108 base::Bind(&Scheduler::BeginRetroFrame, weak_factory_.GetWeakPtr()); |
| 109 begin_impl_frame_deadline_closure_ = base::Bind( | 109 begin_impl_frame_deadline_closure_ = base::Bind( |
| 110 &Scheduler::OnBeginImplFrameDeadline, weak_factory_.GetWeakPtr()); | 110 &Scheduler::OnBeginImplFrameDeadline, weak_factory_.GetWeakPtr()); |
| 111 poll_for_draw_triggers_closure_ = base::Bind( | |
| 112 &Scheduler::PollForAnticipatedDrawTriggers, weak_factory_.GetWeakPtr()); | |
| 113 advance_commit_state_closure_ = base::Bind( | 111 advance_commit_state_closure_ = base::Bind( |
| 114 &Scheduler::PollToAdvanceCommitState, weak_factory_.GetWeakPtr()); | 112 &Scheduler::PollToAdvanceCommitState, weak_factory_.GetWeakPtr()); |
| 115 | 113 |
| 116 frame_source_ = BeginFrameSourceMultiplexer::Create(); | 114 frame_source_ = BeginFrameSourceMultiplexer::Create(); |
| 117 frame_source_->AddObserver(this); | 115 frame_source_->AddObserver(this); |
| 118 | 116 |
| 119 // Primary frame source | 117 // Primary frame source |
| 120 primary_frame_source_ = | 118 primary_frame_source_ = |
| 121 frame_sources_constructor->ConstructPrimaryFrameSource(this); | 119 frame_sources_constructor->ConstructPrimaryFrameSource(this); |
| 122 frame_source_->AddSource(primary_frame_source_); | 120 frame_source_->AddSource(primary_frame_source_); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 frame_source_->DidFinishFrame(begin_retro_frame_args_.size()); | 340 frame_source_->DidFinishFrame(begin_retro_frame_args_.size()); |
| 343 } | 341 } |
| 344 | 342 |
| 345 PostBeginRetroFrameIfNeeded(); | 343 PostBeginRetroFrameIfNeeded(); |
| 346 SetupPollingMechanisms(); | 344 SetupPollingMechanisms(); |
| 347 } | 345 } |
| 348 | 346 |
| 349 // We may need to poll when we can't rely on BeginFrame to advance certain | 347 // We may need to poll when we can't rely on BeginFrame to advance certain |
| 350 // state or to avoid deadlock. | 348 // state or to avoid deadlock. |
| 351 void Scheduler::SetupPollingMechanisms() { | 349 void Scheduler::SetupPollingMechanisms() { |
| 352 bool needs_advance_commit_state_timer = false; | 350 // At this point we'd prefer to advance through the commit flow by |
| 353 // Setup PollForAnticipatedDrawTriggers if we need to monitor state but | 351 // drawing a frame, however it's possible that the frame rate controller |
| 354 // aren't expecting any more BeginFrames. This should only be needed by | 352 // will not give us a BeginFrame until the commit completes. See |
| 355 // the synchronous compositor when BeginFrameNeeded is false. | 353 // crbug.com/317430 for an example of a swap ack being held on commit. Thus |
| 356 if (state_machine_.ShouldPollForAnticipatedDrawTriggers()) { | 354 // we set a repeating timer to poll on ProcessScheduledActions until we |
| 357 DCHECK(!state_machine_.SupportsProactiveBeginFrame()); | 355 // successfully reach BeginFrame. Synchronous compositor does not use |
| 358 if (poll_for_draw_triggers_task_.IsCancelled()) { | 356 // frame rate controller or have the circular wait in the bug. |
| 359 poll_for_draw_triggers_task_.Reset(poll_for_draw_triggers_closure_); | 357 if (IsBeginMainFrameSentOrStarted() && |
| 360 base::TimeDelta delay = begin_impl_frame_args_.IsValid() | 358 !settings_.using_synchronous_renderer_compositor) { |
| 361 ? begin_impl_frame_args_.interval | |
| 362 : BeginFrameArgs::DefaultInterval(); | |
| 363 task_runner_->PostDelayedTask( | |
| 364 FROM_HERE, poll_for_draw_triggers_task_.callback(), delay); | |
| 365 } | |
| 366 } else { | |
| 367 poll_for_draw_triggers_task_.Cancel(); | |
| 368 | |
| 369 // At this point we'd prefer to advance through the commit flow by | |
| 370 // drawing a frame, however it's possible that the frame rate controller | |
| 371 // will not give us a BeginFrame until the commit completes. See | |
| 372 // crbug.com/317430 for an example of a swap ack being held on commit. Thus | |
| 373 // we set a repeating timer to poll on ProcessScheduledActions until we | |
| 374 // successfully reach BeginFrame. Synchronous compositor does not use | |
| 375 // frame rate controller or have the circular wait in the bug. | |
| 376 if (IsBeginMainFrameSentOrStarted() && | |
| 377 !settings_.using_synchronous_renderer_compositor) { | |
| 378 needs_advance_commit_state_timer = true; | |
| 379 } | |
| 380 } | |
| 381 | |
| 382 if (needs_advance_commit_state_timer) { | |
| 383 if (advance_commit_state_task_.IsCancelled() && | 359 if (advance_commit_state_task_.IsCancelled() && |
| 384 begin_impl_frame_args_.IsValid()) { | 360 begin_impl_frame_args_.IsValid()) { |
| 385 // Since we'd rather get a BeginImplFrame by the normal mechanism, we | 361 // Since we'd rather get a BeginImplFrame by the normal mechanism, we |
| 386 // set the interval to twice the interval from the previous frame. | 362 // set the interval to twice the interval from the previous frame. |
| 387 advance_commit_state_task_.Reset(advance_commit_state_closure_); | 363 advance_commit_state_task_.Reset(advance_commit_state_closure_); |
| 388 task_runner_->PostDelayedTask(FROM_HERE, | 364 task_runner_->PostDelayedTask(FROM_HERE, |
| 389 advance_commit_state_task_.callback(), | 365 advance_commit_state_task_.callback(), |
| 390 begin_impl_frame_args_.interval * 2); | 366 begin_impl_frame_args_.interval * 2); |
| 391 } | 367 } |
| 392 } else { | 368 } else { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 // TODO(brianderson): Have the OutputSurface initiate the deadline tasks | 551 // TODO(brianderson): Have the OutputSurface initiate the deadline tasks |
| 576 // so the synchronous renderer compositor can take advantage of splitting | 552 // so the synchronous renderer compositor can take advantage of splitting |
| 577 // up the BeginImplFrame and deadline as well. | 553 // up the BeginImplFrame and deadline as well. |
| 578 OnBeginImplFrameDeadline(); | 554 OnBeginImplFrameDeadline(); |
| 579 } else { | 555 } else { |
| 580 ScheduleBeginImplFrameDeadline(); | 556 ScheduleBeginImplFrameDeadline(); |
| 581 } | 557 } |
| 582 } | 558 } |
| 583 | 559 |
| 584 void Scheduler::ScheduleBeginImplFrameDeadline() { | 560 void Scheduler::ScheduleBeginImplFrameDeadline() { |
| 585 // The synchronous compositor does not post a deadline task. | |
| 586 DCHECK(!settings_.using_synchronous_renderer_compositor); | |
| 587 | |
| 588 begin_impl_frame_deadline_task_.Cancel(); | 561 begin_impl_frame_deadline_task_.Cancel(); |
| 589 begin_impl_frame_deadline_task_.Reset(begin_impl_frame_deadline_closure_); | 562 begin_impl_frame_deadline_task_.Reset(begin_impl_frame_deadline_closure_); |
| 590 | 563 |
| 591 begin_impl_frame_deadline_mode_ = | 564 begin_impl_frame_deadline_mode_ = |
| 592 state_machine_.CurrentBeginImplFrameDeadlineMode(); | 565 state_machine_.CurrentBeginImplFrameDeadlineMode(); |
| 593 | 566 |
| 594 base::TimeTicks deadline; | 567 base::TimeTicks deadline; |
| 595 switch (begin_impl_frame_deadline_mode_) { | 568 switch (begin_impl_frame_deadline_mode_) { |
| 596 case SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE: | 569 case SchedulerStateMachine:: |
| 570 BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE_SYNCHRONOUS: |
| 571 // The synchronous renderer compositor has to make its GL calls |
| 572 // within this call. |
| 573 OnBeginImplFrameDeadline(); |
| 574 return; |
| 575 case SchedulerStateMachine:: |
| 576 BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE_ASYNCHRONOUS: |
| 597 // We are ready to draw a new active tree immediately. | 577 // We are ready to draw a new active tree immediately. |
| 598 // We don't use Now() here because it's somewhat expensive to call. | 578 // We don't use Now() here because it's somewhat expensive to call. |
| 599 deadline = base::TimeTicks(); | 579 deadline = base::TimeTicks(); |
| 600 break; | 580 break; |
| 601 case SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_REGULAR: | 581 case SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_REGULAR: |
| 602 // We are animating on the impl thread but we can wait for some time. | 582 // We are animating on the impl thread but we can wait for some time. |
| 603 deadline = begin_impl_frame_args_.deadline; | 583 deadline = begin_impl_frame_args_.deadline; |
| 604 break; | 584 break; |
| 605 case SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE: | 585 case SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE: |
| 606 // We are blocked for one reason or another and we should wait. | 586 // We are blocked for one reason or another and we should wait. |
| 607 // TODO(brianderson): Handle long deadlines (that are past the next | 587 // TODO(brianderson): Handle long deadlines (that are past the next |
| 608 // frame's frame time) properly instead of using this hack. | 588 // frame's frame time) properly instead of using this hack. |
| 609 deadline = | 589 deadline = |
| 610 begin_impl_frame_args_.frame_time + begin_impl_frame_args_.interval; | 590 begin_impl_frame_args_.frame_time + begin_impl_frame_args_.interval; |
| 611 break; | 591 break; |
| 612 } | 592 } |
| 613 | 593 |
| 614 TRACE_EVENT1( | 594 TRACE_EVENT2("cc", "Scheduler::ScheduleBeginImplFrameDeadline", "mode", |
| 615 "cc", "Scheduler::ScheduleBeginImplFrameDeadline", "deadline", deadline); | 595 SchedulerStateMachine::BeginImplFrameDeadlineModeToString( |
| 596 begin_impl_frame_deadline_mode_), |
| 597 "deadline", deadline); |
| 616 | 598 |
| 617 base::TimeDelta delta = deadline - Now(); | 599 base::TimeDelta delta = std::max(deadline - Now(), base::TimeDelta()); |
| 618 if (delta <= base::TimeDelta()) | |
| 619 delta = base::TimeDelta(); | |
| 620 task_runner_->PostDelayedTask( | 600 task_runner_->PostDelayedTask( |
| 621 FROM_HERE, begin_impl_frame_deadline_task_.callback(), delta); | 601 FROM_HERE, begin_impl_frame_deadline_task_.callback(), delta); |
| 622 } | 602 } |
| 623 | 603 |
| 624 void Scheduler::RescheduleBeginImplFrameDeadlineIfNeeded() { | 604 void Scheduler::ScheduleBeginImplFrameDeadlineIfNeeded() { |
| 625 if (settings_.using_synchronous_renderer_compositor) | |
| 626 return; | |
| 627 | |
| 628 if (state_machine_.begin_impl_frame_state() != | 605 if (state_machine_.begin_impl_frame_state() != |
| 629 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME) | 606 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME) |
| 630 return; | 607 return; |
| 631 | 608 |
| 632 if (begin_impl_frame_deadline_mode_ != | 609 if (begin_impl_frame_deadline_mode_ == |
| 633 state_machine_.CurrentBeginImplFrameDeadlineMode()) | 610 state_machine_.CurrentBeginImplFrameDeadlineMode() && |
| 634 ScheduleBeginImplFrameDeadline(); | 611 BeginImplFrameDeadlinePending()) |
| 612 return; |
| 613 |
| 614 ScheduleBeginImplFrameDeadline(); |
| 635 } | 615 } |
| 636 | 616 |
| 637 void Scheduler::OnBeginImplFrameDeadline() { | 617 void Scheduler::OnBeginImplFrameDeadline() { |
| 638 TRACE_EVENT0("cc,benchmark", "Scheduler::OnBeginImplFrameDeadline"); | 618 TRACE_EVENT0("cc,benchmark", "Scheduler::OnBeginImplFrameDeadline"); |
| 639 begin_impl_frame_deadline_task_.Cancel(); | 619 begin_impl_frame_deadline_task_.Cancel(); |
| 640 // We split the deadline actions up into two phases so the state machine | 620 // We split the deadline actions up into two phases so the state machine |
| 641 // has a chance to trigger actions that should occur durring and after | 621 // has a chance to trigger actions that should occur durring and after |
| 642 // the deadline separately. For example: | 622 // the deadline separately. For example: |
| 643 // * Sending the BeginMainFrame will not occur after the deadline in | 623 // * Sending the BeginMainFrame will not occur after the deadline in |
| 644 // order to wait for more user-input before starting the next commit. | 624 // order to wait for more user-input before starting the next commit. |
| 645 // * Creating a new OuputSurface will not occur during the deadline in | 625 // * Creating a new OuputSurface will not occur during the deadline in |
| 646 // order to allow the state machine to "settle" first. | 626 // order to allow the state machine to "settle" first. |
| 647 state_machine_.OnBeginImplFrameDeadline(); | 627 state_machine_.OnBeginImplFrameDeadline(); |
| 648 ProcessScheduledActions(); | 628 ProcessScheduledActions(); |
| 649 state_machine_.OnBeginImplFrameIdle(); | 629 state_machine_.OnBeginImplFrameIdle(); |
| 650 ProcessScheduledActions(); | 630 ProcessScheduledActions(); |
| 651 | 631 |
| 652 client_->DidBeginImplFrameDeadline(); | 632 client_->DidBeginImplFrameDeadline(); |
| 653 } | 633 } |
| 654 | 634 |
| 655 void Scheduler::PollForAnticipatedDrawTriggers() { | |
| 656 TRACE_EVENT0("cc", "Scheduler::PollForAnticipatedDrawTriggers"); | |
| 657 poll_for_draw_triggers_task_.Cancel(); | |
| 658 state_machine_.DidEnterPollForAnticipatedDrawTriggers(); | |
| 659 ProcessScheduledActions(); | |
| 660 state_machine_.DidLeavePollForAnticipatedDrawTriggers(); | |
| 661 } | |
| 662 | 635 |
| 663 void Scheduler::PollToAdvanceCommitState() { | 636 void Scheduler::PollToAdvanceCommitState() { |
| 664 TRACE_EVENT0("cc", "Scheduler::PollToAdvanceCommitState"); | 637 TRACE_EVENT0("cc", "Scheduler::PollToAdvanceCommitState"); |
| 665 advance_commit_state_task_.Cancel(); | 638 advance_commit_state_task_.Cancel(); |
| 666 ProcessScheduledActions(); | 639 ProcessScheduledActions(); |
| 667 } | 640 } |
| 668 | 641 |
| 669 void Scheduler::DrawAndSwapIfPossible() { | 642 void Scheduler::DrawAndSwapIfPossible() { |
| 670 DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible(); | 643 DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible(); |
| 671 state_machine_.DidDrawIfPossibleCompleted(result); | 644 state_machine_.DidDrawIfPossibleCompleted(result); |
| 672 } | 645 } |
| 673 | 646 |
| 674 void Scheduler::SetDeferCommits(bool defer_commits) { | 647 void Scheduler::SetDeferCommits(bool defer_commits) { |
| 675 TRACE_EVENT1("cc", "Scheduler::SetDeferCommits", | 648 TRACE_EVENT1("cc", "Scheduler::SetDeferCommits", |
| 676 "defer_commits", | 649 "defer_commits", |
| 677 defer_commits); | 650 defer_commits); |
| 678 state_machine_.SetDeferCommits(defer_commits); | 651 state_machine_.SetDeferCommits(defer_commits); |
| 679 ProcessScheduledActions(); | 652 ProcessScheduledActions(); |
| 680 } | 653 } |
| 681 | 654 |
| 682 void Scheduler::ProcessScheduledActions() { | 655 void Scheduler::ProcessScheduledActions() { |
| 683 // We do not allow ProcessScheduledActions to be recursive. | 656 // We do not allow ProcessScheduledActions to be recursive. |
| 684 // The top-level call will iteratively execute the next action for us anyway. | 657 // The top-level call will iteratively execute the next action for us anyway. |
| 685 if (inside_process_scheduled_actions_) | 658 if (inside_process_scheduled_actions_) |
| 686 return; | 659 return; |
| 660 { |
| 661 // Separate scope for mark_inside. |
| 662 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); |
| 687 | 663 |
| 688 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); | 664 SchedulerStateMachine::Action action; |
| 689 | 665 do { |
| 690 SchedulerStateMachine::Action action; | 666 action = state_machine_.NextAction(); |
| 691 do { | 667 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), |
| 692 action = state_machine_.NextAction(); | 668 "SchedulerStateMachine", "state", AsValue()); |
| 693 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), | 669 VLOG(2) << "Scheduler::ProcessScheduledActions: " |
| 694 "SchedulerStateMachine", | 670 << SchedulerStateMachine::ActionToString(action) << " " |
| 695 "state", | 671 << state_machine_.GetStatesForDebugging(); |
| 696 AsValue()); | 672 state_machine_.UpdateState(action); |
| 697 VLOG(2) << "Scheduler::ProcessScheduledActions: " | 673 base::AutoReset<SchedulerStateMachine::Action> mark_inside_action( |
| 698 << SchedulerStateMachine::ActionToString(action) << " " | 674 &inside_action_, action); |
| 699 << state_machine_.GetStatesForDebugging(); | 675 switch (action) { |
| 700 state_machine_.UpdateState(action); | 676 case SchedulerStateMachine::ACTION_NONE: |
| 701 base::AutoReset<SchedulerStateMachine::Action> | 677 break; |
| 702 mark_inside_action(&inside_action_, action); | 678 case SchedulerStateMachine::ACTION_ANIMATE: |
| 703 switch (action) { | 679 client_->ScheduledActionAnimate(); |
| 704 case SchedulerStateMachine::ACTION_NONE: | 680 break; |
| 705 break; | 681 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: |
| 706 case SchedulerStateMachine::ACTION_ANIMATE: | 682 client_->ScheduledActionSendBeginMainFrame(); |
| 707 client_->ScheduledActionAnimate(); | 683 break; |
| 708 break; | 684 case SchedulerStateMachine::ACTION_COMMIT: |
| 709 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: | 685 client_->ScheduledActionCommit(); |
| 710 client_->ScheduledActionSendBeginMainFrame(); | 686 break; |
| 711 break; | 687 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: |
| 712 case SchedulerStateMachine::ACTION_COMMIT: | 688 client_->ScheduledActionActivateSyncTree(); |
| 713 client_->ScheduledActionCommit(); | 689 break; |
| 714 break; | 690 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: |
| 715 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: | 691 DrawAndSwapIfPossible(); |
| 716 client_->ScheduledActionActivateSyncTree(); | 692 break; |
| 717 break; | 693 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED: |
| 718 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: | 694 client_->ScheduledActionDrawAndSwapForced(); |
| 719 DrawAndSwapIfPossible(); | 695 break; |
| 720 break; | 696 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: |
| 721 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED: | 697 // No action is actually performed, but this allows the state machine |
| 722 client_->ScheduledActionDrawAndSwapForced(); | 698 // to advance out of it's waiting to draw state without actually |
| 723 break; | 699 // drawing. |
| 724 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: | 700 break; |
| 725 // No action is actually performed, but this allows the state machine to | 701 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: |
| 726 // advance out of its waiting to draw state without actually drawing. | 702 client_->ScheduledActionBeginOutputSurfaceCreation(); |
| 727 break; | 703 break; |
| 728 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: | 704 case SchedulerStateMachine::ACTION_PREPARE_TILES: |
| 729 client_->ScheduledActionBeginOutputSurfaceCreation(); | 705 client_->ScheduledActionPrepareTiles(); |
| 730 break; | 706 break; |
| 731 case SchedulerStateMachine::ACTION_PREPARE_TILES: | 707 case SchedulerStateMachine::ACTION_INVALIDATE_OUTPUT_SURFACE: |
| 732 client_->ScheduledActionPrepareTiles(); | 708 client_->ScheduledActionInvalidateOutputSurface(); |
| 733 break; | 709 break; |
| 734 } | 710 } |
| 735 } while (action != SchedulerStateMachine::ACTION_NONE); | 711 } while (action != SchedulerStateMachine::ACTION_NONE); |
| 712 } |
| 736 | 713 |
| 737 SetupNextBeginFrameIfNeeded(); | 714 SetupNextBeginFrameIfNeeded(); |
| 738 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); | 715 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); |
| 739 | 716 |
| 740 RescheduleBeginImplFrameDeadlineIfNeeded(); | 717 ScheduleBeginImplFrameDeadlineIfNeeded(); |
| 741 } | 718 } |
| 742 | 719 |
| 743 scoped_refptr<base::trace_event::ConvertableToTraceFormat> Scheduler::AsValue() | 720 scoped_refptr<base::trace_event::ConvertableToTraceFormat> Scheduler::AsValue() |
| 744 const { | 721 const { |
| 745 scoped_refptr<base::trace_event::TracedValue> state = | 722 scoped_refptr<base::trace_event::TracedValue> state = |
| 746 new base::trace_event::TracedValue(); | 723 new base::trace_event::TracedValue(); |
| 747 AsValueInto(state.get()); | 724 AsValueInto(state.get()); |
| 748 return state; | 725 return state; |
| 749 } | 726 } |
| 750 | 727 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 769 (AnticipatedDrawTime() - Now()).InMillisecondsF()); | 746 (AnticipatedDrawTime() - Now()).InMillisecondsF()); |
| 770 state->SetDouble("estimated_parent_draw_time_ms", | 747 state->SetDouble("estimated_parent_draw_time_ms", |
| 771 estimated_parent_draw_time_.InMillisecondsF()); | 748 estimated_parent_draw_time_.InMillisecondsF()); |
| 772 state->SetBoolean("last_set_needs_begin_frame_", | 749 state->SetBoolean("last_set_needs_begin_frame_", |
| 773 frame_source_->NeedsBeginFrames()); | 750 frame_source_->NeedsBeginFrames()); |
| 774 state->SetInteger("begin_retro_frame_args_", begin_retro_frame_args_.size()); | 751 state->SetInteger("begin_retro_frame_args_", begin_retro_frame_args_.size()); |
| 775 state->SetBoolean("begin_retro_frame_task_", | 752 state->SetBoolean("begin_retro_frame_task_", |
| 776 !begin_retro_frame_task_.IsCancelled()); | 753 !begin_retro_frame_task_.IsCancelled()); |
| 777 state->SetBoolean("begin_impl_frame_deadline_task_", | 754 state->SetBoolean("begin_impl_frame_deadline_task_", |
| 778 !begin_impl_frame_deadline_task_.IsCancelled()); | 755 !begin_impl_frame_deadline_task_.IsCancelled()); |
| 779 state->SetBoolean("poll_for_draw_triggers_task_", | |
| 780 !poll_for_draw_triggers_task_.IsCancelled()); | |
| 781 state->SetBoolean("advance_commit_state_task_", | 756 state->SetBoolean("advance_commit_state_task_", |
| 782 !advance_commit_state_task_.IsCancelled()); | 757 !advance_commit_state_task_.IsCancelled()); |
| 783 state->BeginDictionary("begin_impl_frame_args"); | 758 state->BeginDictionary("begin_impl_frame_args"); |
| 784 begin_impl_frame_args_.AsValueInto(state); | 759 begin_impl_frame_args_.AsValueInto(state); |
| 785 state->EndDictionary(); | 760 state->EndDictionary(); |
| 786 | 761 |
| 787 state->EndDictionary(); | 762 state->EndDictionary(); |
| 788 | 763 |
| 789 state->BeginDictionary("client_state"); | 764 state->BeginDictionary("client_state"); |
| 790 state->SetDouble("draw_duration_estimate_ms", | 765 state->SetDouble("draw_duration_estimate_ms", |
| (...skipping 27 matching lines...) Expand all Loading... |
| 818 } | 793 } |
| 819 | 794 |
| 820 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 795 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
| 821 return (state_machine_.commit_state() == | 796 return (state_machine_.commit_state() == |
| 822 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 797 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
| 823 state_machine_.commit_state() == | 798 state_machine_.commit_state() == |
| 824 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 799 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
| 825 } | 800 } |
| 826 | 801 |
| 827 } // namespace cc | 802 } // namespace cc |
| OLD | NEW |