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

Unified Diff: ui/display/chromeos/display_configurator.cc

Issue 652073002: chromeos: Don't apply stale display power state after resume (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a test 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/display/chromeos/display_configurator.h ('k') | ui/display/chromeos/display_configurator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/chromeos/display_configurator.cc
diff --git a/ui/display/chromeos/display_configurator.cc b/ui/display/chromeos/display_configurator.cc
index a32fd0b82197d737718efb64aa402d4c8ef222f2..3194636b6279e587c57dae75ef662c0f8e2c7e14 100644
--- a/ui/display/chromeos/display_configurator.cc
+++ b/ui/display/chromeos/display_configurator.cc
@@ -517,9 +517,10 @@ void DisplayConfigurator::OnConfigurationChanged() {
// so that time-consuming ConfigureDisplays() won't be called multiple times.
if (configure_timer_.IsRunning()) {
// Note: when the timer is running it is possible that a different task
- // (SetDisplayPower()) is scheduled. In these cases, prefer the already
- // scheduled task to ConfigureDisplays() since ConfigureDisplays() performs
- // only basic configuration while SetDisplayPower() will perform additional
+ // (RestoreRequestedPowerStateAfterResume()) is scheduled. In these cases,
+ // prefer the already scheduled task to ConfigureDisplays() since
+ // ConfigureDisplays() performs only basic configuration while
+ // RestoreRequestedPowerStateAfterResume() will perform additional
// operations.
configure_timer_.Reset();
} else {
@@ -557,15 +558,11 @@ void DisplayConfigurator::SuspendDisplays() {
}
void DisplayConfigurator::ResumeDisplays() {
- // Force probing to ensure that we pick up any changes that were made
- // while the system was suspended.
configure_timer_.Start(
FROM_HERE,
base::TimeDelta::FromMilliseconds(kResumeDelayMs),
- base::Bind(base::IgnoreResult(&DisplayConfigurator::SetDisplayPower),
- base::Unretained(this),
- requested_power_state_,
- kSetDisplayPowerForceProbe));
+ base::Bind(&DisplayConfigurator::RestoreRequestedPowerStateAfterResume,
+ base::Unretained(this)));
}
void DisplayConfigurator::UpdateCachedDisplays() {
@@ -725,6 +722,12 @@ void DisplayConfigurator::ConfigureDisplays() {
NotifyObservers(success, new_state);
}
+void DisplayConfigurator::RestoreRequestedPowerStateAfterResume() {
+ // Force probing to ensure that we pick up any changes that were made while
+ // the system was suspended.
+ SetDisplayPower(requested_power_state_, kSetDisplayPowerForceProbe);
+}
+
void DisplayConfigurator::NotifyObservers(
bool success,
MultipleDisplayState attempted_state) {
« no previous file with comments | « ui/display/chromeos/display_configurator.h ('k') | ui/display/chromeos/display_configurator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698