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

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 Sami's comments 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 base::TimeTicks main_thread_start_time) { 201 base::TimeTicks main_thread_start_time) {
202 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted"); 202 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted");
203 state_machine_.NotifyBeginMainFrameStarted(); 203 state_machine_.NotifyBeginMainFrameStarted();
204 compositor_timing_history_->BeginMainFrameStarted(main_thread_start_time); 204 compositor_timing_history_->BeginMainFrameStarted(main_thread_start_time);
205 } 205 }
206 206
207 base::TimeTicks Scheduler::LastBeginImplFrameTime() { 207 base::TimeTicks Scheduler::LastBeginImplFrameTime() {
208 return begin_impl_frame_tracker_.Current().frame_time; 208 return begin_impl_frame_tracker_.Current().frame_time;
209 } 209 }
210 210
211 void Scheduler::BeginMainFrameNotExpectedUntil(base::TimeTicks time) {
212 TRACE_EVENT0("cc", "Scheduler::BeginMainFrameNotExpectedUntil");
sunnyps 2017/04/20 18:36:47 nit: might want to log time in the trace event
Dan Elphick 2017/04/26 16:31:44 Done.
213 client_->ScheduledActionBeginMainFrameNotExpectedUntil(time);
214 }
215
211 void Scheduler::BeginImplFrameNotExpectedSoon() { 216 void Scheduler::BeginImplFrameNotExpectedSoon() {
212 compositor_timing_history_->BeginImplFrameNotExpectedSoon(); 217 compositor_timing_history_->BeginImplFrameNotExpectedSoon();
213 218
214 // Tying this to SendBeginMainFrameNotExpectedSoon will have some 219 // Tying this to SendBeginMainFrameNotExpectedSoon will have some
215 // false negatives, but we want to avoid running long idle tasks when 220 // false negatives, but we want to avoid running long idle tasks when
216 // we are actually active. 221 // we are actually active.
217 client_->SendBeginMainFrameNotExpectedSoon(); 222 client_->SendBeginMainFrameNotExpectedSoon();
218 } 223 }
219 224
220 void Scheduler::SetupNextBeginFrameIfNeeded() { 225 void Scheduler::SetupNextBeginFrameIfNeeded() {
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 case SchedulerStateMachine::ACTION_NONE: 627 case SchedulerStateMachine::ACTION_NONE:
623 break; 628 break;
624 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: 629 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
625 compositor_timing_history_->WillBeginMainFrame( 630 compositor_timing_history_->WillBeginMainFrame(
626 begin_main_frame_args_.on_critical_path, 631 begin_main_frame_args_.on_critical_path,
627 begin_main_frame_args_.frame_time); 632 begin_main_frame_args_.frame_time);
628 state_machine_.WillSendBeginMainFrame(); 633 state_machine_.WillSendBeginMainFrame();
629 // TODO(brianderson): Pass begin_main_frame_args_ directly to client. 634 // TODO(brianderson): Pass begin_main_frame_args_ directly to client.
630 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_); 635 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_);
631 break; 636 break;
637 case SchedulerStateMachine::ACTION_NOTIFY_BEGIN_MAIN_FRAME_NOT_SENT:
638 state_machine_.WillNotifyBeginMainFrameNotSent();
639 BeginMainFrameNotExpectedUntil(begin_main_frame_args_.frame_time +
640 begin_main_frame_args_.interval);
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();
640 state_machine_.WillActivate(); 650 state_machine_.WillActivate();
641 client_->ScheduledActionActivateSyncTree(); 651 client_->ScheduledActionActivateSyncTree();
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 } 837 }
828 838
829 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const { 839 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const {
830 return BeginFrameAck( 840 return BeginFrameAck(
831 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number, 841 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number,
832 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(), 842 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(),
833 true); 843 true);
834 } 844 }
835 845
836 } // namespace cc 846 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698