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

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: Initialize on_battery_power_ bool 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
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 30 matching lines...) Expand all
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_commit_after_animating_(false), 46 did_commit_after_animating_(false),
47 did_create_and_initialize_first_output_surface_(false), 47 did_create_and_initialize_first_output_surface_(false),
48 impl_latency_takes_priority_(false), 48 impl_latency_takes_priority_(false),
49 skip_next_begin_main_frame_to_reduce_latency_(false), 49 skip_next_begin_main_frame_to_reduce_latency_(false),
50 skip_begin_main_frame_to_reduce_latency_(false), 50 skip_begin_main_frame_to_reduce_latency_(false),
51 continuous_painting_(false) { 51 continuous_painting_(false),
52 on_battery_power_(false) {
52 } 53 }
53 54
54 const char* SchedulerStateMachine::OutputSurfaceStateToString( 55 const char* SchedulerStateMachine::OutputSurfaceStateToString(
55 OutputSurfaceState state) { 56 OutputSurfaceState state) {
56 switch (state) { 57 switch (state) {
57 case OUTPUT_SURFACE_ACTIVE: 58 case OUTPUT_SURFACE_ACTIVE:
58 return "OUTPUT_SURFACE_ACTIVE"; 59 return "OUTPUT_SURFACE_ACTIVE";
59 case OUTPUT_SURFACE_LOST: 60 case OUTPUT_SURFACE_LOST:
60 return "OUTPUT_SURFACE_LOST"; 61 return "OUTPUT_SURFACE_LOST";
61 case OUTPUT_SURFACE_CREATING: 62 case OUTPUT_SURFACE_CREATING:
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 did_create_and_initialize_first_output_surface_); 232 did_create_and_initialize_first_output_surface_);
232 state->SetBoolean("impl_latency_takes_priority", 233 state->SetBoolean("impl_latency_takes_priority",
233 impl_latency_takes_priority_); 234 impl_latency_takes_priority_);
234 state->SetBoolean("main_thread_is_in_high_latency_mode", 235 state->SetBoolean("main_thread_is_in_high_latency_mode",
235 MainThreadIsInHighLatencyMode()); 236 MainThreadIsInHighLatencyMode());
236 state->SetBoolean("skip_begin_main_frame_to_reduce_latency", 237 state->SetBoolean("skip_begin_main_frame_to_reduce_latency",
237 skip_begin_main_frame_to_reduce_latency_); 238 skip_begin_main_frame_to_reduce_latency_);
238 state->SetBoolean("skip_next_begin_main_frame_to_reduce_latency", 239 state->SetBoolean("skip_next_begin_main_frame_to_reduce_latency",
239 skip_next_begin_main_frame_to_reduce_latency_); 240 skip_next_begin_main_frame_to_reduce_latency_);
240 state->SetBoolean("continuous_painting", continuous_painting_); 241 state->SetBoolean("continuous_painting", continuous_painting_);
242 state->SetBoolean("on_battery_power", on_battery_power_);
241 state->EndDictionary(); 243 state->EndDictionary();
242 } 244 }
243 245
244 void SchedulerStateMachine::AdvanceCurrentFrameNumber() { 246 void SchedulerStateMachine::AdvanceCurrentFrameNumber() {
245 current_frame_number_++; 247 current_frame_number_++;
246 248
247 // "Drain" the ManageTiles funnel. 249 // "Drain" the ManageTiles funnel.
248 if (manage_tiles_funnel_ > 0) 250 if (manage_tiles_funnel_ > 0)
249 manage_tiles_funnel_--; 251 manage_tiles_funnel_--;
250 252
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 // don't have a pending tree -- otherwise we should give it a chance to 874 // don't have a pending tree -- otherwise we should give it a chance to
873 // activate. 875 // activate.
874 // TODO(skyostil): Revisit this when we have more accurate deadline estimates. 876 // TODO(skyostil): Revisit this when we have more accurate deadline estimates.
875 if (commit_state_ == COMMIT_STATE_IDLE && !has_pending_tree_) 877 if (commit_state_ == COMMIT_STATE_IDLE && !has_pending_tree_)
876 return true; 878 return true;
877 879
878 // Prioritize impl-thread draws in impl_latency_takes_priority_ mode. 880 // Prioritize impl-thread draws in impl_latency_takes_priority_ mode.
879 if (impl_latency_takes_priority_) 881 if (impl_latency_takes_priority_)
880 return true; 882 return true;
881 883
884 // If we are on battery power and want to prioritize impl latency because
885 // we don't trust deadline tasks to execute at the right time.
886 if (settings_.prioritize_impl_latency_on_battery && on_battery_power_)
danakj 2014/10/09 21:18:02 i'd say leave on_battery_power_ always false if th
sunnyps 2014/10/09 22:04:39 I agree. I'll rename on_battery_power_ to impl_lat
danakj 2014/10/09 22:08:27 Eh, maybe it's fine to have it just be false when
887 return true;
888
882 return false; 889 return false;
883 } 890 }
884 891
885 bool SchedulerStateMachine::MainThreadIsInHighLatencyMode() const { 892 bool SchedulerStateMachine::MainThreadIsInHighLatencyMode() const {
886 // If a commit is pending before the previous commit has been drawn, we 893 // If a commit is pending before the previous commit has been drawn, we
887 // are definitely in a high latency mode. 894 // are definitely in a high latency mode.
888 if (CommitPending() && (active_tree_needs_first_draw_ || has_pending_tree_)) 895 if (CommitPending() && (active_tree_needs_first_draw_ || has_pending_tree_))
889 return true; 896 return true;
890 897
891 // If we just sent a BeginMainFrame and haven't hit the deadline yet, the main 898 // 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
1099 static_cast<int>(begin_impl_frame_state_), 1106 static_cast<int>(begin_impl_frame_state_),
1100 static_cast<int>(commit_state_), 1107 static_cast<int>(commit_state_),
1101 has_pending_tree_ ? 'T' : 'F', 1108 has_pending_tree_ ? 'T' : 'F',
1102 pending_tree_is_ready_for_activation_ ? 'T' : 'F', 1109 pending_tree_is_ready_for_activation_ ? 'T' : 'F',
1103 active_tree_needs_first_draw_ ? 'T' : 'F', 1110 active_tree_needs_first_draw_ ? 'T' : 'F',
1104 max_pending_swaps_, 1111 max_pending_swaps_,
1105 pending_swaps_); 1112 pending_swaps_);
1106 } 1113 }
1107 1114
1108 } // namespace cc 1115 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698