summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-12 23:20:59 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-12 23:20:59 +0000
commitb9c63179499d968be5b9f969cad3d3ac364a90ed (patch)
tree878682bc60f3a5be9290f6fca97f036f25bd5899 /chromeos/dbus
parentef0852829d75436b0b29388a839dcadd2a497fee (diff)
downloadchromium_src-b9c63179499d968be5b9f969cad3d3ac364a90ed.zip
chromium_src-b9c63179499d968be5b9f969cad3d3ac364a90ed.tar.gz
chromium_src-b9c63179499d968be5b9f969cad3d3ac364a90ed.tar.bz2
chromeos: Only send power state after powerd is up.
Make PowerManagerClient wait for the org.chromium.PowerManager D-Bus name to be owned by powerd before making method calls to it. Previously, the class would also make method calls when it saw the name get released. Depending on how quickly powerd restarted, those calls may or may not have succeeded. BUG=320340 Review URL: https://codereview.chromium.org/114173003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240472 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus')
-rw-r--r--chromeos/dbus/power_manager_client.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/chromeos/dbus/power_manager_client.cc b/chromeos/dbus/power_manager_client.cc
index b0b327f..9019dd9 100644
--- a/chromeos/dbus/power_manager_client.cc
+++ b/chromeos/dbus/power_manager_client.cc
@@ -312,7 +312,7 @@ class PowerManagerClientImpl : public PowerManagerClient {
<< signal_name << ".";
}
- // Make a method call to power manager with no arguments and no response.
+ // Makes a method call to power manager with no arguments and no response.
void SimpleMethodCallToPowerManager(const std::string& method_name) {
dbus::MethodCall method_call(power_manager::kPowerManagerInterface,
method_name);
@@ -324,10 +324,16 @@ class PowerManagerClientImpl : public PowerManagerClient {
void NameOwnerChangedReceived(const std::string& old_owner,
const std::string& new_owner) {
- VLOG(1) << "Power manager restarted";
- RegisterSuspendDelay();
- SetIsProjecting(last_is_projecting_);
- FOR_EACH_OBSERVER(Observer, observers_, PowerManagerRestarted());
+ VLOG(1) << "Power manager restarted (old owner was "
+ << (old_owner.empty() ? "[none]" : old_owner.c_str())
+ << ", new owner is "
+ << (new_owner.empty() ? "[none]" : new_owner.c_str()) << ")";
+ if (!new_owner.empty()) {
+ VLOG(1) << "Sending initial state to power manager";
+ RegisterSuspendDelay();
+ SetIsProjecting(last_is_projecting_);
+ FOR_EACH_OBSERVER(Observer, observers_, PowerManagerRestarted());
+ }
}
void BrightnessChangedReceived(dbus::Signal* signal) {