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

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

Issue 1681393003: cc: Add MainAndImplFrameTimeDelta UMA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix sync compositor and aborted draws. Created 4 years, 10 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 begin_retro_frame_task_.Cancel(); 242 begin_retro_frame_task_.Cancel();
243 state_machine_.DidLoseOutputSurface(); 243 state_machine_.DidLoseOutputSurface();
244 UpdateCompositorTimingHistoryRecordingEnabled(); 244 UpdateCompositorTimingHistoryRecordingEnabled();
245 ProcessScheduledActions(); 245 ProcessScheduledActions();
246 } 246 }
247 247
248 void Scheduler::DidCreateAndInitializeOutputSurface() { 248 void Scheduler::DidCreateAndInitializeOutputSurface() {
249 TRACE_EVENT0("cc", "Scheduler::DidCreateAndInitializeOutputSurface"); 249 TRACE_EVENT0("cc", "Scheduler::DidCreateAndInitializeOutputSurface");
250 DCHECK(!observing_frame_source_); 250 DCHECK(!observing_frame_source_);
251 DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); 251 DCHECK(begin_impl_frame_deadline_task_.IsCancelled());
252 compositor_timing_history_->DidSwapBuffersReset();
253 state_machine_.DidCreateAndInitializeOutputSurface(); 252 state_machine_.DidCreateAndInitializeOutputSurface();
253 compositor_timing_history_->DidCreateAndInitializeOutputSurface();
254 UpdateCompositorTimingHistoryRecordingEnabled(); 254 UpdateCompositorTimingHistoryRecordingEnabled();
255 ProcessScheduledActions(); 255 ProcessScheduledActions();
256 } 256 }
257 257
258 void Scheduler::NotifyBeginMainFrameStarted( 258 void Scheduler::NotifyBeginMainFrameStarted(
259 base::TimeTicks main_thread_start_time) { 259 base::TimeTicks main_thread_start_time) {
260 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted"); 260 TRACE_EVENT0("cc", "Scheduler::NotifyBeginMainFrameStarted");
261 state_machine_.NotifyBeginMainFrameStarted(); 261 state_machine_.NotifyBeginMainFrameStarted();
262 compositor_timing_history_->BeginMainFrameStarted(main_thread_start_time); 262 compositor_timing_history_->BeginMainFrameStarted(main_thread_start_time);
263 } 263 }
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 compositor_timing_history_->WillFinishImplFrame( 656 compositor_timing_history_->WillFinishImplFrame(
657 state_machine_.needs_redraw()); 657 state_machine_.needs_redraw());
658 state_machine_.OnBeginImplFrameDeadline(); 658 state_machine_.OnBeginImplFrameDeadline();
659 ProcessScheduledActions(); 659 ProcessScheduledActions();
660 FinishImplFrame(); 660 FinishImplFrame();
661 } 661 }
662 662
663 void Scheduler::DrawAndSwapIfPossible() { 663 void Scheduler::DrawAndSwapIfPossible() {
664 bool drawing_with_new_active_tree = 664 bool drawing_with_new_active_tree =
665 state_machine_.active_tree_needs_first_draw(); 665 state_machine_.active_tree_needs_first_draw();
666 bool main_thread_missed_last_deadline =
667 state_machine_.main_thread_missed_last_deadline();
666 compositor_timing_history_->WillDraw(); 668 compositor_timing_history_->WillDraw();
667 state_machine_.WillDraw(); 669 state_machine_.WillDraw();
668 DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible(); 670 DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible();
669 state_machine_.DidDraw(result); 671 state_machine_.DidDraw(result);
670 compositor_timing_history_->DidDraw(drawing_with_new_active_tree); 672 compositor_timing_history_->DidDraw(
673 drawing_with_new_active_tree, main_thread_missed_last_deadline,
674 begin_impl_frame_tracker_.DangerousMethodCurrentOrLast().frame_time);
671 } 675 }
672 676
673 void Scheduler::DrawAndSwapForced() { 677 void Scheduler::DrawAndSwapForced() {
674 bool drawing_with_new_active_tree = 678 bool drawing_with_new_active_tree =
675 state_machine_.active_tree_needs_first_draw(); 679 state_machine_.active_tree_needs_first_draw();
680 bool main_thread_missed_last_deadline =
681 state_machine_.main_thread_missed_last_deadline();
676 compositor_timing_history_->WillDraw(); 682 compositor_timing_history_->WillDraw();
677 state_machine_.WillDraw(); 683 state_machine_.WillDraw();
678 DrawResult result = client_->ScheduledActionDrawAndSwapForced(); 684 DrawResult result = client_->ScheduledActionDrawAndSwapForced();
679 state_machine_.DidDraw(result); 685 state_machine_.DidDraw(result);
680 compositor_timing_history_->DidDraw(drawing_with_new_active_tree); 686 compositor_timing_history_->DidDraw(
687 drawing_with_new_active_tree, main_thread_missed_last_deadline,
688 begin_impl_frame_tracker_.DangerousMethodCurrentOrLast().frame_time);
681 } 689 }
682 690
683 void Scheduler::SetDeferCommits(bool defer_commits) { 691 void Scheduler::SetDeferCommits(bool defer_commits) {
684 TRACE_EVENT1("cc", "Scheduler::SetDeferCommits", 692 TRACE_EVENT1("cc", "Scheduler::SetDeferCommits",
685 "defer_commits", 693 "defer_commits",
686 defer_commits); 694 defer_commits);
687 state_machine_.SetDeferCommits(defer_commits); 695 state_machine_.SetDeferCommits(defer_commits);
688 ProcessScheduledActions(); 696 ProcessScheduledActions();
689 } 697 }
690 698
(...skipping 12 matching lines...) Expand all
703 "SchedulerStateMachine", 711 "SchedulerStateMachine",
704 "state", 712 "state",
705 AsValue()); 713 AsValue());
706 base::AutoReset<SchedulerStateMachine::Action> 714 base::AutoReset<SchedulerStateMachine::Action>
707 mark_inside_action(&inside_action_, action); 715 mark_inside_action(&inside_action_, action);
708 switch (action) { 716 switch (action) {
709 case SchedulerStateMachine::ACTION_NONE: 717 case SchedulerStateMachine::ACTION_NONE:
710 break; 718 break;
711 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: 719 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
712 compositor_timing_history_->WillBeginMainFrame( 720 compositor_timing_history_->WillBeginMainFrame(
713 begin_main_frame_args_.on_critical_path); 721 begin_main_frame_args_.on_critical_path,
722 begin_main_frame_args_.frame_time);
714 state_machine_.WillSendBeginMainFrame(); 723 state_machine_.WillSendBeginMainFrame();
715 // TODO(brianderson): Pass begin_main_frame_args_ directly to client. 724 // TODO(brianderson): Pass begin_main_frame_args_ directly to client.
716 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_); 725 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_);
717 break; 726 break;
718 case SchedulerStateMachine::ACTION_COMMIT: { 727 case SchedulerStateMachine::ACTION_COMMIT: {
719 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is 728 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
720 // fixed. 729 // fixed.
721 tracked_objects::ScopedTracker tracking_profile4( 730 tracked_objects::ScopedTracker tracking_profile4(
722 FROM_HERE_WITH_EXPLICIT_FUNCTION( 731 FROM_HERE_WITH_EXPLICIT_FUNCTION(
723 "461509 Scheduler::ProcessScheduledActions4")); 732 "461509 Scheduler::ProcessScheduledActions4"));
(...skipping 17 matching lines...) Expand all
741 DrawAndSwapIfPossible(); 750 DrawAndSwapIfPossible();
742 break; 751 break;
743 } 752 }
744 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED: 753 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED:
745 DrawAndSwapForced(); 754 DrawAndSwapForced();
746 break; 755 break;
747 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: { 756 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: {
748 // No action is actually performed, but this allows the state machine to 757 // No action is actually performed, but this allows the state machine to
749 // drain the pipeline without actually drawing. 758 // drain the pipeline without actually drawing.
750 state_machine_.AbortDrawAndSwap(); 759 state_machine_.AbortDrawAndSwap();
760 compositor_timing_history_->DrawAborted();
751 break; 761 break;
752 } 762 }
753 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: 763 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION:
754 state_machine_.WillBeginOutputSurfaceCreation(); 764 state_machine_.WillBeginOutputSurfaceCreation();
755 client_->ScheduledActionBeginOutputSurfaceCreation(); 765 client_->ScheduledActionBeginOutputSurfaceCreation();
756 break; 766 break;
757 case SchedulerStateMachine::ACTION_PREPARE_TILES: 767 case SchedulerStateMachine::ACTION_PREPARE_TILES:
758 state_machine_.WillPrepareTiles(); 768 state_machine_.WillPrepareTiles();
759 client_->ScheduledActionPrepareTiles(); 769 client_->ScheduledActionPrepareTiles();
760 break; 770 break;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 } 911 }
902 912
903 bool Scheduler::IsBeginMainFrameSentOrStarted() const { 913 bool Scheduler::IsBeginMainFrameSentOrStarted() const {
904 return (state_machine_.begin_main_frame_state() == 914 return (state_machine_.begin_main_frame_state() ==
905 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || 915 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT ||
906 state_machine_.begin_main_frame_state() == 916 state_machine_.begin_main_frame_state() ==
907 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); 917 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED);
908 } 918 }
909 919
910 } // namespace cc 920 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698