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

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

Issue 1841083007: Remove SendBeginFramesToChildren plumbing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scheduler_output_surface_client_set_beginframesource
Patch Set: Rebase Created 4 years, 8 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_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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 has_pending_tree_(false), 48 has_pending_tree_(false),
49 pending_tree_is_ready_for_activation_(false), 49 pending_tree_is_ready_for_activation_(false),
50 active_tree_needs_first_draw_(false), 50 active_tree_needs_first_draw_(false),
51 did_create_and_initialize_first_output_surface_(false), 51 did_create_and_initialize_first_output_surface_(false),
52 tree_priority_(NEW_CONTENT_TAKES_PRIORITY), 52 tree_priority_(NEW_CONTENT_TAKES_PRIORITY),
53 scroll_handler_state_( 53 scroll_handler_state_(
54 ScrollHandlerState::SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER), 54 ScrollHandlerState::SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER),
55 critical_begin_main_frame_to_activate_is_fast_(true), 55 critical_begin_main_frame_to_activate_is_fast_(true),
56 main_thread_missed_last_deadline_(false), 56 main_thread_missed_last_deadline_(false),
57 skip_next_begin_main_frame_to_reduce_latency_(false), 57 skip_next_begin_main_frame_to_reduce_latency_(false),
58 children_need_begin_frames_(false),
59 defer_commits_(false), 58 defer_commits_(false),
60 video_needs_begin_frames_(false), 59 video_needs_begin_frames_(false),
61 last_commit_had_no_updates_(false), 60 last_commit_had_no_updates_(false),
62 wait_for_ready_to_draw_(false), 61 wait_for_ready_to_draw_(false),
63 did_draw_in_last_frame_(false), 62 did_draw_in_last_frame_(false),
64 did_swap_in_last_frame_(false) {} 63 did_swap_in_last_frame_(false) {}
65 64
66 const char* SchedulerStateMachine::OutputSurfaceStateToString( 65 const char* SchedulerStateMachine::OutputSurfaceStateToString(
67 OutputSurfaceState state) { 66 OutputSurfaceState state) {
68 switch (state) { 67 switch (state) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 did_create_and_initialize_first_output_surface_); 248 did_create_and_initialize_first_output_surface_);
250 state->SetString("tree_priority", TreePriorityToString(tree_priority_)); 249 state->SetString("tree_priority", TreePriorityToString(tree_priority_));
251 state->SetString("scroll_handler_state", 250 state->SetString("scroll_handler_state",
252 ScrollHandlerStateToString(scroll_handler_state_)); 251 ScrollHandlerStateToString(scroll_handler_state_));
253 state->SetBoolean("critical_begin_main_frame_to_activate_is_fast_", 252 state->SetBoolean("critical_begin_main_frame_to_activate_is_fast_",
254 critical_begin_main_frame_to_activate_is_fast_); 253 critical_begin_main_frame_to_activate_is_fast_);
255 state->SetBoolean("main_thread_missed_last_deadline", 254 state->SetBoolean("main_thread_missed_last_deadline",
256 main_thread_missed_last_deadline_); 255 main_thread_missed_last_deadline_);
257 state->SetBoolean("skip_next_begin_main_frame_to_reduce_latency", 256 state->SetBoolean("skip_next_begin_main_frame_to_reduce_latency",
258 skip_next_begin_main_frame_to_reduce_latency_); 257 skip_next_begin_main_frame_to_reduce_latency_);
259 state->SetBoolean("children_need_begin_frames", children_need_begin_frames_);
260 state->SetBoolean("video_needs_begin_frames", video_needs_begin_frames_); 258 state->SetBoolean("video_needs_begin_frames", video_needs_begin_frames_);
261 state->SetBoolean("defer_commits", defer_commits_); 259 state->SetBoolean("defer_commits", defer_commits_);
262 state->SetBoolean("last_commit_had_no_updates", last_commit_had_no_updates_); 260 state->SetBoolean("last_commit_had_no_updates", last_commit_had_no_updates_);
263 state->SetBoolean("did_draw_in_last_frame", did_draw_in_last_frame_); 261 state->SetBoolean("did_draw_in_last_frame", did_draw_in_last_frame_);
264 state->SetBoolean("did_swap_in_last_frame", did_swap_in_last_frame_); 262 state->SetBoolean("did_swap_in_last_frame", did_swap_in_last_frame_);
265 state->EndDictionary(); 263 state->EndDictionary();
266 } 264 }
267 265
268 bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const { 266 bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const {
269 // Normally when |visible_| is false or |begin_frame_source_paused_| is true, 267 // Normally when |visible_| is false or |begin_frame_source_paused_| is true,
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 active_tree_needs_first_draw_ = false; // blocks commit if true 756 active_tree_needs_first_draw_ = false; // blocks commit if true
759 } 757 }
760 758
761 void SchedulerStateMachine::SetSkipNextBeginMainFrameToReduceLatency() { 759 void SchedulerStateMachine::SetSkipNextBeginMainFrameToReduceLatency() {
762 TRACE_EVENT_INSTANT0("cc", 760 TRACE_EVENT_INSTANT0("cc",
763 "Scheduler: SkipNextBeginMainFrameToReduceLatency", 761 "Scheduler: SkipNextBeginMainFrameToReduceLatency",
764 TRACE_EVENT_SCOPE_THREAD); 762 TRACE_EVENT_SCOPE_THREAD);
765 skip_next_begin_main_frame_to_reduce_latency_ = true; 763 skip_next_begin_main_frame_to_reduce_latency_ = true;
766 } 764 }
767 765
768 bool SchedulerStateMachine::BeginFrameRequiredForChildren() const {
769 return children_need_begin_frames_;
770 }
771
772 bool SchedulerStateMachine::BeginFrameNeededForVideo() const { 766 bool SchedulerStateMachine::BeginFrameNeededForVideo() const {
773 return video_needs_begin_frames_; 767 return video_needs_begin_frames_;
774 } 768 }
775 769
776 bool SchedulerStateMachine::BeginFrameNeeded() const { 770 bool SchedulerStateMachine::BeginFrameNeeded() const {
777 // We can't handle BeginFrames when output surface isn't initialized. 771 // We can't handle BeginFrames when output surface isn't initialized.
778 // TODO(brianderson): Support output surface creation inside a BeginFrame. 772 // TODO(brianderson): Support output surface creation inside a BeginFrame.
779 if (!HasInitializedOutputSurface()) 773 if (!HasInitializedOutputSurface())
780 return false; 774 return false;
781 775
782 // If we are not visible, we don't need BeginFrame messages. 776 // If we are not visible, we don't need BeginFrame messages.
783 if (!visible_) 777 if (!visible_)
784 return false; 778 return false;
785 779
786 return (BeginFrameRequiredForAction() || BeginFrameRequiredForChildren() || 780 return BeginFrameRequiredForAction() || BeginFrameNeededForVideo() ||
787 BeginFrameNeededForVideo() || ProactiveBeginFrameWanted()); 781 ProactiveBeginFrameWanted();
788 }
789
790 void SchedulerStateMachine::SetChildrenNeedBeginFrames(
791 bool children_need_begin_frames) {
792 children_need_begin_frames_ = children_need_begin_frames;
793 } 782 }
794 783
795 void SchedulerStateMachine::SetVideoNeedsBeginFrames( 784 void SchedulerStateMachine::SetVideoNeedsBeginFrames(
796 bool video_needs_begin_frames) { 785 bool video_needs_begin_frames) {
797 video_needs_begin_frames_ = video_needs_begin_frames; 786 video_needs_begin_frames_ = video_needs_begin_frames;
798 } 787 }
799 788
800 void SchedulerStateMachine::SetDeferCommits(bool defer_commits) { 789 void SchedulerStateMachine::SetDeferCommits(bool defer_commits) {
801 defer_commits_ = defer_commits; 790 defer_commits_ = defer_commits;
802 } 791 }
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 case OUTPUT_SURFACE_ACTIVE: 1141 case OUTPUT_SURFACE_ACTIVE:
1153 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: 1142 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT:
1154 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: 1143 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION:
1155 return true; 1144 return true;
1156 } 1145 }
1157 NOTREACHED(); 1146 NOTREACHED();
1158 return false; 1147 return false;
1159 } 1148 }
1160 1149
1161 } // namespace cc 1150 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | cc/scheduler/scheduler_state_machine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698