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

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: respond to Brian'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 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 client_->ScheduledActionBeginMainFrameNotExpectedUntil(time);
221 }
222
218 void Scheduler::BeginImplFrameNotExpectedSoon() { 223 void Scheduler::BeginImplFrameNotExpectedSoon() {
219 compositor_timing_history_->BeginImplFrameNotExpectedSoon(); 224 compositor_timing_history_->BeginImplFrameNotExpectedSoon();
220 225
221 // Tying this to SendBeginMainFrameNotExpectedSoon will have some 226 // Tying this to SendBeginMainFrameNotExpectedSoon will have some
222 // false negatives, but we want to avoid running long idle tasks when 227 // false negatives, but we want to avoid running long idle tasks when
223 // we are actually active. 228 // we are actually active.
224 client_->SendBeginMainFrameNotExpectedSoon(); 229 client_->SendBeginMainFrameNotExpectedSoon();
225 } 230 }
226 231
227 void Scheduler::SetupNextBeginFrameIfNeeded() { 232 void Scheduler::SetupNextBeginFrameIfNeeded() {
(...skipping 394 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 157 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

Powered by Google App Engine
This is Rietveld 408576698