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

Side by Side Diff: ui/display/chromeos/display_configurator.cc

Issue 2154743003: Fix queuing of display power state change requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 4 years, 5 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 | « no previous file | ui/display/chromeos/display_configurator_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/display/chromeos/display_configurator.h" 5 #include "ui/display/chromeos/display_configurator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 } 837 }
838 838
839 void DisplayConfigurator::PrepareForExit() { 839 void DisplayConfigurator::PrepareForExit() {
840 configure_display_ = false; 840 configure_display_ = false;
841 } 841 }
842 842
843 void DisplayConfigurator::SetDisplayPowerInternal( 843 void DisplayConfigurator::SetDisplayPowerInternal(
844 chromeos::DisplayPowerState power_state, 844 chromeos::DisplayPowerState power_state,
845 int flags, 845 int flags,
846 const ConfigurationCallback& callback) { 846 const ConfigurationCallback& callback) {
847 // Only skip if the current power state is the same and the latest requested
848 // power state is the same. If |pending_power_state_ != current_power_state_|
849 // then there is a current task pending or the last configuration failed. In
850 // either case request a new configuration to make sure the state is
851 // consistent with the expectations.
847 if (power_state == current_power_state_ && 852 if (power_state == current_power_state_ &&
853 power_state == pending_power_state_ &&
848 !(flags & kSetDisplayPowerForceProbe)) { 854 !(flags & kSetDisplayPowerForceProbe)) {
849 callback.Run(true); 855 callback.Run(true);
850 return; 856 return;
851 } 857 }
852 858
853 pending_power_state_ = power_state; 859 pending_power_state_ = power_state;
854 has_pending_power_state_ = true; 860 has_pending_power_state_ = true;
855 pending_power_flags_ = flags; 861 pending_power_flags_ = flags;
856 queued_configuration_callbacks_.push_back(callback); 862 queued_configuration_callbacks_.push_back(callback);
857 863
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 last_virtual_display_id_ = max_display_id & 0xff; 1159 last_virtual_display_id_ = max_display_id & 0xff;
1154 1160
1155 return true; 1161 return true;
1156 } 1162 }
1157 1163
1158 bool DisplayConfigurator::IsDisplayOn() const { 1164 bool DisplayConfigurator::IsDisplayOn() const {
1159 return current_power_state_ != chromeos::DISPLAY_POWER_ALL_OFF; 1165 return current_power_state_ != chromeos::DISPLAY_POWER_ALL_OFF;
1160 } 1166 }
1161 1167
1162 } // namespace ui 1168 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/display/chromeos/display_configurator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698