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

Side by Side Diff: cc/scheduler/scheduler_state_machine.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
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/scheduler/scheduler_unittest.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_state_machine.h" 5 #include "cc/scheduler/scheduler_state_machine.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 output_surface_state_ = OUTPUT_SURFACE_ACTIVE; 606 output_surface_state_ = OUTPUT_SURFACE_ACTIVE;
607 } 607 }
608 } 608 }
609 609
610 // Update state if there's no updates heading for the active tree, but we need 610 // Update state if there's no updates heading for the active tree, but we need
611 // to do a forced draw. 611 // to do a forced draw.
612 if (commit_has_no_updates && 612 if (commit_has_no_updates &&
613 forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) { 613 forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) {
614 DCHECK(!has_pending_tree_); 614 DCHECK(!has_pending_tree_);
615 needs_redraw_ = true; 615 needs_redraw_ = true;
616 active_tree_needs_first_draw_ = true;
617 } 616 }
618 617
619 // This post-commit work is common to both completed and aborted commits. 618 // This post-commit work is common to both completed and aborted commits.
620 pending_tree_is_ready_for_activation_ = false; 619 pending_tree_is_ready_for_activation_ = false;
621 620
622 last_commit_had_no_updates_ = commit_has_no_updates; 621 last_commit_had_no_updates_ = commit_has_no_updates;
623 } 622 }
624 623
625 void SchedulerStateMachine::WillActivate() { 624 void SchedulerStateMachine::WillActivate() {
626 if (begin_main_frame_state_ == 625 if (begin_main_frame_state_ ==
627 BEGIN_MAIN_FRAME_STATE_WAITING_FOR_ACTIVATION) { 626 BEGIN_MAIN_FRAME_STATE_WAITING_FOR_ACTIVATION) {
628 begin_main_frame_state_ = settings_.commit_to_active_tree 627 begin_main_frame_state_ = settings_.commit_to_active_tree
629 ? BEGIN_MAIN_FRAME_STATE_WAITING_FOR_DRAW 628 ? BEGIN_MAIN_FRAME_STATE_WAITING_FOR_DRAW
630 : BEGIN_MAIN_FRAME_STATE_IDLE; 629 : BEGIN_MAIN_FRAME_STATE_IDLE;
631 } 630 }
632 631
633 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION) 632 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION)
634 output_surface_state_ = OUTPUT_SURFACE_ACTIVE; 633 output_surface_state_ = OUTPUT_SURFACE_ACTIVE;
635 634
636 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_ACTIVATION) 635 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_ACTIVATION)
637 forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_DRAW; 636 forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_DRAW;
638 637
639 has_pending_tree_ = false; 638 has_pending_tree_ = false;
640 pending_tree_is_ready_for_activation_ = false; 639 pending_tree_is_ready_for_activation_ = false;
641 active_tree_needs_first_draw_ = true; 640 active_tree_needs_first_draw_ = true;
642 needs_redraw_ = true; 641 needs_redraw_ = true;
643 } 642 }
644 643
645 void SchedulerStateMachine::WillDrawInternal() { 644 void SchedulerStateMachine::WillDrawInternal() {
645 // If a new active tree is pending after the one we are about to draw,
646 // the main thread is in a high latency mode.
647 // main_thread_missed_last_deadline_ is here in addition to
648 // OnBeginImplFrameIdle for cases where the scheduler aborts draws outside
649 // of the deadline.
650 main_thread_missed_last_deadline_ = CommitPending() || has_pending_tree_;
brianderson 2016/02/19 01:52:17 Need to add a unit test for this, but probably won
651
646 // We need to reset needs_redraw_ before we draw since the 652 // We need to reset needs_redraw_ before we draw since the
647 // draw itself might request another draw. 653 // draw itself might request another draw.
648 needs_redraw_ = false; 654 needs_redraw_ = false;
649 655
650 draw_funnel_ = true; 656 draw_funnel_ = true;
651 active_tree_needs_first_draw_ = false; 657 active_tree_needs_first_draw_ = false;
652 did_draw_in_last_frame_ = true; 658 did_draw_in_last_frame_ = true;
653 last_frame_number_draw_performed_ = current_frame_number_; 659 last_frame_number_draw_performed_ = current_frame_number_;
654 660
655 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) 661 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW)
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 case OUTPUT_SURFACE_ACTIVE: 1142 case OUTPUT_SURFACE_ACTIVE:
1137 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: 1143 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT:
1138 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: 1144 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION:
1139 return true; 1145 return true;
1140 } 1146 }
1141 NOTREACHED(); 1147 NOTREACHED();
1142 return false; 1148 return false;
1143 } 1149 }
1144 1150
1145 } // namespace cc 1151 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698