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

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

Issue 2753843003: Create a new action triggered when a BeginMainFrame is not expected before vsync (Closed)
Patch Set: tweak scheduler to not schedule idle work after a commit. Complete renaming. 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
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 base::TimeTicks main_thread_start_time) { 208 base::TimeTicks main_thread_start_time) {
209 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted"); 209 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted");
210 state_machine_.NotifyBeginMainFrameStarted(); 210 state_machine_.NotifyBeginMainFrameStarted();
211 compositor_timing_history_->BeginMainFrameStarted(main_thread_start_time); 211 compositor_timing_history_->BeginMainFrameStarted(main_thread_start_time);
212 } 212 }
213 213
214 base::TimeTicks Scheduler::LastBeginImplFrameTime() { 214 base::TimeTicks Scheduler::LastBeginImplFrameTime() {
215 return begin_impl_frame_tracker_.Current().frame_time; 215 return begin_impl_frame_tracker_.Current().frame_time;
216 } 216 }
217 217
218 void Scheduler::BeginMainFrameNotExpectedUntil(base::TimeTicks time) {
219 // TODO(delphick): Do we need to log this?
Sami 2017/04/06 17:39:09 Let's add: TRACE_EVENT0("cc", "Scheduler::BeginMa
Dan Elphick 2017/04/07 09:05:02 Done.
220 compositor_timing_history_->BeginImplFrameNotExpectedSoon();
221
222 client_->ScheduledActionBeginMainFrameNotExpectedUntil(time);
223 }
224
218 void Scheduler::BeginImplFrameNotExpectedSoon() { 225 void Scheduler::BeginImplFrameNotExpectedSoon() {
219 compositor_timing_history_->BeginImplFrameNotExpectedSoon(); 226 compositor_timing_history_->BeginImplFrameNotExpectedSoon();
220 227
221 // Tying this to SendBeginMainFrameNotExpectedSoon will have some 228 // Tying this to SendBeginMainFrameNotExpectedSoon will have some
222 // false negatives, but we want to avoid running long idle tasks when 229 // false negatives, but we want to avoid running long idle tasks when
223 // we are actually active. 230 // we are actually active.
224 client_->SendBeginMainFrameNotExpectedSoon(); 231 client_->SendBeginMainFrameNotExpectedSoon();
225 } 232 }
226 233
227 void Scheduler::SetupNextBeginFrameIfNeeded() { 234 void Scheduler::SetupNextBeginFrameIfNeeded() {
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
630 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_); 637 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_);
631 break; 638 break;
639 case SchedulerStateMachine::ACTION_NOTIFY_BEGIN_MAIN_FRAME_NOT_SENT:
640 state_machine_.WillNotifyBeginMainFrameNotSent();
641 BeginMainFrameNotExpectedUntil(begin_main_frame_args_.frame_time +
642 begin_main_frame_args_.interval);
643 break;
632 case SchedulerStateMachine::ACTION_COMMIT: { 644 case SchedulerStateMachine::ACTION_COMMIT: {
633 bool commit_has_no_updates = false; 645 bool commit_has_no_updates = false;
634 state_machine_.WillCommit(commit_has_no_updates); 646 state_machine_.WillCommit(commit_has_no_updates);
635 client_->ScheduledActionCommit(); 647 client_->ScheduledActionCommit();
636 break; 648 break;
637 } 649 }
638 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: 650 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE:
639 compositor_timing_history_->WillActivate(); 651 compositor_timing_history_->WillActivate();
640 state_machine_.WillActivate(); 652 state_machine_.WillActivate();
641 client_->ScheduledActionActivateSyncTree(); 653 client_->ScheduledActionActivateSyncTree();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 } 811 }
800 812
801 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const { 813 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const {
802 return BeginFrameAck( 814 return BeginFrameAck(
803 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,
804 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(), 816 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(),
805 true); 817 true);
806 } 818 }
807 819
808 } // namespace cc 820 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698