Commit 4b18c52b authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Use base::MakeUnique() in more places in BatteryStatusManagerLinux.

Wrap the one remaining new call with make_scoped_refptr() to show it is
ref-counted.

Change-Id: I248f156c730fb83e9c6486b9f0ac6346d7115c22
Reviewed-on: https://chromium-review.googlesource.com/578574Reviewed-by: default avatarTim Volodine <timvolodine@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488418}
parent 17aced14
......@@ -88,7 +88,9 @@ UPowerObject::UPowerObject(
: dbus_(dbus),
proxy_(dbus_->GetObjectProxy(kUPowerServiceName,
dbus::ObjectPath(kUPowerPath))),
properties_(new UPowerProperties(proxy_, property_changed_callback)) {}
properties_(
base::MakeUnique<UPowerProperties>(proxy_,
property_changed_callback)) {}
UPowerObject::~UPowerObject() {
properties_.reset(); // before the proxy is deleted.
......@@ -252,7 +254,9 @@ BatteryObject::BatteryObject(
const PropertyChangedCallback& property_changed_callback)
: dbus_(dbus),
proxy_(dbus_->GetObjectProxy(kUPowerServiceName, device_path)),
properties_(new BatteryProperties(proxy_, property_changed_callback)) {}
properties_(
base::MakeUnique<BatteryProperties>(proxy_,
property_changed_callback)) {}
BatteryObject::~BatteryObject() {
properties_.reset(); // before the proxy is deleted.
......@@ -369,7 +373,7 @@ class BatteryStatusManagerLinux::BatteryStatusNotificationThread
dbus::Bus::Options options;
options.bus_type = dbus::Bus::SYSTEM;
options.connection_type = dbus::Bus::PRIVATE;
system_bus_ = new dbus::Bus(options);
system_bus_ = make_scoped_refptr(new dbus::Bus(options));
}
bool IsDaemonVersionBelow_0_99() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment