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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 sync_tree) { |
93 compositor_timing_history_->ReadyToActivate(); | 93 compositor_timing_history_->ReadyToActivate(); |
94 state_machine_.NotifyReadyToActivate(); | 94 state_machine_.NotifyReadyToActivate(); |
95 // Note the activate source-frame and timestamp | |
96 if (sync_tree != 0) { | |
97 ready_to_activate_time_.emplace_back( | |
98 std::make_pair(sync_tree, base::TimeTicks::Now())); | |
brianderson
2017/04/10 23:12:47
I was under the impression you might be able to re
panicker
2017/04/11 22:19:37
Good catch, done.
| |
99 /* TODO: REMOVE ME */ | |
100 fprintf(stderr, "\n\t\tScheduler::NotifyReadyToActivate: synctree: %d", | |
101 sync_tree); | |
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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
620 &inside_action_, action); | 628 &inside_action_, action); |
621 switch (action) { | 629 switch (action) { |
622 case SchedulerStateMachine::ACTION_NONE: | 630 case SchedulerStateMachine::ACTION_NONE: |
623 break; | 631 break; |
624 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: | 632 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: |
625 compositor_timing_history_->WillBeginMainFrame( | 633 compositor_timing_history_->WillBeginMainFrame( |
626 begin_main_frame_args_.on_critical_path, | 634 begin_main_frame_args_.on_critical_path, |
627 begin_main_frame_args_.frame_time); | 635 begin_main_frame_args_.frame_time); |
628 state_machine_.WillSendBeginMainFrame(); | 636 state_machine_.WillSendBeginMainFrame(); |
629 // TODO(brianderson): Pass begin_main_frame_args_ directly to client. | 637 // TODO(brianderson): Pass begin_main_frame_args_ directly to client. |
638 begin_main_frame_args_.ready_to_activate_time = | |
639 std::move(ready_to_activate_time_); | |
brianderson
2017/04/10 23:12:47
After the move, ready_to_activate_time_ is in an v
panicker
2017/04/11 22:19:37
Done.
| |
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 Loading... | |
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 |
OLD | NEW |