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

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

Issue 1432463002: cc: Track BeginMainFrame more precisely in CompositorTimingHistory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase; fix typo Created 5 years, 1 month 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.cc » ('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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 void Scheduler::DidCreateAndInitializeOutputSurface() { 257 void Scheduler::DidCreateAndInitializeOutputSurface() {
258 TRACE_EVENT0("cc", "Scheduler::DidCreateAndInitializeOutputSurface"); 258 TRACE_EVENT0("cc", "Scheduler::DidCreateAndInitializeOutputSurface");
259 DCHECK(!frame_source_->NeedsBeginFrames()); 259 DCHECK(!frame_source_->NeedsBeginFrames());
260 DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); 260 DCHECK(begin_impl_frame_deadline_task_.IsCancelled());
261 state_machine_.DidCreateAndInitializeOutputSurface(); 261 state_machine_.DidCreateAndInitializeOutputSurface();
262 UpdateCompositorTimingHistoryRecordingEnabled(); 262 UpdateCompositorTimingHistoryRecordingEnabled();
263 ProcessScheduledActions(); 263 ProcessScheduledActions();
264 } 264 }
265 265
266 void Scheduler::NotifyBeginMainFrameStarted() { 266 void Scheduler::NotifyBeginMainFrameStarted(
267 base::TimeTicks main_thread_start_time) {
267 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted"); 268 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted");
268 state_machine_.NotifyBeginMainFrameStarted(); 269 state_machine_.NotifyBeginMainFrameStarted();
270 compositor_timing_history_->BeginMainFrameStarted(main_thread_start_time);
269 } 271 }
270 272
271 base::TimeTicks Scheduler::LastBeginImplFrameTime() { 273 base::TimeTicks Scheduler::LastBeginImplFrameTime() {
272 return begin_impl_frame_tracker_.Current().frame_time; 274 return begin_impl_frame_tracker_.Current().frame_time;
273 } 275 }
274 276
275 void Scheduler::SetupNextBeginFrameIfNeeded() { 277 void Scheduler::SetupNextBeginFrameIfNeeded() {
276 // Never call SetNeedsBeginFrames if the frame source already has the right 278 // Never call SetNeedsBeginFrames if the frame source already has the right
277 // value. 279 // value.
278 if (frame_source_->NeedsBeginFrames() != state_machine_.BeginFrameNeeded()) { 280 if (frame_source_->NeedsBeginFrames() != state_machine_.BeginFrameNeeded()) {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // BeginImplFrame starts a compositor frame that will wait up until a deadline 505 // BeginImplFrame starts a compositor frame that will wait up until a deadline
504 // for a BeginMainFrame+activation to complete before it times out and draws 506 // for a BeginMainFrame+activation to complete before it times out and draws
505 // any asynchronous animation and scroll/pinch updates. 507 // any asynchronous animation and scroll/pinch updates.
506 void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { 508 void Scheduler::BeginImplFrame(const BeginFrameArgs& args) {
507 DCHECK_EQ(state_machine_.begin_impl_frame_state(), 509 DCHECK_EQ(state_machine_.begin_impl_frame_state(),
508 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); 510 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
509 DCHECK(!BeginImplFrameDeadlinePending()); 511 DCHECK(!BeginImplFrameDeadlinePending());
510 DCHECK(state_machine_.HasInitializedOutputSurface()); 512 DCHECK(state_machine_.HasInitializedOutputSurface());
511 513
512 begin_impl_frame_tracker_.Start(args); 514 begin_impl_frame_tracker_.Start(args);
515 begin_main_frame_args_ = args;
513 state_machine_.OnBeginImplFrame(); 516 state_machine_.OnBeginImplFrame();
514 devtools_instrumentation::DidBeginFrame(layer_tree_host_id_); 517 devtools_instrumentation::DidBeginFrame(layer_tree_host_id_);
515 client_->WillBeginImplFrame(begin_impl_frame_tracker_.Current()); 518 client_->WillBeginImplFrame(begin_impl_frame_tracker_.Current());
516 519
517 ProcessScheduledActions(); 520 ProcessScheduledActions();
518 } 521 }
519 522
520 void Scheduler::ScheduleBeginImplFrameDeadline() { 523 void Scheduler::ScheduleBeginImplFrameDeadline() {
521 // The synchronous compositor does not post a deadline task. 524 // The synchronous compositor does not post a deadline task.
522 DCHECK(!settings_.using_synchronous_renderer_compositor); 525 DCHECK(!settings_.using_synchronous_renderer_compositor);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 base::AutoReset<SchedulerStateMachine::Action> 644 base::AutoReset<SchedulerStateMachine::Action>
642 mark_inside_action(&inside_action_, action); 645 mark_inside_action(&inside_action_, action);
643 switch (action) { 646 switch (action) {
644 case SchedulerStateMachine::ACTION_NONE: 647 case SchedulerStateMachine::ACTION_NONE:
645 break; 648 break;
646 case SchedulerStateMachine::ACTION_ANIMATE: 649 case SchedulerStateMachine::ACTION_ANIMATE:
647 state_machine_.WillAnimate(); 650 state_machine_.WillAnimate();
648 client_->ScheduledActionAnimate(); 651 client_->ScheduledActionAnimate();
649 break; 652 break;
650 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: 653 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
651 compositor_timing_history_->WillBeginMainFrame(); 654 compositor_timing_history_->WillBeginMainFrame(
655 begin_main_frame_args_.on_critical_path);
652 state_machine_.WillSendBeginMainFrame(); 656 state_machine_.WillSendBeginMainFrame();
657 // TODO(brianderson): Pass begin_main_frame_args_ directly to client.
653 client_->ScheduledActionSendBeginMainFrame(); 658 client_->ScheduledActionSendBeginMainFrame();
654 break; 659 break;
655 case SchedulerStateMachine::ACTION_COMMIT: { 660 case SchedulerStateMachine::ACTION_COMMIT: {
656 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is 661 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
657 // fixed. 662 // fixed.
658 tracked_objects::ScopedTracker tracking_profile4( 663 tracked_objects::ScopedTracker tracking_profile4(
659 FROM_HERE_WITH_EXPLICIT_FUNCTION( 664 FROM_HERE_WITH_EXPLICIT_FUNCTION(
660 "461509 Scheduler::ProcessScheduledActions4")); 665 "461509 Scheduler::ProcessScheduledActions4"));
661 bool commit_has_no_updates = false; 666 bool commit_has_no_updates = false;
662 state_machine_.WillCommit(commit_has_no_updates); 667 state_machine_.WillCommit(commit_has_no_updates);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 } 847 }
843 848
844 bool Scheduler::IsBeginMainFrameSentOrStarted() const { 849 bool Scheduler::IsBeginMainFrameSentOrStarted() const {
845 return (state_machine_.begin_main_frame_state() == 850 return (state_machine_.begin_main_frame_state() ==
846 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || 851 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT ||
847 state_machine_.begin_main_frame_state() == 852 state_machine_.begin_main_frame_state() ==
848 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); 853 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED);
849 } 854 }
850 855
851 } // namespace cc 856 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_state_machine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698