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

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

Issue 2778223005: Plumb activation time to main (Closed)
Patch Set: only add activate time if its not already there 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 state_machine_.SetVisible(visible); 82 state_machine_.SetVisible(visible);
83 UpdateCompositorTimingHistoryRecordingEnabled(); 83 UpdateCompositorTimingHistoryRecordingEnabled();
84 ProcessScheduledActions(); 84 ProcessScheduledActions();
85 } 85 }
86 86
87 void Scheduler::SetCanDraw(bool can_draw) { 87 void Scheduler::SetCanDraw(bool can_draw) {
88 state_machine_.SetCanDraw(can_draw); 88 state_machine_.SetCanDraw(can_draw);
89 ProcessScheduledActions(); 89 ProcessScheduledActions();
90 } 90 }
91 91
92 void Scheduler::NotifyReadyToActivate() { 92 void Scheduler::NotifyReadyToActivate(int source_frame_number) {
93 compositor_timing_history_->ReadyToActivate(); 93 compositor_timing_history_->ReadyToActivate();
94 state_machine_.NotifyReadyToActivate(); 94 state_machine_.NotifyReadyToActivate();
95 if (source_frame_number != -1) {
96 if (ready_to_activate_time_.empty() ||
97 ready_to_activate_time_.back().first != (unsigned)source_frame_number) {
brianderson 2017/04/17 23:28:50 static_cast, then lgtm.
panicker 2017/04/17 23:32:19 Done.
98 // Note the activate source-frame and timestamp
99 ready_to_activate_time_.emplace_back(source_frame_number,
100 base::TimeTicks::Now());
101 }
102 }
95 ProcessScheduledActions(); 103 ProcessScheduledActions();
96 } 104 }
97 105
98 void Scheduler::NotifyReadyToDraw() { 106 void Scheduler::NotifyReadyToDraw() {
99 // Future work might still needed for crbug.com/352894. 107 // Future work might still needed for crbug.com/352894.
100 state_machine_.NotifyReadyToDraw(); 108 state_machine_.NotifyReadyToDraw();
101 ProcessScheduledActions(); 109 ProcessScheduledActions();
102 } 110 }
103 111
104 void Scheduler::SetBeginFrameSource(BeginFrameSource* source) { 112 void Scheduler::SetBeginFrameSource(BeginFrameSource* source) {
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 609
602 void Scheduler::ProcessScheduledActions() { 610 void Scheduler::ProcessScheduledActions() {
603 // Do not perform actions during compositor shutdown. 611 // Do not perform actions during compositor shutdown.
604 if (stopped_) 612 if (stopped_)
605 return; 613 return;
606 614
607 // We do not allow ProcessScheduledActions to be recursive. 615 // We do not allow ProcessScheduledActions to be recursive.
608 // 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.
609 if (inside_process_scheduled_actions_) 617 if (inside_process_scheduled_actions_)
610 return; 618 return;
611
612 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); 619 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true);
613 620
614 SchedulerStateMachine::Action action; 621 SchedulerStateMachine::Action action;
615 do { 622 do {
616 action = state_machine_.NextAction(); 623 action = state_machine_.NextAction();
617 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), 624 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"),
618 "SchedulerStateMachine", "state", AsValue()); 625 "SchedulerStateMachine", "state", AsValue());
619 base::AutoReset<SchedulerStateMachine::Action> mark_inside_action( 626 base::AutoReset<SchedulerStateMachine::Action> mark_inside_action(
620 &inside_action_, action); 627 &inside_action_, action);
621 switch (action) { 628 switch (action) {
622 case SchedulerStateMachine::ACTION_NONE: 629 case SchedulerStateMachine::ACTION_NONE:
623 break; 630 break;
624 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: 631 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
625 compositor_timing_history_->WillBeginMainFrame( 632 compositor_timing_history_->WillBeginMainFrame(
626 begin_main_frame_args_.on_critical_path, 633 begin_main_frame_args_.on_critical_path,
627 begin_main_frame_args_.frame_time); 634 begin_main_frame_args_.frame_time);
628 state_machine_.WillSendBeginMainFrame(); 635 state_machine_.WillSendBeginMainFrame();
629 // 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();
630 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_); 640 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_);
631 break; 641 break;
632 case SchedulerStateMachine::ACTION_COMMIT: { 642 case SchedulerStateMachine::ACTION_COMMIT: {
633 bool commit_has_no_updates = false; 643 bool commit_has_no_updates = false;
634 state_machine_.WillCommit(commit_has_no_updates); 644 state_machine_.WillCommit(commit_has_no_updates);
635 client_->ScheduledActionCommit(); 645 client_->ScheduledActionCommit();
636 break; 646 break;
637 } 647 }
638 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: 648 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE:
639 compositor_timing_history_->WillActivate(); 649 compositor_timing_history_->WillActivate();
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 } 809 }
800 810
801 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const { 811 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const {
802 return BeginFrameAck( 812 return BeginFrameAck(
803 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number, 813 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number,
804 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(), 814 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(),
805 true); 815 true);
806 } 816 }
807 817
808 } // namespace cc 818 } // 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