power: Move initialization of Daemon POD members to header.
BUG=none
TEST=emerged with FEATURES=test
Change-Id: Ia2059a130767ff46f2af50eef702a3889d617e01
Reviewed-on: https://chromium-review.googlesource.com/738839
Commit-Ready: Dan Erat <derat@chromium.org>
Tested-by: Dan Erat <derat@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
diff --git a/power_manager/powerd/daemon.cc b/power_manager/powerd/daemon.cc
index d798215..331fc8e 100644
--- a/power_manager/powerd/daemon.cc
+++ b/power_manager/powerd/daemon.cc
@@ -245,17 +245,12 @@
Daemon::Daemon(DaemonDelegate* delegate, const base::FilePath& run_dir)
: delegate_(delegate),
- session_manager_dbus_proxy_(nullptr),
- update_engine_dbus_proxy_(nullptr),
- cryptohomed_dbus_proxy_(nullptr),
state_controller_delegate_(new StateControllerDelegate(this)),
state_controller_(new policy::StateController),
input_event_handler_(new policy::InputEventHandler),
input_device_controller_(new policy::InputDeviceController),
suspender_(new policy::Suspender),
metrics_collector_(new metrics::MetricsCollector),
- factory_mode_(false),
- shutting_down_(false),
retry_shutdown_for_firmware_update_timer_(false /* retain_user_task */,
true /* is_repeating */),
wakeup_count_path_(kDefaultWakeupCountPath),
@@ -265,11 +260,6 @@
proc_path_(kDefaultProcPath),
suspended_state_path_(kDefaultSuspendedStatePath),
suspend_announced_path_(run_dir.Append(kSuspendAnnouncedFile)),
- session_state_(SessionState::STOPPED),
- created_suspended_state_file_(false),
- log_suspend_with_mosys_eventlog_(false),
- suspend_to_idle_(false),
- set_wifi_transmit_power_for_tablet_mode_(false),
video_activity_logger_(new PeriodicActivityLogger(
"Video activity",
base::TimeDelta::FromSeconds(kLogVideoActivityStoppedDelaySec),
diff --git a/power_manager/powerd/daemon.h b/power_manager/powerd/daemon.h
index 7fb1ed1..c343322 100644
--- a/power_manager/powerd/daemon.h
+++ b/power_manager/powerd/daemon.h
@@ -285,11 +285,12 @@
std::unique_ptr<system::DBusWrapperInterface> dbus_wrapper_;
- dbus::ObjectProxy* session_manager_dbus_proxy_; // owned by |dbus_wrapper_|
+ // ObjectProxy objects are owned by |dbus_wrapper_|.
+ dbus::ObjectProxy* session_manager_dbus_proxy_ = nullptr;
// May be null if |kUseCrasPref| is false.
- dbus::ObjectProxy* update_engine_dbus_proxy_; // owned by |dbus_wrapper_|
+ dbus::ObjectProxy* update_engine_dbus_proxy_ = nullptr;
// May be null if the TPM status is not needed.
- dbus::ObjectProxy* cryptohomed_dbus_proxy_; // owned by |dbus_wrapper_|
+ dbus::ObjectProxy* cryptohomed_dbus_proxy_ = nullptr;
std::unique_ptr<StateControllerDelegate> state_controller_delegate_;
std::unique_ptr<MetricsSenderInterface> metrics_sender_;
@@ -327,11 +328,11 @@
// True if the kFactoryModePref pref indicates that the system is running in
// the factory, implying that much of powerd's functionality should be
// disabled.
- bool factory_mode_;
+ bool factory_mode_ = false;
// True once the shutdown process has started. Remains true until the
// system has powered off.
- bool shutting_down_;
+ bool shutting_down_ = false;
// Recurring timer that's started if a shutdown request is deferred due to a
// firmware update. ShutDown() is called repeatedly so the system will
@@ -374,21 +375,21 @@
base::FilePath suspend_announced_path_;
// Last session state that we have been informed of. Initialized as stopped.
- SessionState session_state_;
+ SessionState session_state_ = SessionState::STOPPED;
// Set to true if powerd touched a file for crash-reporter before
// suspending. If true, the file will be unlinked after resuming.
- bool created_suspended_state_file_;
+ bool created_suspended_state_file_ = false;
// True if the "mosys" command should be used to record suspend and resume
// timestamps in eventlog.
- bool log_suspend_with_mosys_eventlog_;
+ bool log_suspend_with_mosys_eventlog_ = false;
// True if the system should suspend to idle.
- bool suspend_to_idle_;
+ bool suspend_to_idle_ = false;
// Set wifi transmit power for tablet mode.
- bool set_wifi_transmit_power_for_tablet_mode_;
+ bool set_wifi_transmit_power_for_tablet_mode_ = false;
// Used to log video, user, and audio activity and hovering.
std::unique_ptr<PeriodicActivityLogger> video_activity_logger_;