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

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: fix up some const refs that should be POD. Fix up state machine decision comments. add some logging. 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 TRACE_EVENT0("cc", "Scheduler::BeginMainFrameNotExpectedUntil");
220 compositor_timing_history_->BeginImplFrameNotExpectedSoon();
brianderson 2017/04/07 22:03:16 Do not call compositor_timing_history_->BeingImplF
Dan Elphick 2017/04/10 15:53:22 Done.
221 client_->ScheduledActionBeginMainFrameNotExpectedUntil(time);
222 }
223
218 void Scheduler::BeginImplFrameNotExpectedSoon() { 224 void Scheduler::BeginImplFrameNotExpectedSoon() {
219 compositor_timing_history_->BeginImplFrameNotExpectedSoon(); 225 compositor_timing_history_->BeginImplFrameNotExpectedSoon();
220 226
221 // Tying this to SendBeginMainFrameNotExpectedSoon will have some 227 // Tying this to SendBeginMainFrameNotExpectedSoon will have some
222 // false negatives, but we want to avoid running long idle tasks when 228 // false negatives, but we want to avoid running long idle tasks when
223 // we are actually active. 229 // we are actually active.
224 client_->SendBeginMainFrameNotExpectedSoon(); 230 client_->SendBeginMainFrameNotExpectedSoon();
225 } 231 }
226 232
227 void Scheduler::SetupNextBeginFrameIfNeeded() { 233 void Scheduler::SetupNextBeginFrameIfNeeded() {
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 case SchedulerStateMachine::ACTION_NONE: 628 case SchedulerStateMachine::ACTION_NONE:
623 break; 629 break;
624 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: 630 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
625 compositor_timing_history_->WillBeginMainFrame( 631 compositor_timing_history_->WillBeginMainFrame(
626 begin_main_frame_args_.on_critical_path, 632 begin_main_frame_args_.on_critical_path,
627 begin_main_frame_args_.frame_time); 633 begin_main_frame_args_.frame_time);
628 state_machine_.WillSendBeginMainFrame(); 634 state_machine_.WillSendBeginMainFrame();
629 // TODO(brianderson): Pass begin_main_frame_args_ directly to client. 635 // TODO(brianderson): Pass begin_main_frame_args_ directly to client.
630 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_); 636 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_);
631 break; 637 break;
638 case SchedulerStateMachine::ACTION_NOTIFY_BEGIN_MAIN_FRAME_NOT_SENT:
639 state_machine_.WillNotifyBeginMainFrameNotSent();
640 BeginMainFrameNotExpectedUntil(begin_main_frame_args_.frame_time +
641 begin_main_frame_args_.interval);
642 break;
632 case SchedulerStateMachine::ACTION_COMMIT: { 643 case SchedulerStateMachine::ACTION_COMMIT: {
633 bool commit_has_no_updates = false; 644 bool commit_has_no_updates = false;
634 state_machine_.WillCommit(commit_has_no_updates); 645 state_machine_.WillCommit(commit_has_no_updates);
635 client_->ScheduledActionCommit(); 646 client_->ScheduledActionCommit();
636 break; 647 break;
637 } 648 }
638 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: 649 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE:
639 compositor_timing_history_->WillActivate(); 650 compositor_timing_history_->WillActivate();
640 state_machine_.WillActivate(); 651 state_machine_.WillActivate();
641 client_->ScheduledActionActivateSyncTree(); 652 client_->ScheduledActionActivateSyncTree();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 } 810 }
800 811
801 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const { 812 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const {
802 return BeginFrameAck( 813 return BeginFrameAck(
803 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number, 814 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number,
804 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(), 815 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(),
805 true); 816 true);
806 } 817 }
807 818
808 } // namespace cc 819 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698