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

Unified Diff: chromeos/dbus/power_policy_controller.cc

Issue 129303003: Revert of Revert of chromeos: Don't send empty power management policies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | « chromeos/dbus/power_policy_controller.h ('k') | chromeos/dbus/power_policy_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chromeos/dbus/power_policy_controller.h ('k') | chromeos/dbus/power_policy_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698