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

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: Add BeginMainFrameNotExpectedUntil to content::CompositorImpl for Android. Created 3 years, 7 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
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_state_machine.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 base::TimeTicks main_thread_start_time) { 197 base::TimeTicks main_thread_start_time) {
198 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted"); 198 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted");
199 state_machine_.NotifyBeginMainFrameStarted(); 199 state_machine_.NotifyBeginMainFrameStarted();
200 compositor_timing_history_->BeginMainFrameStarted(main_thread_start_time); 200 compositor_timing_history_->BeginMainFrameStarted(main_thread_start_time);
201 } 201 }
202 202
203 base::TimeTicks Scheduler::LastBeginImplFrameTime() { 203 base::TimeTicks Scheduler::LastBeginImplFrameTime() {
204 return begin_impl_frame_tracker_.Current().frame_time; 204 return begin_impl_frame_tracker_.Current().frame_time;
205 } 205 }
206 206
207 void Scheduler::BeginMainFrameNotExpectedUntil(base::TimeTicks time) {
208 TRACE_EVENT1("cc", "Scheduler::BeginMainFrameNotExpectedUntil", "time", time);
209 client_->ScheduledActionBeginMainFrameNotExpectedUntil(time);
210 }
211
207 void Scheduler::BeginImplFrameNotExpectedSoon() { 212 void Scheduler::BeginImplFrameNotExpectedSoon() {
208 compositor_timing_history_->BeginImplFrameNotExpectedSoon(); 213 compositor_timing_history_->BeginImplFrameNotExpectedSoon();
209 214
210 // Tying this to SendBeginMainFrameNotExpectedSoon will have some 215 // Tying this to SendBeginMainFrameNotExpectedSoon will have some
211 // false negatives, but we want to avoid running long idle tasks when 216 // false negatives, but we want to avoid running long idle tasks when
212 // we are actually active. 217 // we are actually active.
213 client_->SendBeginMainFrameNotExpectedSoon(); 218 client_->SendBeginMainFrameNotExpectedSoon();
214 } 219 }
215 220
216 void Scheduler::SetupNextBeginFrameIfNeeded() { 221 void Scheduler::SetupNextBeginFrameIfNeeded() {
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 case SchedulerStateMachine::ACTION_NONE: 651 case SchedulerStateMachine::ACTION_NONE:
647 break; 652 break;
648 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: 653 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
649 compositor_timing_history_->WillBeginMainFrame( 654 compositor_timing_history_->WillBeginMainFrame(
650 begin_main_frame_args_.on_critical_path, 655 begin_main_frame_args_.on_critical_path,
651 begin_main_frame_args_.frame_time); 656 begin_main_frame_args_.frame_time);
652 state_machine_.WillSendBeginMainFrame(); 657 state_machine_.WillSendBeginMainFrame();
653 // TODO(brianderson): Pass begin_main_frame_args_ directly to client. 658 // TODO(brianderson): Pass begin_main_frame_args_ directly to client.
654 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_); 659 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_);
655 break; 660 break;
661 case SchedulerStateMachine::ACTION_NOTIFY_BEGIN_MAIN_FRAME_NOT_SENT:
662 state_machine_.WillNotifyBeginMainFrameNotSent();
663 BeginMainFrameNotExpectedUntil(begin_main_frame_args_.frame_time +
664 begin_main_frame_args_.interval);
665 break;
656 case SchedulerStateMachine::ACTION_COMMIT: { 666 case SchedulerStateMachine::ACTION_COMMIT: {
657 bool commit_has_no_updates = false; 667 bool commit_has_no_updates = false;
658 state_machine_.WillCommit(commit_has_no_updates); 668 state_machine_.WillCommit(commit_has_no_updates);
659 client_->ScheduledActionCommit(); 669 client_->ScheduledActionCommit();
660 break; 670 break;
661 } 671 }
662 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: 672 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE:
663 compositor_timing_history_->WillActivate(); 673 compositor_timing_history_->WillActivate();
664 state_machine_.WillActivate(); 674 state_machine_.WillActivate();
665 client_->ScheduledActionActivateSyncTree(); 675 client_->ScheduledActionActivateSyncTree();
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 } 859 }
850 860
851 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const { 861 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const {
852 return BeginFrameAck( 862 return BeginFrameAck(
853 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number, 863 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number,
854 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(), 864 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(),
855 true); 865 true);
856 } 866 }
857 867
858 } // namespace cc 868 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_state_machine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698