Index: chromeos/dbus/power_policy_controller.cc |
diff --git a/chromeos/dbus/power_policy_controller.cc b/chromeos/dbus/power_policy_controller.cc |
index e7888ee3a2d11d604cbc950c488d8898958c53c6..6cd696fa4c0a6a57288fad0f543bfb025e3b750c 100644 |
--- a/chromeos/dbus/power_policy_controller.cc |
+++ b/chromeos/dbus/power_policy_controller.cc |
@@ -134,31 +134,22 @@ |
} |
PowerPolicyController::PowerPolicyController() |
- : manager_(NULL), |
- client_(NULL), |
+ : client_(NULL), |
prefs_were_set_(false), |
honor_screen_wake_locks_(true), |
next_wake_lock_id_(1) { |
} |
PowerPolicyController::~PowerPolicyController() { |
- DCHECK(manager_); |
- // The power manager's policy is reset before this point, in |
- // OnDBusThreadManagerDestroying(). At the time that |
- // PowerPolicyController is destroyed, PowerManagerClient's D-Bus proxy |
- // to the power manager is already gone. |
- client_->RemoveObserver(this); |
- client_ = NULL; |
- manager_->RemoveObserver(this); |
- manager_ = NULL; |
+ if (client_) { |
+ client_->RemoveObserver(this); |
+ client_ = NULL; |
+ } |
} |
void PowerPolicyController::Init(DBusThreadManager* manager) { |
- manager_ = manager; |
- manager_->AddObserver(this); |
- client_ = manager_->GetPowerManagerClient(); |
+ client_ = manager->GetPowerManagerClient(); |
client_->AddObserver(this); |
- SendCurrentPolicy(); |
} |
void PowerPolicyController::ApplyPrefs(const PrefValues& values) { |
@@ -220,13 +211,6 @@ |
SendCurrentPolicy(); |
} |
-void PowerPolicyController::ClearPrefs() { |
- prefs_policy_.Clear(); |
- honor_screen_wake_locks_ = true; |
- prefs_were_set_ = false; |
- SendCurrentPolicy(); |
-} |
- |
int PowerPolicyController::AddScreenWakeLock(const std::string& reason) { |
int id = next_wake_lock_id_++; |
screen_wake_locks_[id] = reason; |
@@ -246,12 +230,6 @@ |
LOG(WARNING) << "Ignoring request to remove nonexistent wake lock " << id; |
else |
SendCurrentPolicy(); |
-} |
- |
-void PowerPolicyController::OnDBusThreadManagerDestroying( |
- DBusThreadManager* manager) { |
- DCHECK_EQ(manager, manager_); |
- SendEmptyPolicy(); |
} |
void PowerPolicyController::PowerManagerRestarted() { |
@@ -301,8 +279,4 @@ |
client_->SetPolicy(policy); |
} |
-void PowerPolicyController::SendEmptyPolicy() { |
- client_->SetPolicy(power_manager::PowerManagementPolicy()); |
-} |
- |
} // namespace chromeos |