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

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

Issue 2754943002: Reimplement vsync latency UMA to be based on BeginImplFrame rather than BeginMainFrame (Closed)
Patch Set: Created 3 years, 9 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } 319 }
320 320
321 void Scheduler::BeginImplFrameWithDeadline(const BeginFrameArgs& args) { 321 void Scheduler::BeginImplFrameWithDeadline(const BeginFrameArgs& args) {
322 // The storage for |args| is owned by the missed begin frame task. Therefore 322 // The storage for |args| is owned by the missed begin frame task. Therefore
323 // save |args| before cancelling the task either here or in the deadline. 323 // save |args| before cancelling the task either here or in the deadline.
324 BeginFrameArgs adjusted_args = args; 324 BeginFrameArgs adjusted_args = args;
325 // Cancel the missed begin frame task in case the BFS sends a begin frame 325 // Cancel the missed begin frame task in case the BFS sends a begin frame
326 // before the missed frame task runs. 326 // before the missed frame task runs.
327 missed_begin_frame_task_.Cancel(); 327 missed_begin_frame_task_.Cancel();
328 328
329 base::TimeTicks now = Now(); 329 base::TimeTicks now = Now();
brianderson 2017/03/16 19:11:56 You could re-use this Now() and pass it to BeginIm
stanisc 2017/03/16 20:45:48 Done.
330 330
331 // Discard missed begin frames if they are too late. 331 // Discard missed begin frames if they are too late.
332 if (adjusted_args.type == BeginFrameArgs::MISSED && 332 if (adjusted_args.type == BeginFrameArgs::MISSED &&
333 now > adjusted_args.deadline) { 333 now > adjusted_args.deadline) {
334 SendBeginFrameAck(adjusted_args, kBeginFrameSkipped); 334 SendBeginFrameAck(adjusted_args, kBeginFrameSkipped);
335 return; 335 return;
336 } 336 }
337 337
338 // Run the previous deadline if any. 338 // Run the previous deadline if any.
339 if (state_machine_.begin_impl_frame_state() == 339 if (state_machine_.begin_impl_frame_state() ==
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { 466 void Scheduler::BeginImplFrame(const BeginFrameArgs& args) {
467 DCHECK_EQ(state_machine_.begin_impl_frame_state(), 467 DCHECK_EQ(state_machine_.begin_impl_frame_state(),
468 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); 468 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
469 DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); 469 DCHECK(begin_impl_frame_deadline_task_.IsCancelled());
470 DCHECK(state_machine_.HasInitializedCompositorFrameSink()); 470 DCHECK(state_machine_.HasInitializedCompositorFrameSink());
471 471
472 begin_impl_frame_tracker_.Start(args); 472 begin_impl_frame_tracker_.Start(args);
473 state_machine_.OnBeginImplFrame(args.source_id, args.sequence_number); 473 state_machine_.OnBeginImplFrame(args.source_id, args.sequence_number);
474 devtools_instrumentation::DidBeginFrame(layer_tree_host_id_); 474 devtools_instrumentation::DidBeginFrame(layer_tree_host_id_);
475 compositor_timing_history_->WillBeginImplFrame( 475 compositor_timing_history_->WillBeginImplFrame(
476 state_machine_.NewActiveTreeLikely()); 476 state_machine_.NewActiveTreeLikely(), args.frame_time, args.type);
477 client_->WillBeginImplFrame(begin_impl_frame_tracker_.Current()); 477 client_->WillBeginImplFrame(begin_impl_frame_tracker_.Current());
478 478
479 ProcessScheduledActions(); 479 ProcessScheduledActions();
480 } 480 }
481 481
482 void Scheduler::ScheduleBeginImplFrameDeadline() { 482 void Scheduler::ScheduleBeginImplFrameDeadline() {
483 // The synchronous compositor does not post a deadline task. 483 // The synchronous compositor does not post a deadline task.
484 DCHECK(!settings_.using_synchronous_renderer_compositor); 484 DCHECK(!settings_.using_synchronous_renderer_compositor);
485 485
486 begin_impl_frame_deadline_task_.Cancel(); 486 begin_impl_frame_deadline_task_.Cancel();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), 617 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"),
618 "SchedulerStateMachine", "state", AsValue()); 618 "SchedulerStateMachine", "state", AsValue());
619 base::AutoReset<SchedulerStateMachine::Action> mark_inside_action( 619 base::AutoReset<SchedulerStateMachine::Action> mark_inside_action(
620 &inside_action_, action); 620 &inside_action_, action);
621 switch (action) { 621 switch (action) {
622 case SchedulerStateMachine::ACTION_NONE: 622 case SchedulerStateMachine::ACTION_NONE:
623 break; 623 break;
624 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: 624 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
625 compositor_timing_history_->WillBeginMainFrame( 625 compositor_timing_history_->WillBeginMainFrame(
626 begin_main_frame_args_.on_critical_path, 626 begin_main_frame_args_.on_critical_path,
627 begin_main_frame_args_.frame_time, 627 begin_main_frame_args_.frame_time);
628 begin_main_frame_args_.type);
629 state_machine_.WillSendBeginMainFrame(); 628 state_machine_.WillSendBeginMainFrame();
630 // TODO(brianderson): Pass begin_main_frame_args_ directly to client. 629 // TODO(brianderson): Pass begin_main_frame_args_ directly to client.
631 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_); 630 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_);
632 break; 631 break;
633 case SchedulerStateMachine::ACTION_COMMIT: { 632 case SchedulerStateMachine::ACTION_COMMIT: {
634 bool commit_has_no_updates = false; 633 bool commit_has_no_updates = false;
635 state_machine_.WillCommit(commit_has_no_updates); 634 state_machine_.WillCommit(commit_has_no_updates);
636 client_->ScheduledActionCommit(); 635 client_->ScheduledActionCommit();
637 break; 636 break;
638 } 637 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 } 799 }
801 800
802 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const { 801 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const {
803 return BeginFrameAck( 802 return BeginFrameAck(
804 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number, 803 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number,
805 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(), 804 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(),
806 0, true); 805 0, true);
807 } 806 }
808 807
809 } // namespace cc 808 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698