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

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

Issue 2833603002: Revert of Plumb activation time to main (Closed)
Patch Set: 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(int source_frame_number) { 85 void Scheduler::NotifyReadyToActivate() {
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 }
97 ProcessScheduledActions(); 88 ProcessScheduledActions();
98 } 89 }
99 90
100 void Scheduler::NotifyReadyToDraw() { 91 void Scheduler::NotifyReadyToDraw() {
101 // Future work might still needed for crbug.com/352894. 92 // Future work might still needed for crbug.com/352894.
102 state_machine_.NotifyReadyToDraw(); 93 state_machine_.NotifyReadyToDraw();
103 ProcessScheduledActions(); 94 ProcessScheduledActions();
104 } 95 }
105 96
106 void Scheduler::SetBeginFrameSource(BeginFrameSource* source) { 97 void Scheduler::SetBeginFrameSource(BeginFrameSource* source) {
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 600
610 void Scheduler::ProcessScheduledActions() { 601 void Scheduler::ProcessScheduledActions() {
611 // Do not perform actions during compositor shutdown. 602 // Do not perform actions during compositor shutdown.
612 if (stopped_) 603 if (stopped_)
613 return; 604 return;
614 605
615 // We do not allow ProcessScheduledActions to be recursive. 606 // We do not allow ProcessScheduledActions to be recursive.
616 // The top-level call will iteratively execute the next action for us anyway. 607 // The top-level call will iteratively execute the next action for us anyway.
617 if (inside_process_scheduled_actions_) 608 if (inside_process_scheduled_actions_)
618 return; 609 return;
610
619 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); 611 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true);
620 612
621 SchedulerStateMachine::Action action; 613 SchedulerStateMachine::Action action;
622 do { 614 do {
623 action = state_machine_.NextAction(); 615 action = state_machine_.NextAction();
624 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), 616 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"),
625 "SchedulerStateMachine", "state", AsValue()); 617 "SchedulerStateMachine", "state", AsValue());
626 base::AutoReset<SchedulerStateMachine::Action> mark_inside_action( 618 base::AutoReset<SchedulerStateMachine::Action> mark_inside_action(
627 &inside_action_, action); 619 &inside_action_, action);
628 switch (action) { 620 switch (action) {
629 case SchedulerStateMachine::ACTION_NONE: 621 case SchedulerStateMachine::ACTION_NONE:
630 break; 622 break;
631 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: 623 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
632 compositor_timing_history_->WillBeginMainFrame( 624 compositor_timing_history_->WillBeginMainFrame(
633 begin_main_frame_args_.on_critical_path, 625 begin_main_frame_args_.on_critical_path,
634 begin_main_frame_args_.frame_time); 626 begin_main_frame_args_.frame_time);
635 state_machine_.WillSendBeginMainFrame(); 627 state_machine_.WillSendBeginMainFrame();
636 // TODO(brianderson): Pass begin_main_frame_args_ directly to client. 628 // 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();
640 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_); 629 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_);
641 break; 630 break;
642 case SchedulerStateMachine::ACTION_COMMIT: { 631 case SchedulerStateMachine::ACTION_COMMIT: {
643 bool commit_has_no_updates = false; 632 bool commit_has_no_updates = false;
644 state_machine_.WillCommit(commit_has_no_updates); 633 state_machine_.WillCommit(commit_has_no_updates);
645 client_->ScheduledActionCommit(); 634 client_->ScheduledActionCommit();
646 break; 635 break;
647 } 636 }
648 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: 637 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE:
649 compositor_timing_history_->WillActivate(); 638 compositor_timing_history_->WillActivate();
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 } 811 }
823 812
824 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const { 813 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const {
825 return BeginFrameAck( 814 return BeginFrameAck(
826 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number, 815 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number,
827 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(), 816 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(),
828 true); 817 true);
829 } 818 }
830 819
831 } // namespace cc 820 } // 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