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

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

Issue 554973002: Disable scheduler deadline task on battery power in Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 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_state_machine.h ('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/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/debug/trace_event_argument.h" 8 #include "base/debug/trace_event_argument.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 29 matching lines...) Expand all
40 visible_(false), 40 visible_(false),
41 can_start_(false), 41 can_start_(false),
42 can_draw_(false), 42 can_draw_(false),
43 has_pending_tree_(false), 43 has_pending_tree_(false),
44 pending_tree_is_ready_for_activation_(false), 44 pending_tree_is_ready_for_activation_(false),
45 active_tree_needs_first_draw_(false), 45 active_tree_needs_first_draw_(false),
46 did_create_and_initialize_first_output_surface_(false), 46 did_create_and_initialize_first_output_surface_(false),
47 impl_latency_takes_priority_(false), 47 impl_latency_takes_priority_(false),
48 skip_next_begin_main_frame_to_reduce_latency_(false), 48 skip_next_begin_main_frame_to_reduce_latency_(false),
49 skip_begin_main_frame_to_reduce_latency_(false), 49 skip_begin_main_frame_to_reduce_latency_(false),
50 continuous_painting_(false) { 50 continuous_painting_(false),
51 impl_latency_takes_priority_on_battery_(false) {
51 } 52 }
52 53
53 const char* SchedulerStateMachine::OutputSurfaceStateToString( 54 const char* SchedulerStateMachine::OutputSurfaceStateToString(
54 OutputSurfaceState state) { 55 OutputSurfaceState state) {
55 switch (state) { 56 switch (state) {
56 case OUTPUT_SURFACE_ACTIVE: 57 case OUTPUT_SURFACE_ACTIVE:
57 return "OUTPUT_SURFACE_ACTIVE"; 58 return "OUTPUT_SURFACE_ACTIVE";
58 case OUTPUT_SURFACE_LOST: 59 case OUTPUT_SURFACE_LOST:
59 return "OUTPUT_SURFACE_LOST"; 60 return "OUTPUT_SURFACE_LOST";
60 case OUTPUT_SURFACE_CREATING: 61 case OUTPUT_SURFACE_CREATING:
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 did_create_and_initialize_first_output_surface_); 230 did_create_and_initialize_first_output_surface_);
230 state->SetBoolean("impl_latency_takes_priority", 231 state->SetBoolean("impl_latency_takes_priority",
231 impl_latency_takes_priority_); 232 impl_latency_takes_priority_);
232 state->SetBoolean("main_thread_is_in_high_latency_mode", 233 state->SetBoolean("main_thread_is_in_high_latency_mode",
233 MainThreadIsInHighLatencyMode()); 234 MainThreadIsInHighLatencyMode());
234 state->SetBoolean("skip_begin_main_frame_to_reduce_latency", 235 state->SetBoolean("skip_begin_main_frame_to_reduce_latency",
235 skip_begin_main_frame_to_reduce_latency_); 236 skip_begin_main_frame_to_reduce_latency_);
236 state->SetBoolean("skip_next_begin_main_frame_to_reduce_latency", 237 state->SetBoolean("skip_next_begin_main_frame_to_reduce_latency",
237 skip_next_begin_main_frame_to_reduce_latency_); 238 skip_next_begin_main_frame_to_reduce_latency_);
238 state->SetBoolean("continuous_painting", continuous_painting_); 239 state->SetBoolean("continuous_painting", continuous_painting_);
240 state->SetBoolean("impl_latency_takes_priority_on_battery",
241 impl_latency_takes_priority_on_battery_);
239 state->EndDictionary(); 242 state->EndDictionary();
240 } 243 }
241 244
242 void SchedulerStateMachine::AdvanceCurrentFrameNumber() { 245 void SchedulerStateMachine::AdvanceCurrentFrameNumber() {
243 current_frame_number_++; 246 current_frame_number_++;
244 247
245 // "Drain" the ManageTiles funnel. 248 // "Drain" the ManageTiles funnel.
246 if (manage_tiles_funnel_ > 0) 249 if (manage_tiles_funnel_ > 0)
247 manage_tiles_funnel_--; 250 manage_tiles_funnel_--;
248 251
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 // don't have a pending tree -- otherwise we should give it a chance to 867 // don't have a pending tree -- otherwise we should give it a chance to
865 // activate. 868 // activate.
866 // TODO(skyostil): Revisit this when we have more accurate deadline estimates. 869 // TODO(skyostil): Revisit this when we have more accurate deadline estimates.
867 if (commit_state_ == COMMIT_STATE_IDLE && !has_pending_tree_) 870 if (commit_state_ == COMMIT_STATE_IDLE && !has_pending_tree_)
868 return true; 871 return true;
869 872
870 // Prioritize impl-thread draws in impl_latency_takes_priority_ mode. 873 // Prioritize impl-thread draws in impl_latency_takes_priority_ mode.
871 if (impl_latency_takes_priority_) 874 if (impl_latency_takes_priority_)
872 return true; 875 return true;
873 876
877 // If we are on battery power and want to prioritize impl latency because
878 // we don't trust deadline tasks to execute at the right time.
879 if (impl_latency_takes_priority_on_battery_)
880 return true;
881
874 return false; 882 return false;
875 } 883 }
876 884
877 bool SchedulerStateMachine::MainThreadIsInHighLatencyMode() const { 885 bool SchedulerStateMachine::MainThreadIsInHighLatencyMode() const {
878 // If a commit is pending before the previous commit has been drawn, we 886 // If a commit is pending before the previous commit has been drawn, we
879 // are definitely in a high latency mode. 887 // are definitely in a high latency mode.
880 if (CommitPending() && (active_tree_needs_first_draw_ || has_pending_tree_)) 888 if (CommitPending() && (active_tree_needs_first_draw_ || has_pending_tree_))
881 return true; 889 return true;
882 890
883 // If we just sent a BeginMainFrame and haven't hit the deadline yet, the main 891 // If we just sent a BeginMainFrame and haven't hit the deadline yet, the main
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 static_cast<int>(begin_impl_frame_state_), 1099 static_cast<int>(begin_impl_frame_state_),
1092 static_cast<int>(commit_state_), 1100 static_cast<int>(commit_state_),
1093 has_pending_tree_ ? 'T' : 'F', 1101 has_pending_tree_ ? 'T' : 'F',
1094 pending_tree_is_ready_for_activation_ ? 'T' : 'F', 1102 pending_tree_is_ready_for_activation_ ? 'T' : 'F',
1095 active_tree_needs_first_draw_ ? 'T' : 'F', 1103 active_tree_needs_first_draw_ ? 'T' : 'F',
1096 max_pending_swaps_, 1104 max_pending_swaps_,
1097 pending_swaps_); 1105 pending_swaps_);
1098 } 1106 }
1099 1107
1100 } // namespace cc 1108 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698