OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |