shill: cellular: Replace scoped_ptr with std::unique_ptr.
BUG=None
TEST=`USE='cellular' FEATURES=test emerge-$BOARD shill`
Change-Id: I56a7437eab6ed87d8289c61f88bed09aca54f04b
Reviewed-on: https://chromium-review.googlesource.com/223737
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
diff --git a/active_passive_out_of_credits_detector.h b/active_passive_out_of_credits_detector.h
index e62c3f8..9b8a29f 100644
--- a/active_passive_out_of_credits_detector.h
+++ b/active_passive_out_of_credits_detector.h
@@ -5,11 +5,13 @@
#ifndef SHILL_ACTIVE_PASSIVE_OUT_OF_CREDITS_DETECTOR_H_
#define SHILL_ACTIVE_PASSIVE_OUT_OF_CREDITS_DETECTOR_H_
-#include "shill/connection_health_checker.h"
-#include "shill/out_of_credits_detector.h"
+#include <memory>
#include <base/time/time.h>
+#include "shill/connection_health_checker.h"
+#include "shill/out_of_credits_detector.h"
+
namespace shill {
// Detects out-of-credits condition by monitoring for the following scenarios:
@@ -87,9 +89,9 @@
base::WeakPtrFactory<ActivePassiveOutOfCreditsDetector> weak_ptr_factory_;
// Passively monitors network traffic for network failures.
- scoped_ptr<TrafficMonitor> traffic_monitor_;
+ std::unique_ptr<TrafficMonitor> traffic_monitor_;
// Determine network health through active probes.
- scoped_ptr<ConnectionHealthChecker> health_checker_;
+ std::unique_ptr<ConnectionHealthChecker> health_checker_;
// The following members are used by the connect/disconnect loop detection.
// Time when the last connect request started.
diff --git a/active_passive_out_of_credits_detector_unittest.cc b/active_passive_out_of_credits_detector_unittest.cc
index 90ee769..5ec7a1d 100644
--- a/active_passive_out_of_credits_detector_unittest.cc
+++ b/active_passive_out_of_credits_detector_unittest.cc
@@ -110,7 +110,7 @@
vector<string> dns_servers_;
string portal_check_url_;
base::Time resume_start_time_;
- scoped_ptr<ActivePassiveOutOfCreditsDetector> out_of_credits_detector_;
+ std::unique_ptr<ActivePassiveOutOfCreditsDetector> out_of_credits_detector_;
};
const char ActivePassiveOutOfCreditsDetectorTest::kAddress[] = "000102030405";
diff --git a/cellular.cc b/cellular.cc
index 3b9c3d6..68ab15b 100644
--- a/cellular.cc
+++ b/cellular.cc
@@ -1064,7 +1064,7 @@
args.push_back(PPPDevice::kPluginPath);
args.push_back(serial_device);
is_ppp_authenticating_ = false;
- scoped_ptr<ExternalTask> new_ppp_task(
+ std::unique_ptr<ExternalTask> new_ppp_task(
new ExternalTask(modem_info_->control_interface(),
modem_info_->glib(),
weak_ptr_factory_.GetWeakPtr(),
@@ -1072,7 +1072,7 @@
if (new_ppp_task->Start(
FilePath(PPPDevice::kDaemonPath), args, environment, true, &error)) {
LOG(INFO) << "Forked pppd process.";
- ppp_task_ = new_ppp_task.Pass();
+ ppp_task_ = std::move(new_ppp_task);
}
}
diff --git a/cellular.h b/cellular.h
index 16470cb..960ea15 100644
--- a/cellular.h
+++ b/cellular.h
@@ -6,6 +6,7 @@
#define SHILL_CELLULAR_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
@@ -506,17 +507,17 @@
State state_;
ModemState modem_state_;
- scoped_ptr<CellularCapability> capability_;
+ std::unique_ptr<CellularCapability> capability_;
// Operator info objects. These objects receive updates as we receive
// information about the network operators from the SIM or OTA. In turn, they
// send out updates through their observer interfaces whenever the identity of
// the network operator changes, or any other property of the operator
// changes.
- scoped_ptr<MobileOperatorInfo> home_provider_info_;
- scoped_ptr<MobileOperatorInfo> serving_operator_info_;
+ std::unique_ptr<MobileOperatorInfo> home_provider_info_;
+ std::unique_ptr<MobileOperatorInfo> serving_operator_info_;
// Observer object to listen to updates from the operator info objects.
- scoped_ptr<MobileOperatorInfoObserver> mobile_operator_info_observer_;
+ std::unique_ptr<MobileOperatorInfoObserver> mobile_operator_info_observer_;
// ///////////////////////////////////////////////////////////////////////////
// All DBus Properties exposed by the Cellular device.
@@ -575,7 +576,7 @@
// Flag indicating that a disconnect has been explicitly requested.
bool explicit_disconnect_;
- scoped_ptr<ExternalTask> ppp_task_;
+ std::unique_ptr<ExternalTask> ppp_task_;
PPPDeviceRefPtr ppp_device_;
bool is_ppp_authenticating_;
diff --git a/cellular_bearer.cc b/cellular_bearer.cc
index 6f706ea..62960fe 100644
--- a/cellular_bearer.cc
+++ b/cellular_bearer.cc
@@ -81,7 +81,7 @@
const DBusPropertiesMap &properties,
IPAddress::Family address_family,
IPConfig::Method *ipconfig_method,
- scoped_ptr<IPConfig::Properties> *ipconfig_properties) const {
+ std::unique_ptr<IPConfig::Properties> *ipconfig_properties) const {
DCHECK(ipconfig_method);
DCHECK(ipconfig_properties);
diff --git a/cellular_bearer.h b/cellular_bearer.h
index 01984a5..2fcab0b 100644
--- a/cellular_bearer.h
+++ b/cellular_bearer.h
@@ -5,11 +5,11 @@
#ifndef SHILL_CELLULAR_BEARER_H_
#define SHILL_CELLULAR_BEARER_H_
+#include <memory>
#include <string>
#include <vector>
#include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
#include <gtest/gtest_prod.h>
#include "shill/dbus_properties.h"
@@ -76,7 +76,7 @@
const DBusPropertiesMap &properties,
IPAddress::Family address_family,
IPConfig::Method *ipconfig_method,
- scoped_ptr<IPConfig::Properties> *ipconfig_properties) const;
+ std::unique_ptr<IPConfig::Properties> *ipconfig_properties) const;
// Resets bearer properties.
void ResetProperties();
@@ -94,21 +94,21 @@
ipv4_config_method_ = ipv4_config_method;
}
void set_ipv4_config_properties(
- scoped_ptr<IPConfig::Properties> ipv4_config_properties) {
- ipv4_config_properties_ = ipv4_config_properties.Pass();
+ std::unique_ptr<IPConfig::Properties> ipv4_config_properties) {
+ ipv4_config_properties_ = std::move(ipv4_config_properties);
}
void set_ipv6_config_method(IPConfig::Method ipv6_config_method) {
ipv6_config_method_ = ipv6_config_method;
}
void set_ipv6_config_properties(
- scoped_ptr<IPConfig::Properties> ipv6_config_properties) {
- ipv6_config_properties_ = ipv6_config_properties.Pass();
+ std::unique_ptr<IPConfig::Properties> ipv6_config_properties) {
+ ipv6_config_properties_ = std::move(ipv6_config_properties);
}
ProxyFactory *proxy_factory_;
std::string dbus_path_;
std::string dbus_service_;
- scoped_ptr<DBusPropertiesProxyInterface> dbus_properties_proxy_;
+ std::unique_ptr<DBusPropertiesProxyInterface> dbus_properties_proxy_;
bool connected_;
std::string data_interface_;
@@ -117,9 +117,9 @@
// properties. Otherwise, |ipv4_config_properties_| is set to nullptr.
// |ipv6_config_properties_| is handled similarly.
IPConfig::Method ipv4_config_method_;
- scoped_ptr<IPConfig::Properties> ipv4_config_properties_;
+ std::unique_ptr<IPConfig::Properties> ipv4_config_properties_;
IPConfig::Method ipv6_config_method_;
- scoped_ptr<IPConfig::Properties> ipv6_config_properties_;
+ std::unique_ptr<IPConfig::Properties> ipv6_config_properties_;
DISALLOW_COPY_AND_ASSIGN(CellularBearer);
};
diff --git a/cellular_bearer_unittest.cc b/cellular_bearer_unittest.cc
index e47883a..e6646a4 100644
--- a/cellular_bearer_unittest.cc
+++ b/cellular_bearer_unittest.cc
@@ -131,7 +131,7 @@
EXPECT_EQ(kIPv6DNS[2], ipv6_config_properties->dns_servers[2]);
}
- scoped_ptr<MockProxyFactory> proxy_factory_;
+ std::unique_ptr<MockProxyFactory> proxy_factory_;
CellularBearer bearer_;
};
@@ -142,7 +142,7 @@
TEST_F(CellularBearerTest, Init) {
// Ownership of |properties_proxy| is transferred to |bearer_| via
// |proxy_factory_|.
- scoped_ptr<MockDBusPropertiesProxy> properties_proxy(
+ std::unique_ptr<MockDBusPropertiesProxy> properties_proxy(
new MockDBusPropertiesProxy);
EXPECT_CALL(*proxy_factory_.get(),
CreateDBusPropertiesProxy(kBearerDBusPath, kBearerDBusService))
diff --git a/cellular_capability.h b/cellular_capability.h
index 1b4d28a..1d79f3f 100644
--- a/cellular_capability.h
+++ b/cellular_capability.h
@@ -10,7 +10,6 @@
#include <base/callback.h>
#include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include "shill/callbacks.h"
diff --git a/cellular_capability_cdma.h b/cellular_capability_cdma.h
index 1e92130..02ad6fd 100644
--- a/cellular_capability_cdma.h
+++ b/cellular_capability_cdma.h
@@ -5,14 +5,14 @@
#ifndef SHILL_CELLULAR_CAPABILITY_CDMA_H_
#define SHILL_CELLULAR_CAPABILITY_CDMA_H_
-#include <base/memory/scoped_ptr.h>
+#include <memory>
+#include <string>
+#include <vector>
+
#include <base/memory/weak_ptr.h>
#include <chromeos/dbus/service_constants.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
-#include <string>
-#include <vector>
-
#include "shill/cellular_capability.h"
#include "shill/cellular_capability_classic.h"
#include "shill/cellular_service.h"
@@ -98,7 +98,7 @@
const Error &error);
void OnGetSignalQualityReply(uint32_t strength, const Error &error);
- scoped_ptr<ModemCDMAProxyInterface> proxy_;
+ std::unique_ptr<ModemCDMAProxyInterface> proxy_;
base::WeakPtrFactory<CellularCapabilityCDMA> weak_ptr_factory_;
// Helper method to extract the online portal information from properties.
diff --git a/cellular_capability_cdma_unittest.cc b/cellular_capability_cdma_unittest.cc
index 4480d61..674eddf 100644
--- a/cellular_capability_cdma_unittest.cc
+++ b/cellular_capability_cdma_unittest.cc
@@ -131,8 +131,8 @@
EventDispatcher dispatcher_;
MockModemInfo modem_info_;
scoped_refptr<MockCellular> cellular_;
- scoped_ptr<MockModemProxy> classic_proxy_;
- scoped_ptr<MockModemCDMAProxy> proxy_;
+ std::unique_ptr<MockModemProxy> classic_proxy_;
+ std::unique_ptr<MockModemCDMAProxy> proxy_;
CellularCapabilityCDMA *capability_; // Owned by |cellular_|.
};
diff --git a/cellular_capability_classic.h b/cellular_capability_classic.h
index be7eabf..f869c91 100644
--- a/cellular_capability_classic.h
+++ b/cellular_capability_classic.h
@@ -5,12 +5,12 @@
#ifndef SHILL_CELLULAR_CAPABILITY_CLASSIC_H_
#define SHILL_CELLULAR_CAPABILITY_CLASSIC_H_
+#include <memory>
#include <string>
#include <vector>
#include <base/callback.h>
#include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@@ -112,7 +112,7 @@
CellularTaskList *tasks,
const Error &error);
- scoped_ptr<ModemSimpleProxyInterface> simple_proxy_;
+ std::unique_ptr<ModemSimpleProxyInterface> simple_proxy_;
private:
friend class CellularTest;
@@ -159,8 +159,8 @@
Cellular *cellular_;
base::WeakPtrFactory<CellularCapabilityClassic> weak_ptr_factory_;
- scoped_ptr<ModemProxyInterface> proxy_;
- scoped_ptr<ModemGobiProxyInterface> gobi_proxy_;
+ std::unique_ptr<ModemProxyInterface> proxy_;
+ std::unique_ptr<ModemGobiProxyInterface> gobi_proxy_;
DISALLOW_COPY_AND_ASSIGN(CellularCapabilityClassic);
};
diff --git a/cellular_capability_classic_unittest.cc b/cellular_capability_classic_unittest.cc
index 1293b48..345caa9 100644
--- a/cellular_capability_classic_unittest.cc
+++ b/cellular_capability_classic_unittest.cc
@@ -236,12 +236,12 @@
MockModemInfo modem_info_;
MockRTNLHandler rtnl_handler_;
bool create_gsm_card_proxy_from_factory_;
- scoped_ptr<MockModemProxy> proxy_;
- scoped_ptr<MockModemSimpleProxy> simple_proxy_;
- scoped_ptr<MockModemCDMAProxy> cdma_proxy_;
- scoped_ptr<MockModemGSMCardProxy> gsm_card_proxy_;
- scoped_ptr<MockModemGSMNetworkProxy> gsm_network_proxy_;
- scoped_ptr<MockModemGobiProxy> gobi_proxy_;
+ std::unique_ptr<MockModemProxy> proxy_;
+ std::unique_ptr<MockModemSimpleProxy> simple_proxy_;
+ std::unique_ptr<MockModemCDMAProxy> cdma_proxy_;
+ std::unique_ptr<MockModemGSMCardProxy> gsm_card_proxy_;
+ std::unique_ptr<MockModemGSMNetworkProxy> gsm_network_proxy_;
+ std::unique_ptr<MockModemGobiProxy> gobi_proxy_;
TestProxyFactory proxy_factory_;
CellularCapabilityClassic *capability_; // Owned by |cellular_|.
DeviceMockAdaptor *device_adaptor_; // Owned by |cellular_|.
diff --git a/cellular_capability_gsm.h b/cellular_capability_gsm.h
index 56d36fa..f226811 100644
--- a/cellular_capability_gsm.h
+++ b/cellular_capability_gsm.h
@@ -6,10 +6,10 @@
#define SHILL_CELLULAR_CAPABILITY_GSM_H_
#include <deque>
+#include <memory>
#include <string>
#include <vector>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include <chromeos/dbus/service_constants.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@@ -198,13 +198,13 @@
const Error &error);
void OnConnectReply(const ResultCallback &callback, const Error &error);
- scoped_ptr<ModemGSMCardProxyInterface> card_proxy_;
- scoped_ptr<ModemGSMNetworkProxyInterface> network_proxy_;
+ std::unique_ptr<ModemGSMCardProxyInterface> card_proxy_;
+ std::unique_ptr<ModemGSMNetworkProxyInterface> network_proxy_;
base::WeakPtrFactory<CellularCapabilityGSM> weak_ptr_factory_;
// Used to enrich information about the network operator in |ParseScanResult|.
// TODO(pprabhu) Instead instantiate a local |MobileOperatorInfo| instance
// once the context has been separated out. (crbug.com/363874)
- scoped_ptr<MobileOperatorInfo> mobile_operator_info_;
+ std::unique_ptr<MobileOperatorInfo> mobile_operator_info_;
uint32_t registration_state_;
uint32_t access_technology_;
diff --git a/cellular_capability_gsm_unittest.cc b/cellular_capability_gsm_unittest.cc
index 7436eae..c931297 100644
--- a/cellular_capability_gsm_unittest.cc
+++ b/cellular_capability_gsm_unittest.cc
@@ -312,10 +312,10 @@
EventDispatcher dispatcher_;
MockModemInfo modem_info_;
bool create_card_proxy_from_factory_;
- scoped_ptr<MockModemProxy> proxy_;
- scoped_ptr<MockModemSimpleProxy> simple_proxy_;
- scoped_ptr<MockModemGSMCardProxy> card_proxy_;
- scoped_ptr<MockModemGSMNetworkProxy> network_proxy_;
+ std::unique_ptr<MockModemProxy> proxy_;
+ std::unique_ptr<MockModemSimpleProxy> simple_proxy_;
+ std::unique_ptr<MockModemGSMCardProxy> card_proxy_;
+ std::unique_ptr<MockModemGSMNetworkProxy> network_proxy_;
TestProxyFactory proxy_factory_;
CellularCapabilityGSM *capability_; // Owned by |cellular_|.
DeviceMockAdaptor *device_adaptor_; // Owned by |cellular_|.
diff --git a/cellular_capability_universal.cc b/cellular_capability_universal.cc
index 34f9a1e..9aa54dc 100644
--- a/cellular_capability_universal.cc
+++ b/cellular_capability_universal.cc
@@ -727,7 +727,7 @@
void CellularCapabilityUniversal::GetProperties() {
SLOG(Cellular, 3) << __func__;
- scoped_ptr<DBusPropertiesProxyInterface> properties_proxy(
+ std::unique_ptr<DBusPropertiesProxyInterface> properties_proxy(
proxy_factory()->CreateDBusPropertiesProxy(cellular()->dbus_path(),
cellular()->dbus_owner()));
DBusPropertiesMap properties(
@@ -773,7 +773,7 @@
// one. Right now, we don't allow more than one active bearer.
active_bearer_.reset();
for (const auto &path : bearer_paths_) {
- scoped_ptr<CellularBearer> bearer(
+ std::unique_ptr<CellularBearer> bearer(
new CellularBearer(proxy_factory(), path, cellular()->dbus_service()));
// The bearer object may have vanished before ModemManager updates the
// 'Bearers' property.
@@ -785,7 +785,7 @@
SLOG(Cellular, 2) << "Found active bearer \"" << path << "\".";
CHECK(!active_bearer_) << "Found more than one active bearer.";
- active_bearer_ = bearer.Pass();
+ active_bearer_ = std::move(bearer);
}
if (!active_bearer_)
@@ -1297,7 +1297,7 @@
cellular()->home_provider_info()->Reset();
} else {
cellular()->set_sim_present(true);
- scoped_ptr<DBusPropertiesProxyInterface> properties_proxy(
+ std::unique_ptr<DBusPropertiesProxyInterface> properties_proxy(
proxy_factory()->CreateDBusPropertiesProxy(sim_path,
cellular()->dbus_owner()));
// TODO(jglasgow): convert to async interface
@@ -1435,7 +1435,7 @@
if (IsValidSimPath(sim_path_) &&
(sim_lock_status_.lock_type == MM_MODEM_LOCK_NONE ||
sim_lock_status_.lock_type == MM_MODEM_LOCK_UNKNOWN)) {
- scoped_ptr<DBusPropertiesProxyInterface> properties_proxy(
+ std::unique_ptr<DBusPropertiesProxyInterface> properties_proxy(
proxy_factory()->CreateDBusPropertiesProxy(sim_path_,
cellular()->dbus_owner()));
DBusPropertiesMap properties(
diff --git a/cellular_capability_universal.h b/cellular_capability_universal.h
index c218cf6..3905459 100644
--- a/cellular_capability_universal.h
+++ b/cellular_capability_universal.h
@@ -10,7 +10,6 @@
#include <string>
#include <vector>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include <ModemManager/ModemManager.h>
@@ -389,14 +388,14 @@
active_bearer_.reset(bearer); // Takes ownership
}
- scoped_ptr<mm1::ModemModem3gppProxyInterface> modem_3gpp_proxy_;
- scoped_ptr<mm1::ModemProxyInterface> modem_proxy_;
- scoped_ptr<mm1::ModemSimpleProxyInterface> modem_simple_proxy_;
- scoped_ptr<mm1::SimProxyInterface> sim_proxy_;
+ std::unique_ptr<mm1::ModemModem3gppProxyInterface> modem_3gpp_proxy_;
+ std::unique_ptr<mm1::ModemProxyInterface> modem_proxy_;
+ std::unique_ptr<mm1::ModemSimpleProxyInterface> modem_simple_proxy_;
+ std::unique_ptr<mm1::SimProxyInterface> sim_proxy_;
// Used to enrich information about the network operator in |ParseScanResult|.
// TODO(pprabhu) Instead instantiate a local |MobileOperatorInfo| instance
// once the context has been separated out. (crbug.com/363874)
- scoped_ptr<MobileOperatorInfo> mobile_operator_info_;
+ std::unique_ptr<MobileOperatorInfo> mobile_operator_info_;
base::WeakPtrFactory<CellularCapabilityUniversal> weak_ptr_factory_;
@@ -419,7 +418,7 @@
SimLockStatus sim_lock_status_;
SubscriptionState subscription_state_;
std::string sim_path_;
- scoped_ptr<CellularBearer> active_bearer_;
+ std::unique_ptr<CellularBearer> active_bearer_;
RpcIdentifiers bearer_paths_;
bool reset_done_;
diff --git a/cellular_capability_universal_cdma.cc b/cellular_capability_universal_cdma.cc
index db67e0e..7041293 100644
--- a/cellular_capability_universal_cdma.cc
+++ b/cellular_capability_universal_cdma.cc
@@ -234,7 +234,7 @@
SLOG(Cellular, 2) << __func__;
CellularCapabilityUniversal::GetProperties();
- scoped_ptr<DBusPropertiesProxyInterface> properties_proxy(
+ std::unique_ptr<DBusPropertiesProxyInterface> properties_proxy(
proxy_factory()->CreateDBusPropertiesProxy(cellular()->dbus_path(),
cellular()->dbus_owner()));
DBusPropertiesMap properties(
diff --git a/cellular_capability_universal_cdma.h b/cellular_capability_universal_cdma.h
index a79d7b7..cf7f097 100644
--- a/cellular_capability_universal_cdma.h
+++ b/cellular_capability_universal_cdma.h
@@ -5,17 +5,17 @@
#ifndef SHILL_CELLULAR_CAPABILITY_UNIVERSAL_CDMA_H_
#define SHILL_CELLULAR_CAPABILITY_UNIVERSAL_CDMA_H_
-#include "shill/cellular.h"
-#include "shill/cellular_capability_universal.h"
-#include "shill/mm1_modem_modemcdma_proxy_interface.h"
-
-#include <base/memory/weak_ptr.h>
-
+#include <memory>
#include <string>
#include <vector>
+#include <base/memory/weak_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
+#include "shill/cellular.h"
+#include "shill/cellular_capability_universal.h"
+#include "shill/mm1_modem_modemcdma_proxy_interface.h"
+
namespace shill {
class CellularCapabilityUniversalCDMA : public CellularCapabilityUniversal {
@@ -111,7 +111,7 @@
static std::string GetActivationStateString(uint32_t state);
static std::string GetActivationErrorString(uint32_t error);
- scoped_ptr<mm1::ModemModemCdmaProxyInterface> modem_cdma_proxy_;
+ std::unique_ptr<mm1::ModemModemCdmaProxyInterface> modem_cdma_proxy_;
// TODO(armansito): Should probably call this |weak_ptr_factory_| after
// 3gpp refactor
base::WeakPtrFactory<CellularCapabilityUniversalCDMA> weak_cdma_ptr_factory_;
diff --git a/cellular_capability_universal_cdma_unittest.cc b/cellular_capability_universal_cdma_unittest.cc
index c39a7e4..22f61ed 100644
--- a/cellular_capability_universal_cdma_unittest.cc
+++ b/cellular_capability_universal_cdma_unittest.cc
@@ -37,6 +37,7 @@
using base::StringPrintf;
using base::UintToString;
using std::string;
+using std::unique_ptr;
using std::vector;
using testing::Invoke;
using testing::Mock;
@@ -182,12 +183,12 @@
MockModemInfo modem_info_;
MockGLib glib_;
// TODO(armansito): Remove |modem_3gpp_proxy_| after refactor.
- scoped_ptr<mm1::MockModemModem3gppProxy> modem_3gpp_proxy_;
- scoped_ptr<mm1::MockModemModemCdmaProxy> modem_cdma_proxy_;
- scoped_ptr<mm1::MockModemProxy> modem_proxy_;
- scoped_ptr<mm1::MockModemSimpleProxy> modem_simple_proxy_;
- scoped_ptr<mm1::MockSimProxy> sim_proxy_;
- scoped_ptr<MockDBusPropertiesProxy> properties_proxy_;
+ unique_ptr<mm1::MockModemModem3gppProxy> modem_3gpp_proxy_;
+ unique_ptr<mm1::MockModemModemCdmaProxy> modem_cdma_proxy_;
+ unique_ptr<mm1::MockModemProxy> modem_proxy_;
+ unique_ptr<mm1::MockModemSimpleProxy> modem_simple_proxy_;
+ unique_ptr<mm1::MockSimProxy> sim_proxy_;
+ unique_ptr<MockDBusPropertiesProxy> properties_proxy_;
TestProxyFactory proxy_factory_;
CellularRefPtr cellular_;
MockCellularService *service_;
diff --git a/cellular_capability_universal_unittest.cc b/cellular_capability_universal_unittest.cc
index 0a8731a..95f46ff 100644
--- a/cellular_capability_universal_unittest.cc
+++ b/cellular_capability_universal_unittest.cc
@@ -41,6 +41,7 @@
using base::StringPrintf;
using base::Unretained;
using std::string;
+using std::unique_ptr;
using std::vector;
using testing::AnyNumber;
using testing::InSequence;
@@ -332,12 +333,12 @@
EventDispatcher *dispatcher_;
MockModemInfo modem_info_;
- scoped_ptr<mm1::MockModemModem3gppProxy> modem_3gpp_proxy_;
- scoped_ptr<mm1::MockModemModemCdmaProxy> modem_cdma_proxy_;
- scoped_ptr<mm1::MockModemProxy> modem_proxy_;
- scoped_ptr<mm1::MockModemSimpleProxy> modem_simple_proxy_;
- scoped_ptr<mm1::MockSimProxy> sim_proxy_;
- scoped_ptr<MockDBusPropertiesProxy> properties_proxy_;
+ unique_ptr<mm1::MockModemModem3gppProxy> modem_3gpp_proxy_;
+ unique_ptr<mm1::MockModemModemCdmaProxy> modem_cdma_proxy_;
+ unique_ptr<mm1::MockModemProxy> modem_proxy_;
+ unique_ptr<mm1::MockModemSimpleProxy> modem_simple_proxy_;
+ unique_ptr<mm1::MockSimProxy> sim_proxy_;
+ unique_ptr<MockDBusPropertiesProxy> properties_proxy_;
TestProxyFactory proxy_factory_;
CellularCapabilityUniversal *capability_; // Owned by |cellular_|.
DeviceMockAdaptor *device_adaptor_; // Owned by |cellular_|.
diff --git a/cellular_service.h b/cellular_service.h
index a710e2c..77cbeed 100644
--- a/cellular_service.h
+++ b/cellular_service.h
@@ -6,6 +6,7 @@
#define SHILL_CELLULAR_SERVICE_H_
#include <map>
+#include <memory>
#include <string>
#include <base/macros.h>
@@ -222,7 +223,7 @@
// Time when the last resume occurred.
base::Time resume_start_time_;
// Out-of-credits detector.
- scoped_ptr<OutOfCreditsDetector> out_of_credits_detector_;
+ std::unique_ptr<OutOfCreditsDetector> out_of_credits_detector_;
DISALLOW_COPY_AND_ASSIGN(CellularService);
};
diff --git a/cellular_unittest.cc b/cellular_unittest.cc
index 6e2173f..e8f9e39 100644
--- a/cellular_unittest.cc
+++ b/cellular_unittest.cc
@@ -52,6 +52,7 @@
using base::Unretained;
using std::map;
using std::string;
+using std::unique_ptr;
using std::vector;
using testing::_;
using testing::AnyNumber;
@@ -375,7 +376,7 @@
EXPECT_FALSE(device_->ipconfig()); // No DHCP client.
EXPECT_FALSE(device_->selected_service());
EXPECT_FALSE(device_->is_ppp_authenticating_);
- EXPECT_TRUE(device_->ppp_task_);
+ EXPECT_NE(nullptr, device_->ppp_task_);
Mock::VerifyAndClearExpectations(&mock_glib);
}
@@ -396,7 +397,7 @@
}
void VerifyPPPStopped() {
- EXPECT_FALSE(device_->ppp_task_);
+ EXPECT_EQ(nullptr, device_->ppp_task_);
EXPECT_FALSE(device_->ppp_device_);
}
@@ -565,10 +566,10 @@
device_->enabled_persistent_ = new_value;
}
- void SetCapabilityUniversalActiveBearer(scoped_ptr<CellularBearer> bearer) {
+ void SetCapabilityUniversalActiveBearer(unique_ptr<CellularBearer> bearer) {
SetCellularType(Cellular::kTypeUniversal);
CellularCapabilityUniversal *capability = GetCapabilityUniversal();
- capability->active_bearer_ = bearer.Pass();
+ capability->active_bearer_ = std::move(bearer);
}
EventDispatcher dispatcher_;
@@ -580,15 +581,15 @@
scoped_refptr<MockDHCPConfig> dhcp_config_;
bool create_gsm_card_proxy_from_factory_;
- scoped_ptr<MockDBusPropertiesProxy> dbus_properties_proxy_;
- scoped_ptr<MockModemProxy> proxy_;
- scoped_ptr<MockModemSimpleProxy> simple_proxy_;
- scoped_ptr<MockModemCDMAProxy> cdma_proxy_;
- scoped_ptr<MockModemGSMCardProxy> gsm_card_proxy_;
- scoped_ptr<MockModemGSMNetworkProxy> gsm_network_proxy_;
- scoped_ptr<mm1::MockModemModem3gppProxy> mm1_modem_3gpp_proxy_;
- scoped_ptr<mm1::MockModemProxy> mm1_proxy_;
- scoped_ptr<mm1::MockModemSimpleProxy> mm1_simple_proxy_;
+ unique_ptr<MockDBusPropertiesProxy> dbus_properties_proxy_;
+ unique_ptr<MockModemProxy> proxy_;
+ unique_ptr<MockModemSimpleProxy> simple_proxy_;
+ unique_ptr<MockModemCDMAProxy> cdma_proxy_;
+ unique_ptr<MockModemGSMCardProxy> gsm_card_proxy_;
+ unique_ptr<MockModemGSMNetworkProxy> gsm_network_proxy_;
+ unique_ptr<mm1::MockModemModem3gppProxy> mm1_modem_3gpp_proxy_;
+ unique_ptr<mm1::MockModemProxy> mm1_proxy_;
+ unique_ptr<mm1::MockModemSimpleProxy> mm1_simple_proxy_;
TestProxyFactory proxy_factory_;
MockMobileOperatorInfo *mock_home_provider_info_;
MockMobileOperatorInfo *mock_serving_operator_info_;
@@ -1409,13 +1410,13 @@
// If PPP is running, don't run DHCP as well.
TestRPCTaskDelegate task_delegate;
base::Callback<void(pid_t, int)> death_callback;
- scoped_ptr<NiceMock<MockExternalTask>> mock_task(
+ unique_ptr<NiceMock<MockExternalTask>> mock_task(
new NiceMock<MockExternalTask>(modem_info_.control_interface(),
modem_info_.glib(),
task_delegate.AsWeakPtr(),
death_callback));
EXPECT_CALL(*mock_task, OnDelete()).Times(AnyNumber());
- device_->ppp_task_ = mock_task.Pass();
+ device_->ppp_task_ = std::move(mock_task);
device_->state_ = Cellular::kStateConnected;
EXPECT_CALL(dhcp_provider_, CreateConfig(kTestDeviceName, _, _, _))
.Times(0);
@@ -1435,7 +1436,7 @@
TEST_F(CellularTest, StartPPP) {
const int kPID = 234;
- EXPECT_FALSE(device_->ppp_task_);
+ EXPECT_EQ(nullptr, device_->ppp_task_);
StartPPP(kPID);
}
@@ -1456,7 +1457,7 @@
.Times(AnyNumber())
.WillRepeatedly(Return(true));
const int kPID = 234;
- EXPECT_FALSE(device_->ppp_task_);
+ EXPECT_EQ(nullptr, device_->ppp_task_);
StartPPP(kPID);
EXPECT_EQ(Cellular::kStateLinked, device_->state());
}
@@ -1556,7 +1557,7 @@
// Notify(kPPPReasonAuthenticated, ...).
EXPECT_CALL(*ppp_device2, SetServiceFailure(Service::kFailureUnknown));
device_->Notify(kPPPReasonDisconnect, kEmptyArgs);
- EXPECT_FALSE(device_->ppp_task_);
+ EXPECT_EQ(nullptr, device_->ppp_task_);
// |Cellular::ppp_task_| is destroyed on the task loop. Must dispatch once to
// cleanup.
@@ -1575,7 +1576,7 @@
ExpectDisconnectCapabilityUniversal();
EXPECT_CALL(*service, SetFailure(Service::kFailureUnknown));
device_->Notify(kPPPReasonDisconnect, kEmptyArgs);
- EXPECT_FALSE(device_->ppp_task_);
+ EXPECT_EQ(nullptr, device_->ppp_task_);
VerifyDisconnect();
// |Cellular::ppp_task_| is destroyed on the task loop. Must dispatch once to
@@ -1596,7 +1597,7 @@
EXPECT_CALL(*service, SetFailure(Service::kFailurePPPAuth));
device_->Notify(kPPPReasonAuthenticating, kEmptyArgs);
device_->Notify(kPPPReasonDisconnect, kEmptyArgs);
- EXPECT_FALSE(device_->ppp_task_);
+ EXPECT_EQ(nullptr, device_->ppp_task_);
VerifyDisconnect();
// |Cellular::ppp_task_| is destroyed on the task loop. Must dispatch once to
@@ -1619,7 +1620,7 @@
device_->Notify(kPPPReasonAuthenticating, kEmptyArgs);
device_->Notify(kPPPReasonAuthenticated, kEmptyArgs);
device_->Notify(kPPPReasonDisconnect, kEmptyArgs);
- EXPECT_FALSE(device_->ppp_task_);
+ EXPECT_EQ(nullptr, device_->ppp_task_);
VerifyDisconnect();
// |Cellular::ppp_task_| is destroyed on the task loop. Must dispatch once to
@@ -2024,10 +2025,10 @@
}
TEST_F(CellularTest, EstablishLinkDHCP) {
- scoped_ptr<CellularBearer> bearer(
+ unique_ptr<CellularBearer> bearer(
new CellularBearer(&proxy_factory_, "", ""));
bearer->set_ipv4_config_method(IPConfig::kMethodDHCP);
- SetCapabilityUniversalActiveBearer(bearer.Pass());
+ SetCapabilityUniversalActiveBearer(std::move(bearer));
device_->state_ = Cellular::kStateConnected;
MockCellularService *service = SetMockService();
@@ -2045,10 +2046,10 @@
}
TEST_F(CellularTest, EstablishLinkPPP) {
- scoped_ptr<CellularBearer> bearer(
+ unique_ptr<CellularBearer> bearer(
new CellularBearer(&proxy_factory_, "", ""));
bearer->set_ipv4_config_method(IPConfig::kMethodPPP);
- SetCapabilityUniversalActiveBearer(bearer.Pass());
+ SetCapabilityUniversalActiveBearer(std::move(bearer));
device_->state_ = Cellular::kStateConnected;
const int kPID = 123;
@@ -2060,7 +2061,7 @@
EXPECT_FALSE(device_->ipconfig()); // No DHCP client.
EXPECT_FALSE(device_->selected_service());
EXPECT_FALSE(device_->is_ppp_authenticating_);
- EXPECT_TRUE(device_->ppp_task_);
+ EXPECT_NE(nullptr, device_->ppp_task_);
}
TEST_F(CellularTest, EstablishLinkStatic) {
@@ -2070,7 +2071,7 @@
const int32_t kSubnetPrefix = 16;
const char *const kDNS[] = {"10.0.0.2", "8.8.4.4", "8.8.8.8"};
- scoped_ptr<IPConfig::Properties> ipconfig_properties(
+ unique_ptr<IPConfig::Properties> ipconfig_properties(
new IPConfig::Properties);
ipconfig_properties->address_family = kAddressFamily;
ipconfig_properties->address = kAddress;
@@ -2078,11 +2079,11 @@
ipconfig_properties->subnet_prefix = kSubnetPrefix;
ipconfig_properties->dns_servers = vector<string>{kDNS[0], kDNS[1], kDNS[2]};
- scoped_ptr<CellularBearer> bearer(
+ unique_ptr<CellularBearer> bearer(
new CellularBearer(&proxy_factory_, "", ""));
bearer->set_ipv4_config_method(IPConfig::kMethodStatic);
- bearer->set_ipv4_config_properties(ipconfig_properties.Pass());
- SetCapabilityUniversalActiveBearer(bearer.Pass());
+ bearer->set_ipv4_config_properties(std::move(ipconfig_properties));
+ SetCapabilityUniversalActiveBearer(std::move(bearer));
device_->state_ = Cellular::kStateConnected;
MockCellularService *service = SetMockService();
diff --git a/mm1_bearer_proxy.cc b/mm1_bearer_proxy.cc
index 1755147..93fdf7b 100644
--- a/mm1_bearer_proxy.cc
+++ b/mm1_bearer_proxy.cc
@@ -4,11 +4,14 @@
#include "shill/mm1_bearer_proxy.h"
+#include <memory>
+
#include "shill/cellular_error.h"
#include "shill/dbus_async_call_helper.h"
#include "shill/logging.h"
using std::string;
+using std::unique_ptr;
namespace shill {
namespace mm1 {
@@ -49,7 +52,7 @@
void BearerProxy::Proxy::ConnectCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -58,7 +61,7 @@
void BearerProxy::Proxy::DisconnectCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
diff --git a/mm1_modem_location_proxy.cc b/mm1_modem_location_proxy.cc
index edd7649..754bbcd 100644
--- a/mm1_modem_location_proxy.cc
+++ b/mm1_modem_location_proxy.cc
@@ -4,11 +4,14 @@
#include "shill/mm1_modem_location_proxy.h"
+#include <memory>
+
#include "shill/cellular_error.h"
#include "shill/dbus_async_call_helper.h"
#include "shill/logging.h"
using std::string;
+using std::unique_ptr;
namespace shill {
namespace mm1 {
@@ -49,7 +52,7 @@
void ModemLocationProxy::Proxy::SetupCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -60,7 +63,7 @@
const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<DBusEnumValueMapCallback> callback(
+ unique_ptr<DBusEnumValueMapCallback> callback(
reinterpret_cast<DBusEnumValueMapCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
diff --git a/mm1_modem_modem3gpp_proxy.cc b/mm1_modem_modem3gpp_proxy.cc
index c5966a2..8915de2 100644
--- a/mm1_modem_modem3gpp_proxy.cc
+++ b/mm1_modem_modem3gpp_proxy.cc
@@ -4,11 +4,14 @@
#include "shill/mm1_modem_modem3gpp_proxy.h"
+#include <memory>
+
#include "shill/cellular_error.h"
#include "shill/dbus_async_call_helper.h"
#include "shill/logging.h"
using std::string;
+using std::unique_ptr;
namespace shill {
namespace mm1 {
@@ -50,7 +53,7 @@
void ModemModem3gppProxy::Proxy::RegisterCallback(const ::DBus::Error& dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -60,7 +63,7 @@
const std::vector<DBusPropertiesMap> &results,
const ::DBus::Error& dberror, void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<DBusPropertyMapsCallback> callback(
+ unique_ptr<DBusPropertyMapsCallback> callback(
reinterpret_cast<DBusPropertyMapsCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
diff --git a/mm1_modem_modemcdma_proxy.cc b/mm1_modem_modemcdma_proxy.cc
index ef5ae6a..9080a68 100644
--- a/mm1_modem_modemcdma_proxy.cc
+++ b/mm1_modem_modemcdma_proxy.cc
@@ -4,11 +4,14 @@
#include "shill/mm1_modem_modemcdma_proxy.h"
+#include <memory>
+
#include "shill/cellular_error.h"
#include "shill/dbus_async_call_helper.h"
#include "shill/logging.h"
using std::string;
+using std::unique_ptr;
namespace shill {
namespace mm1 {
@@ -73,7 +76,7 @@
void ModemModemCdmaProxy::Proxy::ActivateCallback(const ::DBus::Error& dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -83,7 +86,7 @@
const ::DBus::Error& dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
diff --git a/mm1_modem_proxy.cc b/mm1_modem_proxy.cc
index 3e4563f..7c9a1ac 100644
--- a/mm1_modem_proxy.cc
+++ b/mm1_modem_proxy.cc
@@ -6,11 +6,14 @@
#include <ModemManager/ModemManager.h>
+#include <memory>
+
#include "shill/cellular_error.h"
#include "shill/dbus_async_call_helper.h"
#include "shill/logging.h"
using std::string;
+using std::unique_ptr;
namespace shill {
namespace mm1 {
@@ -144,7 +147,7 @@
void ModemProxy::Proxy::EnableCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -154,7 +157,7 @@
const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -163,7 +166,7 @@
void ModemProxy::Proxy::DeleteBearerCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -172,7 +175,7 @@
void ModemProxy::Proxy::ResetCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -181,7 +184,7 @@
void ModemProxy::Proxy::FactoryResetCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -191,7 +194,7 @@
const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -200,7 +203,7 @@
void ModemProxy::Proxy::SetCurrentModesCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -209,7 +212,7 @@
void ModemProxy::Proxy::SetCurrentBandsCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -219,7 +222,7 @@
const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -228,7 +231,7 @@
void ModemProxy::Proxy::SetPowerStateCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
diff --git a/mm1_modem_simple_proxy.cc b/mm1_modem_simple_proxy.cc
index 5643237..5b680fd 100644
--- a/mm1_modem_simple_proxy.cc
+++ b/mm1_modem_simple_proxy.cc
@@ -4,11 +4,14 @@
#include "shill/mm1_modem_simple_proxy.h"
+#include <memory>
+
#include "shill/cellular_error.h"
#include "shill/dbus_async_call_helper.h"
#include "shill/logging.h"
using std::string;
+using std::unique_ptr;
namespace shill {
namespace mm1 {
@@ -61,7 +64,7 @@
const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<DBusPathCallback> callback(
+ unique_ptr<DBusPathCallback> callback(
reinterpret_cast<DBusPathCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
@@ -71,7 +74,7 @@
void ModemSimpleProxy::Proxy::DisconnectCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -82,7 +85,7 @@
const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<DBusPropertyMapCallback> callback(
+ unique_ptr<DBusPropertyMapCallback> callback(
reinterpret_cast<DBusPropertyMapCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
diff --git a/mm1_modem_time_proxy.cc b/mm1_modem_time_proxy.cc
index 9bf400a..5df6f32 100644
--- a/mm1_modem_time_proxy.cc
+++ b/mm1_modem_time_proxy.cc
@@ -4,11 +4,14 @@
#include "shill/mm1_modem_time_proxy.h"
+#include <memory>
+
#include "shill/cellular_error.h"
#include "shill/dbus_async_call_helper.h"
#include "shill/logging.h"
using std::string;
+using std::unique_ptr;
namespace shill {
namespace mm1 {
@@ -57,7 +60,7 @@
const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<StringCallback> callback(reinterpret_cast<StringCallback *>(data));
+ unique_ptr<StringCallback> callback(reinterpret_cast<StringCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(time, error);
diff --git a/mm1_sim_proxy.cc b/mm1_sim_proxy.cc
index 639d57c..f596b05 100644
--- a/mm1_sim_proxy.cc
+++ b/mm1_sim_proxy.cc
@@ -4,11 +4,14 @@
#include "shill/mm1_sim_proxy.h"
+#include <memory>
+
#include "shill/cellular_error.h"
#include "shill/dbus_async_call_helper.h"
#include "shill/logging.h"
using std::string;
+using std::unique_ptr;
namespace shill {
namespace mm1 {
@@ -86,7 +89,7 @@
void SimProxy::Proxy::SendPinCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -95,7 +98,7 @@
void SimProxy::Proxy::SendPukCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -104,7 +107,7 @@
void SimProxy::Proxy::EnablePinCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
@@ -113,7 +116,7 @@
void SimProxy::Proxy::ChangePinCallback(const ::DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromMM1DBusError(dberror, &error);
callback->Run(error);
diff --git a/mobile_operator_info.h b/mobile_operator_info.h
index a57b9b0..bc12615 100644
--- a/mobile_operator_info.h
+++ b/mobile_operator_info.h
@@ -5,11 +5,11 @@
#ifndef SHILL_MOBILE_OPERATOR_INFO_H_
#define SHILL_MOBILE_OPERATOR_INFO_H_
+#include <memory>
#include <string>
#include <vector>
#include <base/files/file_util.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/scoped_vector.h>
namespace shill {
@@ -209,7 +209,7 @@
MobileOperatorInfoImpl * impl() { return impl_.get(); }
private:
- scoped_ptr<MobileOperatorInfoImpl> impl_;
+ std::unique_ptr<MobileOperatorInfoImpl> impl_;
DISALLOW_COPY_AND_ASSIGN(MobileOperatorInfo);
};
diff --git a/mobile_operator_info_impl.cc b/mobile_operator_info_impl.cc
index c7598a3..53d45cb 100644
--- a/mobile_operator_info_impl.cc
+++ b/mobile_operator_info_impl.cc
@@ -46,9 +46,9 @@
// Wrap some low level functions from the GNU regex librarly.
string GetRegError(int code, const regex_t *compiled) {
size_t length = regerror(code, compiled, nullptr, 0);
- scoped_ptr<char[]> buffer(new char[length]);
- DCHECK_EQ(length, regerror(code, compiled, buffer.get(), length));
- return buffer.get();
+ vector<char> buffer(length);
+ DCHECK_EQ(length, regerror(code, compiled, buffer.data(), length));
+ return buffer.data();
}
} // namespace
@@ -85,7 +85,7 @@
for (const auto &database_path : database_paths_) {
const char *database_path_cstr = database_path.value().c_str();
- scoped_ptr<CopyingInputStreamAdaptor> database_stream;
+ std::unique_ptr<CopyingInputStreamAdaptor> database_stream;
database_stream.reset(protobuf_lite_file_input_stream(database_path_cstr));
if (!database_stream.get()) {
LOG(ERROR) << "Failed to read mobile operator database: "
@@ -93,7 +93,7 @@
continue;
}
- scoped_ptr<MobileOperatorDB> database(new MobileOperatorDB());
+ std::unique_ptr<MobileOperatorDB> database(new MobileOperatorDB());
if (!database->ParseFromZeroCopyStream(database_stream.get())) {
LOG(ERROR) << "Could not parse mobile operator database: "
<< database_path_cstr;
diff --git a/mobile_operator_info_impl.h b/mobile_operator_info_impl.h
index 41eb153..3dc8999 100644
--- a/mobile_operator_info_impl.h
+++ b/mobile_operator_info_impl.h
@@ -6,12 +6,12 @@
#define SHILL_MOBILE_OPERATOR_INFO_IMPL_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include <base/cancelable_callback.h>
#include <base/files/file_util.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/scoped_vector.h>
#include <base/memory/weak_ptr.h>
#include <base/observer_list.h>
@@ -155,7 +155,7 @@
ObserverList<MobileOperatorInfo::Observer> observers_;
base::CancelableClosure notify_operator_changed_task_;
- scoped_ptr<mobile_operator_db::MobileOperatorDB> database_;
+ std::unique_ptr<mobile_operator_db::MobileOperatorDB> database_;
StringToMNOListMap mccmnc_to_mnos_;
StringToMNOListMap sid_to_mnos_;
StringToMNOListMap name_to_mnos_;
diff --git a/mobile_operator_info_unittest.cc b/mobile_operator_info_unittest.cc
index 62bf4b7..502e0d6 100644
--- a/mobile_operator_info_unittest.cc
+++ b/mobile_operator_info_unittest.cc
@@ -115,7 +115,7 @@
EventDispatcher dispatcher_;
vector<FilePath> tmp_db_paths_;
- scoped_ptr<MobileOperatorInfo> operator_info_;
+ std::unique_ptr<MobileOperatorInfo> operator_info_;
// Owned by |operator_info_| and tied to its life cycle.
MobileOperatorInfoImpl *operator_info_impl_;
diff --git a/mock_modem_info.h b/mock_modem_info.h
index 7fc5f07..1b1f45b 100644
--- a/mock_modem_info.h
+++ b/mock_modem_info.h
@@ -5,6 +5,7 @@
#ifndef SHILL_MOCK_MODEM_INFO_H_
#define SHILL_MOCK_MODEM_INFO_H_
+#include <memory>
#include <string>
#include <base/macros.h>
@@ -64,11 +65,11 @@
MOCK_METHOD1(OnDeviceInfoAvailable, void(const std::string &link_name));
private:
- scoped_ptr<MockControl> mock_control_;
- scoped_ptr<MockEventDispatcher> mock_dispatcher_;
- scoped_ptr<MockMetrics> mock_metrics_;
- scoped_ptr<MockManager> mock_manager_;
- scoped_ptr<MockGLib> mock_glib_;
+ std::unique_ptr<MockControl> mock_control_;
+ std::unique_ptr<MockEventDispatcher> mock_dispatcher_;
+ std::unique_ptr<MockMetrics> mock_metrics_;
+ std::unique_ptr<MockManager> mock_manager_;
+ std::unique_ptr<MockGLib> mock_glib_;
// owned by ModemInfo
MockPendingActivationStore *mock_pending_activation_store_;
diff --git a/modem.h b/modem.h
index 57c446c..7ea3865 100644
--- a/modem.h
+++ b/modem.h
@@ -5,12 +5,12 @@
#ifndef SHILL_MODEM_H_
#define SHILL_MODEM_H_
+#include <memory>
#include <string>
#include <vector>
#include <base/macros.h>
#include <base/files/file_util.h>
-#include <base/memory/scoped_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include "shill/cellular.h"
@@ -106,7 +106,7 @@
// A proxy to the org.freedesktop.DBusProperties interface used to obtain
// ModemManager.Modem properties and watch for property changes
- scoped_ptr<DBusPropertiesProxyInterface> dbus_properties_proxy_;
+ std::unique_ptr<DBusPropertiesProxyInterface> dbus_properties_proxy_;
DBusInterfaceToProperties initial_properties_;
diff --git a/modem_1_unittest.cc b/modem_1_unittest.cc
index a3a477d..1d8c32f 100644
--- a/modem_1_unittest.cc
+++ b/modem_1_unittest.cc
@@ -67,9 +67,9 @@
EventDispatcher dispatcher_;
MockModemInfo modem_info_;
MockDeviceInfo device_info_;
- scoped_ptr<MockDBusPropertiesProxy> proxy_;
+ std::unique_ptr<MockDBusPropertiesProxy> proxy_;
MockProxyFactory proxy_factory_;
- scoped_ptr<Modem1> modem_;
+ std::unique_ptr<Modem1> modem_;
MockRTNLHandler rtnl_handler_;
ByteString expected_address_;
};
diff --git a/modem_cdma_proxy.cc b/modem_cdma_proxy.cc
index 4222c3c..8544467 100644
--- a/modem_cdma_proxy.cc
+++ b/modem_cdma_proxy.cc
@@ -4,11 +4,14 @@
#include "shill/modem_cdma_proxy.h"
+#include <memory>
+
#include "shill/cellular_error.h"
#include "shill/dbus_async_call_helper.h"
#include "shill/logging.h"
using std::string;
+using std::unique_ptr;
namespace shill {
@@ -119,7 +122,7 @@
const DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__ << "(" << status << ")";
- scoped_ptr<ActivationResultCallback> callback(
+ unique_ptr<ActivationResultCallback> callback(
reinterpret_cast<ActivationResultCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
@@ -130,7 +133,7 @@
const uint32_t &state_1x, const uint32_t &state_evdo,
const DBus::Error &dberror, void *data) {
SLOG(DBus, 2) << __func__ << "(" << state_1x << ", " << state_evdo << ")";
- scoped_ptr<RegistrationStateCallback> callback(
+ unique_ptr<RegistrationStateCallback> callback(
reinterpret_cast<RegistrationStateCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
@@ -142,7 +145,7 @@
const DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__ << "(" << quality << ")";
- scoped_ptr<SignalQualityCallback> callback(
+ unique_ptr<SignalQualityCallback> callback(
reinterpret_cast<SignalQualityCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
diff --git a/modem_gobi_proxy.cc b/modem_gobi_proxy.cc
index 271a620..9e2f2cc 100644
--- a/modem_gobi_proxy.cc
+++ b/modem_gobi_proxy.cc
@@ -4,6 +4,8 @@
#include "shill/modem_gobi_proxy.h"
+#include <memory>
+
#include <base/bind.h>
#include "shill/cellular_error.h"
@@ -14,6 +16,7 @@
using base::Bind;
using base::Callback;
using std::string;
+using std::unique_ptr;
namespace shill {
@@ -43,7 +46,7 @@
void ModemGobiProxy::Proxy::SetCarrierCallback(const DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
callback->Run(error);
diff --git a/modem_gsm_card_proxy.cc b/modem_gsm_card_proxy.cc
index 0fd627b..fd8f3e3 100644
--- a/modem_gsm_card_proxy.cc
+++ b/modem_gsm_card_proxy.cc
@@ -4,6 +4,8 @@
#include "shill/modem_gsm_card_proxy.h"
+#include <memory>
+
#include <base/bind.h>
#include "shill/cellular_error.h"
@@ -14,6 +16,7 @@
using base::Bind;
using base::Callback;
using std::string;
+using std::unique_ptr;
namespace shill {
@@ -109,7 +112,7 @@
const DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<GSMIdentifierCallback> callback(
+ unique_ptr<GSMIdentifierCallback> callback(
reinterpret_cast<GSMIdentifierCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
@@ -147,7 +150,7 @@
void ModemGSMCardProxy::Proxy::PinCallback(const DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
callback->Run(error);
diff --git a/modem_gsm_network_proxy.cc b/modem_gsm_network_proxy.cc
index 6a4acc3..585ec89 100644
--- a/modem_gsm_network_proxy.cc
+++ b/modem_gsm_network_proxy.cc
@@ -4,6 +4,8 @@
#include "shill/modem_gsm_network_proxy.h"
+#include <memory>
+
#include "shill/cellular_error.h"
#include "shill/dbus_async_call_helper.h"
#include "shill/error.h"
@@ -11,6 +13,7 @@
using base::Callback;
using std::string;
+using std::unique_ptr;
namespace shill {
@@ -126,7 +129,7 @@
void ModemGSMNetworkProxy::Proxy::RegisterCallback(const DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
callback->Run(error);
@@ -135,7 +138,7 @@
void ModemGSMNetworkProxy::Proxy::GetRegistrationInfoCallback(
const GSMRegistrationInfo &info, const DBus::Error &dberror, void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<RegistrationInfoCallback> callback(
+ unique_ptr<RegistrationInfoCallback> callback(
reinterpret_cast<RegistrationInfoCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
@@ -145,7 +148,7 @@
void ModemGSMNetworkProxy::Proxy::GetSignalQualityCallback(
const uint32_t &quality, const DBus::Error &dberror, void *data) {
SLOG(DBus, 2) << __func__ << "(" << quality << ")";
- scoped_ptr<SignalQualityCallback> callback(
+ unique_ptr<SignalQualityCallback> callback(
reinterpret_cast<SignalQualityCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
@@ -156,7 +159,7 @@
const DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ScanResultsCallback> callback(
+ unique_ptr<ScanResultsCallback> callback(
reinterpret_cast<ScanResultsCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
diff --git a/modem_info.h b/modem_info.h
index 8d75846..03bf6ec 100644
--- a/modem_info.h
+++ b/modem_info.h
@@ -5,9 +5,9 @@
#ifndef SHILL_MODEM_INFO_H_
#define SHILL_MODEM_INFO_H_
+#include <memory>
#include <string>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/scoped_vector.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@@ -83,7 +83,7 @@
GLib *glib_;
// Post-payment activation state of the modem.
- scoped_ptr<PendingActivationStore> pending_activation_store_;
+ std::unique_ptr<PendingActivationStore> pending_activation_store_;
DISALLOW_COPY_AND_ASSIGN(ModemInfo);
};
diff --git a/modem_manager.cc b/modem_manager.cc
index 096582c..0759b5c 100644
--- a/modem_manager.cc
+++ b/modem_manager.cc
@@ -141,7 +141,7 @@
return;
}
- scoped_ptr<DBusPropertiesProxyInterface> properties_proxy(
+ std::unique_ptr<DBusPropertiesProxyInterface> properties_proxy(
proxy_factory()->CreateDBusPropertiesProxy(modem->path(),
modem->owner()));
DBusPropertiesMap properties =
diff --git a/modem_manager.h b/modem_manager.h
index e76ccec..566b753 100644
--- a/modem_manager.h
+++ b/modem_manager.h
@@ -11,7 +11,6 @@
#include <vector>
#include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@@ -94,7 +93,7 @@
const std::string service_;
const std::string path_;
- scoped_ptr<DBusNameWatcher> name_watcher_;
+ std::unique_ptr<DBusNameWatcher> name_watcher_;
std::string owner_; // DBus service owner.
@@ -125,8 +124,8 @@
virtual void InitModemClassic(std::shared_ptr<ModemClassic> modem);
private:
- scoped_ptr<ModemManagerProxyInterface> proxy_; // DBus service proxy
- scoped_ptr<DBusPropertiesProxyInterface> dbus_properties_proxy_;
+ std::unique_ptr<ModemManagerProxyInterface> proxy_; // DBus service proxy
+ std::unique_ptr<DBusPropertiesProxyInterface> dbus_properties_proxy_;
FRIEND_TEST(ModemManagerClassicTest, Connect);
@@ -169,7 +168,7 @@
FRIEND_TEST(ModemManager1Test, Connect);
FRIEND_TEST(ModemManager1Test, AddRemoveInterfaces);
- scoped_ptr<DBusObjectManagerProxyInterface> proxy_;
+ std::unique_ptr<DBusObjectManagerProxyInterface> proxy_;
base::WeakPtrFactory<ModemManager1> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ModemManager1);
diff --git a/modem_manager_unittest.cc b/modem_manager_unittest.cc
index 293402f..82ea6b3 100644
--- a/modem_manager_unittest.cc
+++ b/modem_manager_unittest.cc
@@ -178,7 +178,7 @@
}
ModemManagerClassicMockInit modem_manager_;
- scoped_ptr<MockModemManagerProxy> proxy_;
+ std::unique_ptr<MockModemManagerProxy> proxy_;
};
TEST_F(ModemManagerClassicTest, Connect) {
@@ -253,7 +253,7 @@
}
ModemManager1MockInit modem_manager_;
- scoped_ptr<MockDBusObjectManagerProxy> proxy_;
+ std::unique_ptr<MockDBusObjectManagerProxy> proxy_;
MockProxyFactory proxy_factory_;
};
diff --git a/modem_proxy.cc b/modem_proxy.cc
index 5b47f96..1c7c6ac 100644
--- a/modem_proxy.cc
+++ b/modem_proxy.cc
@@ -4,6 +4,8 @@
#include "shill/modem_proxy.h"
+#include <memory>
+
#include <base/bind.h>
#include <base/strings/stringprintf.h>
@@ -16,6 +18,7 @@
using base::Callback;
using base::StringPrintf;
using std::string;
+using std::unique_ptr;
namespace shill {
@@ -76,7 +79,7 @@
void ModemProxy::Proxy::EnableCallback(const DBus::Error &dberror, void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
callback->Run(error);
@@ -86,7 +89,7 @@
const DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ModemInfoCallback> callback(
+ unique_ptr<ModemInfoCallback> callback(
reinterpret_cast<ModemInfoCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
@@ -96,7 +99,7 @@
void ModemProxy::Proxy::DisconnectCallback(const DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
callback->Run(error);
diff --git a/modem_simple_proxy.cc b/modem_simple_proxy.cc
index 57a3aa5..ce5ca43 100644
--- a/modem_simple_proxy.cc
+++ b/modem_simple_proxy.cc
@@ -4,6 +4,8 @@
#include "shill/modem_simple_proxy.h"
+#include <memory>
+
#include <base/bind.h>
#include "shill/cellular_error.h"
@@ -14,6 +16,7 @@
using base::Bind;
using base::Callback;
using std::string;
+using std::unique_ptr;
namespace shill {
@@ -54,7 +57,7 @@
const DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<DBusPropertyMapCallback> callback(
+ unique_ptr<DBusPropertyMapCallback> callback(
reinterpret_cast<DBusPropertyMapCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
@@ -64,7 +67,7 @@
void ModemSimpleProxy::Proxy::ConnectCallback(const DBus::Error &dberror,
void *data) {
SLOG(DBus, 2) << __func__;
- scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+ unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
callback->Run(error);
diff --git a/modem_unittest.cc b/modem_unittest.cc
index c47ed44..87aa3a3 100644
--- a/modem_unittest.cc
+++ b/modem_unittest.cc
@@ -74,7 +74,7 @@
EventDispatcher dispatcher_;
MockModemInfo modem_info_;
MockDeviceInfo device_info_;
- scoped_ptr<StrictModem> modem_;
+ std::unique_ptr<StrictModem> modem_;
MockRTNLHandler rtnl_handler_;
ByteString expected_address_;
};
diff --git a/pending_activation_store.cc b/pending_activation_store.cc
index 76a1aa5..bedf196 100644
--- a/pending_activation_store.cc
+++ b/pending_activation_store.cc
@@ -88,7 +88,7 @@
return false;
}
FilePath path = storage_path.Append(kStorageFileName);
- scoped_ptr<KeyFileStore> storage(new KeyFileStore(glib));
+ std::unique_ptr<KeyFileStore> storage(new KeyFileStore(glib));
storage->set_path(path);
bool already_exists = storage->IsNonEmpty();
if (!storage->Open()) {
diff --git a/pending_activation_store.h b/pending_activation_store.h
index de2828d..dd58ec9 100644
--- a/pending_activation_store.h
+++ b/pending_activation_store.h
@@ -5,10 +5,10 @@
#ifndef SHILL_PENDING_ACTIVATION_STORE_H_
#define SHILL_PENDING_ACTIVATION_STORE_H_
+#include <memory>
#include <string>
#include <base/files/file_path.h>
-#include <base/memory/scoped_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include "shill/key_file_store.h"
@@ -93,7 +93,7 @@
static std::string IdentifierTypeToGroupId(IdentifierType type);
- scoped_ptr<StoreInterface> storage_;
+ std::unique_ptr<StoreInterface> storage_;
DISALLOW_COPY_AND_ASSIGN(PendingActivationStore);
};
diff --git a/pending_activation_store_unittest.cc b/pending_activation_store_unittest.cc
index 9310bf4..d403246 100644
--- a/pending_activation_store_unittest.cc
+++ b/pending_activation_store_unittest.cc
@@ -5,7 +5,6 @@
#include "shill/pending_activation_store.h"
#include <base/files/scoped_temp_dir.h>
-#include <base/memory/scoped_ptr.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -31,7 +30,7 @@
}
GLib glib_;
- scoped_ptr<MockStore> mock_store_;
+ std::unique_ptr<MockStore> mock_store_;
PendingActivationStore store_;
};
diff --git a/subscription_state_out_of_credits_detector_unittest.cc b/subscription_state_out_of_credits_detector_unittest.cc
index 40822a7..a119b5e 100644
--- a/subscription_state_out_of_credits_detector_unittest.cc
+++ b/subscription_state_out_of_credits_detector_unittest.cc
@@ -4,6 +4,8 @@
#include "shill/subscription_state_out_of_credits_detector.h"
+#include <memory>
+
#include <gtest/gtest.h>
#include "ModemManager/ModemManager.h"
@@ -69,7 +71,8 @@
scoped_refptr<NiceMock<MockCellular>> cellular_;
scoped_refptr<NiceMock<MockCellularService>> service_;
scoped_refptr<NiceMock<MockConnection>> connection_;
- scoped_ptr<SubscriptionStateOutOfCreditsDetector> out_of_credits_detector_;
+ std::unique_ptr<SubscriptionStateOutOfCreditsDetector>
+ out_of_credits_detector_;
};
const char