Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Side by Side Diff: cc/scheduler/scheduler.cc

Issue 2778223005: Plumb activation time to main (Closed)
Patch Set: review comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 state_machine_.SetVisible(visible); 75 state_machine_.SetVisible(visible);
76 UpdateCompositorTimingHistoryRecordingEnabled(); 76 UpdateCompositorTimingHistoryRecordingEnabled();
77 ProcessScheduledActions(); 77 ProcessScheduledActions();
78 } 78 }
79 79
80 void Scheduler::SetCanDraw(bool can_draw) { 80 void Scheduler::SetCanDraw(bool can_draw) {
81 state_machine_.SetCanDraw(can_draw); 81 state_machine_.SetCanDraw(can_draw);
82 ProcessScheduledActions(); 82 ProcessScheduledActions();
83 } 83 }
84 84
85 void Scheduler::NotifyReadyToActivate() { 85 void Scheduler::NotifyReadyToActivate(int source_frame_number) {
86 compositor_timing_history_->ReadyToActivate(); 86 compositor_timing_history_->ReadyToActivate();
87 state_machine_.NotifyReadyToActivate(); 87 state_machine_.NotifyReadyToActivate();
88 if (source_frame_number != -1) {
89 if (ready_to_activate_time_.empty() ||
90 ready_to_activate_time_.back().first !=
91 static_cast<unsigned>(source_frame_number)) {
92 // Note the activate source-frame and timestamp
93 ready_to_activate_time_.emplace_back(source_frame_number,
94 base::TimeTicks::Now());
95 }
96 }
88 ProcessScheduledActions(); 97 ProcessScheduledActions();
89 } 98 }
90 99
91 void Scheduler::NotifyReadyToDraw() { 100 void Scheduler::NotifyReadyToDraw() {
92 // Future work might still needed for crbug.com/352894. 101 // Future work might still needed for crbug.com/352894.
93 state_machine_.NotifyReadyToDraw(); 102 state_machine_.NotifyReadyToDraw();
94 ProcessScheduledActions(); 103 ProcessScheduledActions();
95 } 104 }
96 105
97 void Scheduler::SetBeginFrameSource(BeginFrameSource* source) { 106 void Scheduler::SetBeginFrameSource(BeginFrameSource* source) {
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 609
601 void Scheduler::ProcessScheduledActions() { 610 void Scheduler::ProcessScheduledActions() {
602 // Do not perform actions during compositor shutdown. 611 // Do not perform actions during compositor shutdown.
603 if (stopped_) 612 if (stopped_)
604 return; 613 return;
605 614
606 // We do not allow ProcessScheduledActions to be recursive. 615 // We do not allow ProcessScheduledActions to be recursive.
607 // The top-level call will iteratively execute the next action for us anyway. 616 // The top-level call will iteratively execute the next action for us anyway.
608 if (inside_process_scheduled_actions_) 617 if (inside_process_scheduled_actions_)
609 return; 618 return;
610
611 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); 619 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true);
612 620
613 SchedulerStateMachine::Action action; 621 SchedulerStateMachine::Action action;
614 do { 622 do {
615 action = state_machine_.NextAction(); 623 action = state_machine_.NextAction();
616 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), 624 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"),
617 "SchedulerStateMachine", "state", AsValue()); 625 "SchedulerStateMachine", "state", AsValue());
618 base::AutoReset<SchedulerStateMachine::Action> mark_inside_action( 626 base::AutoReset<SchedulerStateMachine::Action> mark_inside_action(
619 &inside_action_, action); 627 &inside_action_, action);
620 switch (action) { 628 switch (action) {
621 case SchedulerStateMachine::ACTION_NONE: 629 case SchedulerStateMachine::ACTION_NONE:
622 break; 630 break;
623 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: 631 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
624 compositor_timing_history_->WillBeginMainFrame( 632 compositor_timing_history_->WillBeginMainFrame(
625 begin_main_frame_args_.on_critical_path, 633 begin_main_frame_args_.on_critical_path,
626 begin_main_frame_args_.frame_time); 634 begin_main_frame_args_.frame_time);
627 state_machine_.WillSendBeginMainFrame(); 635 state_machine_.WillSendBeginMainFrame();
628 // TODO(brianderson): Pass begin_main_frame_args_ directly to client. 636 // TODO(brianderson): Pass begin_main_frame_args_ directly to client.
637 begin_main_frame_args_.ready_to_activate_time =
638 std::move(ready_to_activate_time_);
639 ready_to_activate_time_.clear();
629 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_); 640 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_);
630 break; 641 break;
631 case SchedulerStateMachine::ACTION_COMMIT: { 642 case SchedulerStateMachine::ACTION_COMMIT: {
632 bool commit_has_no_updates = false; 643 bool commit_has_no_updates = false;
633 state_machine_.WillCommit(commit_has_no_updates); 644 state_machine_.WillCommit(commit_has_no_updates);
634 client_->ScheduledActionCommit(); 645 client_->ScheduledActionCommit();
635 break; 646 break;
636 } 647 }
637 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: 648 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE:
638 compositor_timing_history_->WillActivate(); 649 compositor_timing_history_->WillActivate();
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 } 822 }
812 823
813 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const { 824 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const {
814 return BeginFrameAck( 825 return BeginFrameAck(
815 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number, 826 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number,
816 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(), 827 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(),
817 true); 828 true);
818 } 829 }
819 830
820 } // namespace cc 831 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698