shill: Replace scoped_ptr with std::unique_ptr.
BUG=None
TEST=`USE='wimax' FEATURES=test emerge-$BOARD shill`
TEST=`USE='wimax clang asan' FEATURES=test emerge-$BOARD shill`
Change-Id: Id9737d9a9c75ecb6abb466b5559ff06dcf0751cd
Reviewed-on: https://chromium-review.googlesource.com/224138
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
diff --git a/arp_client.h b/arp_client.h
index 0d0ff49..e402f22 100644
--- a/arp_client.h
+++ b/arp_client.h
@@ -5,8 +5,9 @@
#ifndef SHILL_ARP_CLIENT_H_
#define SHILL_ARP_CLIENT_H_
+#include <memory>
+
#include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
namespace shill {
@@ -60,8 +61,8 @@
bool CreateSocket(uint16_t arp_opcode);
const int interface_index_;
- scoped_ptr<Sockets> sockets_;
- scoped_ptr<ScopedSocketCloser> socket_closer_;
+ std::unique_ptr<Sockets> sockets_;
+ std::unique_ptr<ScopedSocketCloser> socket_closer_;
int socket_;
DISALLOW_COPY_AND_ASSIGN(ArpClient);
diff --git a/crypto_provider.cc b/crypto_provider.cc
index 6b94f8f..1bd7359 100644
--- a/crypto_provider.cc
+++ b/crypto_provider.cc
@@ -4,7 +4,8 @@
#include "shill/crypto_provider.h"
-#include <base/memory/scoped_ptr.h>
+#include <memory>
+
#include <base/strings/string_util.h>
#include "shill/crypto_des_cbc.h"
@@ -25,7 +26,7 @@
cryptos_.clear();
// Register the crypto modules in priority order -- highest priority first.
- scoped_ptr<CryptoDESCBC> des_cbc(new CryptoDESCBC(glib_));
+ std::unique_ptr<CryptoDESCBC> des_cbc(new CryptoDESCBC(glib_));
if (des_cbc->LoadKeyMatter(key_matter_file_)) {
cryptos_.push_back(des_cbc.release());
}
diff --git a/crypto_util_proxy.h b/crypto_util_proxy.h
index 7fd88c3..c3c94bd 100644
--- a/crypto_util_proxy.h
+++ b/crypto_util_proxy.h
@@ -5,6 +5,7 @@
#ifndef SHILL_CRYPTO_UTIL_PROXY_H_
#define SHILL_CRYPTO_UTIL_PROXY_H_
+#include <memory>
#include <string>
#include <vector>
@@ -130,8 +131,8 @@
int shim_stdin_;
int shim_stdout_;
pid_t shim_pid_;
- scoped_ptr<IOHandler> shim_stdin_handler_;
- scoped_ptr<IOHandler> shim_stdout_handler_;
+ std::unique_ptr<IOHandler> shim_stdin_handler_;
+ std::unique_ptr<IOHandler> shim_stdout_handler_;
Error shim_result_;
StringCallback result_handler_;
base::CancelableClosure shim_job_timeout_callback_;
diff --git a/device.h b/device.h
index 1d2211f..8902983 100644
--- a/device.h
+++ b/device.h
@@ -5,12 +5,12 @@
#ifndef SHILL_DEVICE_H_
#define SHILL_DEVICE_H_
+#include <memory>
#include <string>
#include <vector>
#include <base/macros.h>
#include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@@ -684,16 +684,16 @@
IPConfigRefPtr ip6config_;
ConnectionRefPtr connection_;
base::WeakPtrFactory<Device> weak_ptr_factory_;
- scoped_ptr<DeviceAdaptorInterface> adaptor_;
- scoped_ptr<PortalDetector> portal_detector_;
- scoped_ptr<LinkMonitor> link_monitor_;
+ std::unique_ptr<DeviceAdaptorInterface> adaptor_;
+ std::unique_ptr<PortalDetector> portal_detector_;
+ std::unique_ptr<LinkMonitor> link_monitor_;
// Used for verifying whether DNS server is functional.
- scoped_ptr<DNSServerTester> dns_server_tester_;
+ std::unique_ptr<DNSServerTester> dns_server_tester_;
base::Callback<void(const PortalDetector::Result &)>
portal_detector_callback_;
// Callback to invoke when IPv6 DNS servers lifetime expired.
base::CancelableClosure ipv6_dns_server_expired_callback_;
- scoped_ptr<TrafficMonitor> traffic_monitor_;
+ std::unique_ptr<TrafficMonitor> traffic_monitor_;
// DNS servers obtained from ipconfig (either from DHCP or static config)
// that are not working.
std::vector<std::string> config_dns_servers_;
@@ -719,7 +719,7 @@
Time *time_;
time_t last_link_monitor_failed_time_;
- scoped_ptr<ConnectionTester> connection_tester_;
+ std::unique_ptr<ConnectionTester> connection_tester_;
base::Callback<void()> connection_tester_callback_;
DISALLOW_COPY_AND_ASSIGN(Device);
diff --git a/device_info.cc b/device_info.cc
index 1f772cf..18d49c7 100644
--- a/device_info.cc
+++ b/device_info.cc
@@ -24,7 +24,6 @@
#include <base/files/file_enumerator.h>
#include <base/files/file_util.h>
#include <base/files/scoped_file.h>
-#include <base/memory/scoped_ptr.h>
#include <base/stl_util.h>
#include <base/strings/string_number_conversions.h>
#include <base/strings/string_util.h>
diff --git a/device_info.h b/device_info.h
index fb66099..7d7600b 100644
--- a/device_info.h
+++ b/device_info.h
@@ -6,6 +6,7 @@
#define SHILL_DEVICE_INFO_H_
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -14,7 +15,6 @@
#include <base/cancelable_callback.h>
#include <base/files/file_path.h>
#include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@@ -277,9 +277,9 @@
base::Callback<void(const RTNLMessage &)> link_callback_;
base::Callback<void(const RTNLMessage &)> address_callback_;
base::Callback<void(const RTNLMessage &)> rdnss_callback_;
- scoped_ptr<RTNLListener> link_listener_;
- scoped_ptr<RTNLListener> address_listener_;
- scoped_ptr<RTNLListener> rdnss_listener_;
+ std::unique_ptr<RTNLListener> link_listener_;
+ std::unique_ptr<RTNLListener> address_listener_;
+ std::unique_ptr<RTNLListener> rdnss_listener_;
std::set<std::string> black_list_;
base::FilePath device_info_root_;
@@ -296,7 +296,7 @@
NetlinkManager *netlink_manager_;
// A member of the class so that a mock can be injected for testing.
- scoped_ptr<Sockets> sockets_;
+ std::unique_ptr<Sockets> sockets_;
Time *time_;
diff --git a/device_info_unittest.cc b/device_info_unittest.cc
index 343aee6..8565ac0 100644
--- a/device_info_unittest.cc
+++ b/device_info_unittest.cc
@@ -4,6 +4,8 @@
#include "shill/device_info.h"
+#include <memory>
+
#include <glib.h>
#include <linux/if.h>
#include <linux/if_tun.h>
@@ -50,6 +52,7 @@
using std::map;
using std::set;
using std::string;
+using std::unique_ptr;
using std::vector;
using testing::_;
using testing::AnyNumber;
@@ -296,7 +299,7 @@
}
TEST_F(DeviceInfoTest, DeviceEnumeration) {
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
message->set_link_status(RTNLMessage::LinkStatus(0, IFF_LOWER_UP, 0));
EXPECT_FALSE(device_info_.GetDevice(kTestDeviceIndex).get());
EXPECT_EQ(-1, device_info_.GetIndex(kTestDeviceName));
@@ -332,7 +335,7 @@
&control_interface_, &dispatcher_, &metrics_, &manager_,
"null0", "addr0", kTestDeviceIndex));
device_info_.infos_[kTestDeviceIndex].device = device0;
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeDelete));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeDelete));
EXPECT_CALL(*device0, technology()).WillRepeatedly(Return(Technology::kWifi));
EXPECT_CALL(manager_, DeregisterDevice(_)).Times(1);
EXPECT_CALL(metrics_, DeregisterDevice(kTestDeviceIndex)).Times(1);
@@ -404,7 +407,7 @@
kTestDeviceIndex, &rx_bytes, &tx_bytes));
// No link statistics in the message.
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
SendMessageToDeviceInfo(*message);
EXPECT_TRUE(device_info_.GetByteCounts(
kTestDeviceIndex, &rx_bytes, &tx_bytes));
@@ -645,7 +648,7 @@
TEST_F(DeviceInfoTest, DeviceBlackList) {
device_info_.AddDeviceToBlackList(kTestDeviceName);
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
SendMessageToDeviceInfo(*message);
DeviceRefPtr device = device_info_.GetDevice(kTestDeviceIndex);
@@ -654,7 +657,7 @@
}
TEST_F(DeviceInfoTest, DeviceAddressList) {
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
SendMessageToDeviceInfo(*message);
vector<DeviceInfo::AddressData> addresses;
@@ -719,7 +722,7 @@
}
TEST_F(DeviceInfoTest, FlushAddressList) {
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
SendMessageToDeviceInfo(*message);
IPAddress address1(IPAddress::kFamilyIPv6);
@@ -762,7 +765,7 @@
}
TEST_F(DeviceInfoTest, HasOtherAddress) {
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
SendMessageToDeviceInfo(*message);
IPAddress address0(IPAddress::kFamilyIPv4);
@@ -849,7 +852,7 @@
}
TEST_F(DeviceInfoTest, HasDirectConnectivityTo) {
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
SendMessageToDeviceInfo(*message);
IPAddress address0(IPAddress::kFamilyIPv4);
@@ -928,7 +931,7 @@
SetSockets();
EXPECT_CALL(*mock_sockets_, Socket(PF_INET, SOCK_DGRAM, 0))
.WillOnce(Return(-1));
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
message->set_link_status(RTNLMessage::LinkStatus(0, IFF_LOWER_UP, 0));
SendMessageToDeviceInfo(*message);
EXPECT_TRUE(device_info_.GetDevice(kTestDeviceIndex).get());
@@ -946,7 +949,7 @@
.WillOnce(Return(-1));
EXPECT_CALL(*mock_sockets_, Close(kFd));
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
message->set_link_status(RTNLMessage::LinkStatus(0, IFF_LOWER_UP, 0));
SendMessageToDeviceInfo(*message);
EXPECT_TRUE(device_info_.GetDevice(kTestDeviceIndex).get());
@@ -982,7 +985,7 @@
.WillOnce(DoAll(SetIfreq(ifr), Return(0)));
EXPECT_CALL(*mock_sockets_, Close(kFd));
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
message->set_link_status(RTNLMessage::LinkStatus(0, IFF_LOWER_UP, 0));
SendMessageToDeviceInfo(*message);
EXPECT_TRUE(device_info_.GetDevice(kTestDeviceIndex).get());
@@ -1006,7 +1009,7 @@
TEST_F(DeviceInfoTest, GetMACAddressOfPeerBadAddress) {
SetSockets();
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
message->set_link_status(RTNLMessage::LinkStatus(0, IFF_LOWER_UP, 0));
SendMessageToDeviceInfo(*message);
EXPECT_TRUE(device_info_.GetDevice(kTestDeviceIndex).get());
@@ -1030,7 +1033,7 @@
SetSockets();
EXPECT_CALL(*mock_sockets_, Socket(PF_INET, SOCK_DGRAM, 0))
.WillOnce(Return(-1));
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
message->set_link_status(RTNLMessage::LinkStatus(0, IFF_LOWER_UP, 0));
SendMessageToDeviceInfo(*message);
IPAddress ip_address(IPAddress::kFamilyIPv4);
@@ -1047,7 +1050,7 @@
.WillOnce(Return(kFd));
EXPECT_CALL(*mock_sockets_, Ioctl(kFd, SIOCGARP, NotNull()))
.WillOnce(Return(-1));
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
message->set_link_status(RTNLMessage::LinkStatus(0, IFF_LOWER_UP, 0));
SendMessageToDeviceInfo(*message);
IPAddress ip_address(IPAddress::kFamilyIPv4);
@@ -1083,7 +1086,7 @@
}
TEST_F(DeviceInfoTest, GetMACAddressOfPeer) {
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
message->set_link_status(RTNLMessage::LinkStatus(0, IFF_LOWER_UP, 0));
SendMessageToDeviceInfo(*message);
@@ -1134,8 +1137,8 @@
IPAddress ipv4_address(IPAddress::kFamilyIPv4);
EXPECT_TRUE(ipv4_address.SetAddressFromString(kTestIPAddress0));
- auto message(make_scoped_ptr(BuildAddressMessage(
- RTNLMessage::kModeAdd, ipv4_address, 0, 0)));
+ unique_ptr<RTNLMessage> message(
+ BuildAddressMessage(RTNLMessage::kModeAdd, ipv4_address, 0, 0));
EXPECT_CALL(*device, OnIPv6AddressChanged()).Times(0);
@@ -1226,8 +1229,8 @@
// Infinite lifetime
const uint32_t kInfiniteLifetime = 0xffffffff;
- auto message(make_scoped_ptr(BuildRdnssMessage(
- RTNLMessage::kModeAdd, kInfiniteLifetime, dns_server_addresses_in)));
+ unique_ptr<RTNLMessage> message(BuildRdnssMessage(
+ RTNLMessage::kModeAdd, kInfiniteLifetime, dns_server_addresses_in));
EXPECT_CALL(time_, GetSecondsBoottime(_)).
WillOnce(DoAll(SetArgPointee<0>(0), Return(true)));
EXPECT_CALL(*device, OnIPv6DnsServerAddressesChanged()).Times(1);
@@ -1244,8 +1247,8 @@
// Lifetime of 120, retrieve DNS server addresses after 10 seconds.
const uint32_t kLifetime120 = 120;
const uint32_t kElapseTime10 = 10;
- auto message1(make_scoped_ptr(BuildRdnssMessage(
- RTNLMessage::kModeAdd, kLifetime120, dns_server_addresses_in)));
+ unique_ptr<RTNLMessage> message1(BuildRdnssMessage(
+ RTNLMessage::kModeAdd, kLifetime120, dns_server_addresses_in));
EXPECT_CALL(time_, GetSecondsBoottime(_)).
WillOnce(DoAll(SetArgPointee<0>(0), Return(true)));
EXPECT_CALL(*device, OnIPv6DnsServerAddressesChanged()).Times(1);
@@ -1516,7 +1519,7 @@
}
void AddDelayedDevice() {
- scoped_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
+ unique_ptr<RTNLMessage> message(BuildLinkMessage(RTNLMessage::kModeAdd));
EXPECT_CALL(test_device_info_, GetDeviceTechnology(kTestDeviceName))
.WillOnce(Return(Technology::kCDCEthernet));
EXPECT_CALL(test_device_info_, CreateDevice(
diff --git a/device_stub.h b/device_stub.h
index 75d3eb9..21f711f 100644
--- a/device_stub.h
+++ b/device_stub.h
@@ -6,7 +6,6 @@
#define SHILL_DEVICE_STUB_H_
#include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
#include <string>
#include <vector>
diff --git a/device_unittest.cc b/device_unittest.cc
index 41ad0ab..6e0599d 100644
--- a/device_unittest.cc
+++ b/device_unittest.cc
@@ -9,6 +9,7 @@
#include <linux/if.h> // NOLINT - Needs typedefs from sys/socket.h.
#include <map>
+#include <memory>
#include <string>
#include <vector>
@@ -329,7 +330,7 @@
TEST_F(DeviceTest, AcquireIPConfig) {
device_->ipconfig_ = new IPConfig(control_interface(), "randomname");
- scoped_ptr<MockDHCPProvider> dhcp_provider(new MockDHCPProvider());
+ std::unique_ptr<MockDHCPProvider> dhcp_provider(new MockDHCPProvider());
device_->dhcp_provider_ = dhcp_provider.get();
scoped_refptr<MockDHCPConfig> dhcp_config(new MockDHCPConfig(
control_interface(),
diff --git a/dhcp_config.h b/dhcp_config.h
index eb4fa5d..ad05692 100644
--- a/dhcp_config.h
+++ b/dhcp_config.h
@@ -6,11 +6,11 @@
#define SHILL_DHCP_CONFIG_H_
#include <map>
+#include <memory>
#include <string>
#include <base/cancelable_callback.h>
#include <base/files/file_path.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include <chromeos/minijail/minijail.h>
#include <dbus-c++/types.h>
@@ -246,7 +246,7 @@
bool is_gateway_arp_active_;
// The proxy for communicating with the DHCP client.
- scoped_ptr<DHCPProxyInterface> proxy_;
+ std::unique_ptr<DHCPProxyInterface> proxy_;
// Called if we fail to get a DHCP lease in a timely manner.
base::CancelableClosure lease_acquisition_timeout_callback_;
diff --git a/dhcp_config_unittest.cc b/dhcp_config_unittest.cc
index de452a8..ab5f54c 100644
--- a/dhcp_config_unittest.cc
+++ b/dhcp_config_unittest.cc
@@ -4,6 +4,7 @@
#include "shill/dhcp_config.h"
+#include <memory>
#include <string>
#include <vector>
@@ -32,6 +33,7 @@
using base::Unretained;
using chromeos::MockMinijail;
using std::string;
+using std::unique_ptr;
using std::vector;
using testing::_;
using testing::AnyNumber;
@@ -99,10 +101,10 @@
FilePath lease_file_;
FilePath pid_file_;
ScopedTempDir temp_dir_;
- scoped_ptr<MockDHCPProxy> proxy_;
+ unique_ptr<MockDHCPProxy> proxy_;
MockProxyFactory proxy_factory_;
MockControl control_;
- scoped_ptr<MockMinijail> minijail_;
+ unique_ptr<MockMinijail> minijail_;
MockMetrics metrics_;
DHCPConfigRefPtr config_;
};
diff --git a/dhcp_provider.h b/dhcp_provider.h
index 0a2f2f4..8276b25 100644
--- a/dhcp_provider.h
+++ b/dhcp_provider.h
@@ -6,11 +6,11 @@
#define SHILL_DHCP_PROVIDER_H_
#include <map>
+#include <memory>
#include <string>
#include <base/files/file_path.h>
#include <base/lazy_instance.h>
-#include <base/memory/scoped_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include "shill/refptr_types.h"
@@ -100,7 +100,7 @@
// A single listener is used to catch signals from all DHCP clients and
// dispatch them to the appropriate DHCP configuration instance.
- scoped_ptr<DHCPCDListener> listener_;
+ std::unique_ptr<DHCPCDListener> listener_;
// A map that binds PIDs to DHCP configuration instances.
PIDConfigMap configs_;
diff --git a/dns_client.h b/dns_client.h
index 16f1cec..283b083 100644
--- a/dns_client.h
+++ b/dns_client.h
@@ -5,12 +5,12 @@
#ifndef SHILL_DNS_CLIENT_H_
#define SHILL_DNS_CLIENT_H_
+#include <memory>
#include <string>
#include <vector>
#include <base/callback.h>
#include <base/cancelable_callback.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@@ -86,7 +86,7 @@
ClientCallback callback_;
int timeout_ms_;
bool running_;
- scoped_ptr<DNSClientState> resolver_state_;
+ std::unique_ptr<DNSClientState> resolver_state_;
base::CancelableClosure timeout_closure_;
base::WeakPtrFactory<DNSClient> weak_ptr_factory_;
Ares *ares_;
diff --git a/dns_client_unittest.cc b/dns_client_unittest.cc
index 1fca831..4092744 100644
--- a/dns_client_unittest.cc
+++ b/dns_client_unittest.cc
@@ -6,11 +6,11 @@
#include <netdb.h>
+#include <memory>
#include <string>
#include <vector>
#include <base/bind.h>
-#include <base/memory/scoped_ptr.h>
#include "shill/error.h"
#include "shill/event_dispatcher.h"
@@ -216,7 +216,7 @@
DNSClient::ClientCallback callback_;
};
- scoped_ptr<DNSClient> dns_client_;
+ std::unique_ptr<DNSClient> dns_client_;
StrictMock<MockEventDispatcher> dispatcher_;
string queued_request_;
StrictMock<DNSCallbackTarget> callback_target_;
diff --git a/dns_server_tester.h b/dns_server_tester.h
index 64f4a36..0a4f2a4 100644
--- a/dns_server_tester.h
+++ b/dns_server_tester.h
@@ -5,13 +5,13 @@
#ifndef SHILL_DNS_SERVER_TESTER_H_
#define SHILL_DNS_SERVER_TESTER_H_
+#include <memory>
#include <string>
#include <vector>
#include <base/callback.h>
#include <base/cancelable_callback.h>
#include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@@ -83,7 +83,7 @@
base::Callback<void(const Status)> dns_result_callback_;
base::Callback<void(const Error &, const IPAddress &)>
dns_client_callback_;
- scoped_ptr<DNSClient> dns_test_client_;
+ std::unique_ptr<DNSClient> dns_test_client_;
DISALLOW_COPY_AND_ASSIGN(DNSServerTester);
};
diff --git a/dns_server_tester_unittest.cc b/dns_server_tester_unittest.cc
index e68d660..ae752c6 100644
--- a/dns_server_tester_unittest.cc
+++ b/dns_server_tester_unittest.cc
@@ -4,10 +4,10 @@
#include "shill/dns_server_tester.h"
+#include <memory>
#include <string>
#include <base/bind.h>
-#include <base/memory/scoped_ptr.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -94,12 +94,12 @@
private:
StrictMock<MockEventDispatcher> dispatcher_;
MockControl control_;
- scoped_ptr<MockDeviceInfo> device_info_;
+ std::unique_ptr<MockDeviceInfo> device_info_;
scoped_refptr<MockConnection> connection_;
CallbackTarget callback_target_;
const string interface_name_;
vector<string> dns_servers_;
- scoped_ptr<DNSServerTester> dns_server_tester_;
+ std::unique_ptr<DNSServerTester> dns_server_tester_;
};
TEST_F(DNSServerTesterTest, Constructor) {
diff --git a/eap_listener.h b/eap_listener.h
index a0c3c59..c6b5ec7 100644
--- a/eap_listener.h
+++ b/eap_listener.h
@@ -5,9 +5,10 @@
#ifndef SHILL_EAP_LISTENER_H_
#define SHILL_EAP_LISTENER_H_
+#include <memory>
+
#include <base/callback.h>
#include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
namespace shill {
@@ -62,16 +63,16 @@
EapRequestReceivedCallback request_received_callback_;
// Sockets instance to perform socket calls on.
- scoped_ptr<Sockets> sockets_;
+ std::unique_ptr<Sockets> sockets_;
// Receive socket configured to receive PAE (Port Access Entity) packets.
int socket_;
// Scoped socket closer for the receive |socket_|.
- scoped_ptr<ScopedSocketCloser> socket_closer_;
+ std::unique_ptr<ScopedSocketCloser> socket_closer_;
// Input handler for |socket_|. Calls ReceiveRequest().
- scoped_ptr<IOHandler> receive_request_handler_;
+ std::unique_ptr<IOHandler> receive_request_handler_;
DISALLOW_COPY_AND_ASSIGN(EapListener);
};
diff --git a/ethernet.h b/ethernet.h
index d13306c..227a359 100644
--- a/ethernet.h
+++ b/ethernet.h
@@ -6,10 +6,10 @@
#define SHILL_ETHERNET_H_
#include <map>
+#include <memory>
#include <string>
#include <base/cancelable_callback.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include "shill/certificate_file.h"
@@ -108,14 +108,15 @@
// Track whether an EAP authenticator has been detected on this link.
bool is_eap_detected_;
- scoped_ptr<EapListener> eap_listener_;
+ std::unique_ptr<EapListener> eap_listener_;
// Track the progress of EAP authentication.
SupplicantEAPStateHandler eap_state_handler_;
// Proxy instances used to talk to wpa_supplicant.
- scoped_ptr<SupplicantProcessProxyInterface> supplicant_process_proxy_;
- scoped_ptr<SupplicantInterfaceProxyInterface> supplicant_interface_proxy_;
+ std::unique_ptr<SupplicantProcessProxyInterface> supplicant_process_proxy_;
+ std::unique_ptr<SupplicantInterfaceProxyInterface>
+ supplicant_interface_proxy_;
std::string supplicant_interface_path_;
std::string supplicant_network_path_;
@@ -130,7 +131,7 @@
// Store cached copy of proxy factory singleton for speed/ease of testing.
ProxyFactory *proxy_factory_;
- scoped_ptr<Sockets> sockets_;
+ std::unique_ptr<Sockets> sockets_;
base::WeakPtrFactory<Ethernet> weak_ptr_factory_;
diff --git a/ethernet_unittest.cc b/ethernet_unittest.cc
index 43792d8..250c6f6 100644
--- a/ethernet_unittest.cc
+++ b/ethernet_unittest.cc
@@ -8,8 +8,9 @@
#include <linux/if.h> // NOLINT - Needs definitions from netinet/ether.h
#include <linux/sockios.h>
+#include <memory>
+
#include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
#include "shill/mock_device_info.h"
#include "shill/mock_dhcp_config.h"
@@ -203,8 +204,8 @@
scoped_refptr<MockEthernetService> mock_service_;
scoped_refptr<MockService> mock_eap_service_;
NiceMock<MockProxyFactory> proxy_factory_;
- scoped_ptr<MockSupplicantInterfaceProxy> supplicant_interface_proxy_;
- scoped_ptr<MockSupplicantProcessProxy> supplicant_process_proxy_;
+ std::unique_ptr<MockSupplicantInterfaceProxy> supplicant_interface_proxy_;
+ std::unique_ptr<MockSupplicantProcessProxy> supplicant_process_proxy_;
};
// static
diff --git a/event_dispatcher.h b/event_dispatcher.h
index 5f93f86..d6509cf 100644
--- a/event_dispatcher.h
+++ b/event_dispatcher.h
@@ -5,10 +5,11 @@
#ifndef SHILL_EVENT_DISPATCHER_H_
#define SHILL_EVENT_DISPATCHER_H_
+#include <memory>
+
#include <base/callback.h>
#include <base/macros.h>
#include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
#include <base/message_loop/message_loop.h>
#include "shill/io_handler.h"
@@ -49,7 +50,7 @@
const IOHandler::ReadyCallback &ready_callback);
private:
- scoped_ptr<base::MessageLoop> dont_use_directly_;
+ std::unique_ptr<base::MessageLoop> dont_use_directly_;
scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
diff --git a/external_task.cc b/external_task.cc
index 194928e..8869e25 100644
--- a/external_task.cc
+++ b/external_task.cc
@@ -54,7 +54,7 @@
CHECK(!child_watch_tag_);
CHECK(!rpc_task_);
- scoped_ptr<RPCTask> local_rpc_task(new RPCTask(control_, this));
+ std::unique_ptr<RPCTask> local_rpc_task(new RPCTask(control_, this));
// const_cast is safe here, because exec*() (and SpawnAsync) do not
// modify the strings passed to them. This isn't captured in the
diff --git a/external_task.h b/external_task.h
index fffd0b3..5ec467e 100644
--- a/external_task.h
+++ b/external_task.h
@@ -8,12 +8,12 @@
#include <sys/types.h>
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include <base/callback.h>
#include <base/files/file_path.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@@ -50,7 +50,7 @@
// }
//
// private:
- // scoped_ptr<ExternalTask> task_;
+ // std::unique_ptr<ExternalTask> task_;
// }
void DestroyLater(EventDispatcher *dispatcher);
@@ -104,7 +104,7 @@
GLib *glib_;
ProcessKiller *process_killer_; // Field permits mocking.
- scoped_ptr<RPCTask> rpc_task_;
+ std::unique_ptr<RPCTask> rpc_task_;
base::WeakPtr<RPCTaskDelegate> task_delegate_;
base::Callback<void(pid_t, int)> death_callback_;
diff --git a/external_task_unittest.cc b/external_task_unittest.cc
index caee723..b423efa 100644
--- a/external_task_unittest.cc
+++ b/external_task_unittest.cc
@@ -5,6 +5,7 @@
#include "shill/external_task.h"
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -106,7 +107,7 @@
MockProcessKiller process_killer_;
base::WeakPtrFactory<ExternalTaskTest> weak_ptr_factory_;
base::Callback<void(pid_t, int)> death_callback_;
- scoped_ptr<ExternalTask> external_task_;
+ std::unique_ptr<ExternalTask> external_task_;
bool test_rpc_task_destroyed_;
};
@@ -222,7 +223,7 @@
EXPECT_TRUE(error.IsSuccess());
EXPECT_EQ(kPID, external_task_->pid_);
EXPECT_EQ(kTag, external_task_->child_watch_tag_);
- EXPECT_TRUE(external_task_->rpc_task_);
+ EXPECT_NE(nullptr, external_task_->rpc_task_);
}
TEST_F(ExternalTaskTest, Stop) {
@@ -231,7 +232,7 @@
FakeUpRunningProcess(kTag, kPID);
ExpectStop(kTag, kPID);
external_task_->Stop();
- ASSERT_TRUE(external_task_);
+ ASSERT_NE(nullptr, external_task_);
VerifyStop();
}
diff --git a/hook_table_unittest.cc b/hook_table_unittest.cc
index b6540d1..019f98c 100644
--- a/hook_table_unittest.cc
+++ b/hook_table_unittest.cc
@@ -4,6 +4,7 @@
#include "shill/hook_table.h"
+#include <memory>
#include <string>
#include <base/bind.h>
@@ -235,7 +236,7 @@
// This test verifies that a class that removes itself from a hook table upon
// destruction does not crash if the hook table is destroyed first.
TEST_F(HookTableTest, RefcountedObject) {
- scoped_ptr<HookTable> ht(new HookTable(&event_dispatcher_));
+ std::unique_ptr<HookTable> ht(new HookTable(&event_dispatcher_));
{
scoped_refptr<SomeClass> ref_counted_object = new SomeClass();
Closure start_callback = Bind(&SomeClass::StartAction, ref_counted_object);
diff --git a/http_proxy.h b/http_proxy.h
index bef7748..b0f4183 100644
--- a/http_proxy.h
+++ b/http_proxy.h
@@ -5,12 +5,12 @@
#ifndef SHILL_HTTP_PROXY_H_
#define SHILL_HTTP_PROXY_H_
+#include <memory>
#include <string>
#include <vector>
#include <base/cancelable_callback.h>
#include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include "shill/byte_string.h"
@@ -129,12 +129,12 @@
base::Callback<void(int)> write_server_callback_;
// State held while proxy is started (even if no transaction is active).
- scoped_ptr<IOHandler> accept_handler_;
+ std::unique_ptr<IOHandler> accept_handler_;
EventDispatcher *dispatcher_;
- scoped_ptr<DNSClient> dns_client_;
+ std::unique_ptr<DNSClient> dns_client_;
int proxy_port_;
int proxy_socket_;
- scoped_ptr<AsyncConnection> server_async_connection_;
+ std::unique_ptr<AsyncConnection> server_async_connection_;
Sockets *sockets_;
// State held while proxy is started and a transaction is active.
@@ -150,10 +150,10 @@
std::string server_hostname_;
ByteString client_data_;
ByteString server_data_;
- scoped_ptr<IOHandler> read_client_handler_;
- scoped_ptr<IOHandler> write_client_handler_;
- scoped_ptr<IOHandler> read_server_handler_;
- scoped_ptr<IOHandler> write_server_handler_;
+ std::unique_ptr<IOHandler> read_client_handler_;
+ std::unique_ptr<IOHandler> write_client_handler_;
+ std::unique_ptr<IOHandler> read_server_handler_;
+ std::unique_ptr<IOHandler> write_server_handler_;
DISALLOW_COPY_AND_ASSIGN(HTTPProxy);
};
diff --git a/http_proxy_unittest.cc b/http_proxy_unittest.cc
index a55d093..c37d403 100644
--- a/http_proxy_unittest.cc
+++ b/http_proxy_unittest.cc
@@ -6,6 +6,7 @@
#include <netinet/in.h>
+#include <memory>
#include <string>
#include <vector>
@@ -456,7 +457,7 @@
StrictMock<MockDNSClient> *dns_client_;
MockEventDispatcher dispatcher_;
MockControl control_;
- scoped_ptr<MockDeviceInfo> device_info_;
+ std::unique_ptr<MockDeviceInfo> device_info_;
scoped_refptr<MockConnection> connection_;
StrictMock<MockSockets> sockets_;
HTTPProxy proxy_; // Destroy first, before anything it references.
diff --git a/http_request.h b/http_request.h
index 93414cd..c00c9bd 100644
--- a/http_request.h
+++ b/http_request.h
@@ -5,13 +5,13 @@
#ifndef SHILL_HTTP_REQUEST_H_
#define SHILL_HTTP_REQUEST_H_
+#include <memory>
#include <string>
#include <vector>
#include <base/callback.h>
#include <base/cancelable_callback.h>
#include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include "shill/byte_string.h"
@@ -116,10 +116,10 @@
base::Callback<void(int)> write_server_callback_;
base::Callback<void(Result, const ByteString &)> result_callback_;
base::Callback<void(const ByteString &)> read_event_callback_;
- scoped_ptr<IOHandler> read_server_handler_;
- scoped_ptr<IOHandler> write_server_handler_;
- scoped_ptr<DNSClient> dns_client_;
- scoped_ptr<AsyncConnection> server_async_connection_;
+ std::unique_ptr<IOHandler> read_server_handler_;
+ std::unique_ptr<IOHandler> write_server_handler_;
+ std::unique_ptr<DNSClient> dns_client_;
+ std::unique_ptr<AsyncConnection> server_async_connection_;
std::string server_hostname_;
int server_port_;
int server_socket_;
diff --git a/http_request_unittest.cc b/http_request_unittest.cc
index 848b754..c5a186c 100644
--- a/http_request_unittest.cc
+++ b/http_request_unittest.cc
@@ -6,6 +6,7 @@
#include <netinet/in.h>
+#include <memory>
#include <string>
#include <vector>
@@ -327,9 +328,9 @@
StrictMock<MockDNSClient> *dns_client_;
StrictMock<MockEventDispatcher> dispatcher_;
MockControl control_;
- scoped_ptr<MockDeviceInfo> device_info_;
+ std::unique_ptr<MockDeviceInfo> device_info_;
scoped_refptr<MockConnection> connection_;
- scoped_ptr<HTTPRequest> request_;
+ std::unique_ptr<HTTPRequest> request_;
StrictMock<MockSockets> sockets_;
StrictMock<CallbackTarget> target_;
ByteString expected_response_;
diff --git a/icmp.h b/icmp.h
index 39346db..81a24c4 100644
--- a/icmp.h
+++ b/icmp.h
@@ -5,7 +5,9 @@
#ifndef SHILL_ICMP_H_
#define SHILL_ICMP_H_
-#include <base/memory/scoped_ptr.h>
+#include <memory>
+
+#include <base/macros.h>
namespace shill {
@@ -34,8 +36,8 @@
private:
friend class IcmpTest;
- scoped_ptr<Sockets> sockets_;
- scoped_ptr<ScopedSocketCloser> socket_closer_;
+ std::unique_ptr<Sockets> sockets_;
+ std::unique_ptr<ScopedSocketCloser> socket_closer_;
int socket_;
DISALLOW_COPY_AND_ASSIGN(Icmp);
diff --git a/ipconfig.h b/ipconfig.h
index c32910c..97ecff8 100644
--- a/ipconfig.h
+++ b/ipconfig.h
@@ -5,12 +5,12 @@
#ifndef SHILL_IPCONFIG_H_
#define SHILL_IPCONFIG_H_
+#include <memory>
#include <string>
#include <vector>
#include <base/callback.h>
#include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include "shill/ip_address.h"
@@ -193,7 +193,7 @@
const std::string device_name_;
const std::string type_;
const uint serial_;
- scoped_ptr<IPConfigAdaptorInterface> adaptor_;
+ std::unique_ptr<IPConfigAdaptorInterface> adaptor_;
Properties properties_;
Callback update_callback_;
Callback failure_callback_;
diff --git a/manager.h b/manager.h
index 20f6a8c..a1a1055 100644
--- a/manager.h
+++ b/manager.h
@@ -6,6 +6,7 @@
#define SHILL_MANAGER_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
@@ -13,7 +14,6 @@
#include <base/files/file_path.h>
#include <base/macros.h>
#include <base/memory/ref_counted.h>
-#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
@@ -604,17 +604,17 @@
const base::FilePath storage_path_;
const std::string user_storage_path_;
base::FilePath user_profile_list_path_; // Changed in tests.
- scoped_ptr<ManagerAdaptorInterface> adaptor_;
- scoped_ptr<DBusManager> dbus_manager_;
+ std::unique_ptr<ManagerAdaptorInterface> adaptor_;
+ std::unique_ptr<DBusManager> dbus_manager_;
DeviceInfo device_info_;
#if !defined(DISABLE_CELLULAR)
ModemInfo modem_info_;
#endif // DISABLE_CELLULAR
- scoped_ptr<EthernetEapProvider> ethernet_eap_provider_;
- scoped_ptr<VPNProvider> vpn_provider_;
- scoped_ptr<WiFiProvider> wifi_provider_;
+ std::unique_ptr<EthernetEapProvider> ethernet_eap_provider_;
+ std::unique_ptr<VPNProvider> vpn_provider_;
+ std::unique_ptr<WiFiProvider> wifi_provider_;
#if !defined(DISABLE_WIMAX)
- scoped_ptr<WiMaxProvider> wimax_provider_;
+ std::unique_ptr<WiMaxProvider> wimax_provider_;
#endif // DISABLE_WIMAX
// Hold pointer to singleton Resolver instance for testing purposes.
Resolver *resolver_;
@@ -636,7 +636,7 @@
ControlInterface *control_interface_;
Metrics *metrics_;
GLib *glib_;
- scoped_ptr<PowerManager> power_manager_;
+ std::unique_ptr<PowerManager> power_manager_;
// The priority order of technologies
std::vector<Technology::Identifier> technology_order_;
@@ -676,12 +676,12 @@
int default_service_callback_tag_;
// Delegate to handle destination verification operations for the manager.
- scoped_ptr<CryptoUtilProxy> crypto_util_proxy_;
+ std::unique_ptr<CryptoUtilProxy> crypto_util_proxy_;
// Stores IP addresses of some remote hosts that accept port 80 TCP
// connections. ConnectionHealthChecker uses these IPs.
// The store resides in Manager so that it persists across Device reset.
- scoped_ptr<IPAddressStore> health_checker_remote_ips_;
+ std::unique_ptr<IPAddressStore> health_checker_remote_ips_;
// Stores the most recent copy of geolocation information for each
// technology type.
diff --git a/manager_unittest.cc b/manager_unittest.cc
index c9cf1e5..929778f 100644
--- a/manager_unittest.cc
+++ b/manager_unittest.cc
@@ -5,6 +5,7 @@
#include "shill/manager.h"
#include <map>
+#include <memory>
#include <set>
#include <glib.h>
@@ -183,7 +184,7 @@
Profile::Identifier id("rather", "irrelevant");
FilePath final_path(storage_path());
final_path = final_path.Append("test.profile");
- scoped_ptr<KeyFileStore> storage(new KeyFileStore(glib));
+ std::unique_ptr<KeyFileStore> storage(new KeyFileStore(glib));
storage->set_path(final_path);
if (!storage->Open())
return nullptr;
@@ -414,9 +415,9 @@
}
NiceMock<MockProxyFactory> proxy_factory_;
- scoped_ptr<MockPowerManager> power_manager_;
+ std::unique_ptr<MockPowerManager> power_manager_;
vector<scoped_refptr<MockDevice>> mock_devices_;
- scoped_ptr<MockDeviceInfo> device_info_;
+ std::unique_ptr<MockDeviceInfo> device_info_;
// This service is held for the manager, and given ownership in a mock
// function. This ensures that when the Manager takes ownership, there
@@ -3581,7 +3582,7 @@
}
TEST_F(ManagerTest, IgnoredSearchList) {
- scoped_ptr<MockResolver> resolver(new StrictMock<MockResolver>());
+ std::unique_ptr<MockResolver> resolver(new StrictMock<MockResolver>());
vector<string> ignored_paths;
SetResolver(resolver.get());
@@ -4335,7 +4336,7 @@
// We need a real glib here, so that profiles are persisted.
GLib glib;
ScopedTempDir temp_dir;
- scoped_ptr<Manager> manager;
+ std::unique_ptr<Manager> manager;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
// Instantiate a Manager with empty persistent storage. Check that
@@ -4401,7 +4402,7 @@
// easy way to mock out KeyFileStore.
GLib glib;
ScopedTempDir temp_dir;
- scoped_ptr<Manager> manager;
+ std::unique_ptr<Manager> manager;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
manager.reset(new Manager(control_interface(),
dispatcher(),
diff --git a/metrics.h b/metrics.h
index 3805b7a..39252a1 100644
--- a/metrics.h
+++ b/metrics.h
@@ -7,6 +7,7 @@
#include <list>
#include <map>
+#include <memory>
#include <string>
#include <base/memory/scoped_vector.h>
@@ -906,13 +907,13 @@
struct DeviceMetrics {
DeviceMetrics() : auto_connect_tries(0) {}
Technology::Identifier technology;
- scoped_ptr<chromeos_metrics::TimerReporter> initialization_timer;
- scoped_ptr<chromeos_metrics::TimerReporter> enable_timer;
- scoped_ptr<chromeos_metrics::TimerReporter> disable_timer;
- scoped_ptr<chromeos_metrics::TimerReporter> scan_timer;
- scoped_ptr<chromeos_metrics::TimerReporter> connect_timer;
- scoped_ptr<chromeos_metrics::TimerReporter> scan_connect_timer;
- scoped_ptr<chromeos_metrics::TimerReporter> auto_connect_timer;
+ std::unique_ptr<chromeos_metrics::TimerReporter> initialization_timer;
+ std::unique_ptr<chromeos_metrics::TimerReporter> enable_timer;
+ std::unique_ptr<chromeos_metrics::TimerReporter> disable_timer;
+ std::unique_ptr<chromeos_metrics::TimerReporter> scan_timer;
+ std::unique_ptr<chromeos_metrics::TimerReporter> connect_timer;
+ std::unique_ptr<chromeos_metrics::TimerReporter> scan_connect_timer;
+ std::unique_ptr<chromeos_metrics::TimerReporter> auto_connect_timer;
int auto_connect_tries;
};
typedef std::map<const int, std::shared_ptr<DeviceMetrics>>
@@ -989,11 +990,11 @@
ServiceMetricsLookupMap services_metrics_;
Technology::Identifier last_default_technology_;
bool was_online_;
- scoped_ptr<chromeos_metrics::Timer> time_online_timer_;
- scoped_ptr<chromeos_metrics::Timer> time_to_drop_timer_;
- scoped_ptr<chromeos_metrics::Timer> time_resume_to_ready_timer_;
- scoped_ptr<chromeos_metrics::Timer> time_termination_actions_timer;
- scoped_ptr<chromeos_metrics::Timer> time_suspend_actions_timer;
+ std::unique_ptr<chromeos_metrics::Timer> time_online_timer_;
+ std::unique_ptr<chromeos_metrics::Timer> time_to_drop_timer_;
+ std::unique_ptr<chromeos_metrics::Timer> time_resume_to_ready_timer_;
+ std::unique_ptr<chromeos_metrics::Timer> time_termination_actions_timer;
+ std::unique_ptr<chromeos_metrics::Timer> time_suspend_actions_timer;
bool collect_bootstats_;
DeviceMetricsLookupMap devices_metrics_;
diff --git a/portal_detector.h b/portal_detector.h
index 31f9a1f..ffec074 100644
--- a/portal_detector.h
+++ b/portal_detector.h
@@ -5,13 +5,13 @@
#ifndef SHILL_PORTAL_DETECTOR_H_
#define SHILL_PORTAL_DETECTOR_H_
+#include <memory>
#include <string>
#include <vector>
#include <base/callback.h>
#include <base/cancelable_callback.h>
#include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@@ -151,7 +151,7 @@
base::Callback<void(ConnectivityTrial::Result)> connectivity_trial_callback_;
Time *time_;
int failures_in_content_phase_;
- scoped_ptr<ConnectivityTrial> connectivity_trial_;
+ std::unique_ptr<ConnectivityTrial> connectivity_trial_;
DISALLOW_COPY_AND_ASSIGN(PortalDetector);
diff --git a/portal_detector_unittest.cc b/portal_detector_unittest.cc
index ccc2eff..e49163b 100644
--- a/portal_detector_unittest.cc
+++ b/portal_detector_unittest.cc
@@ -4,10 +4,10 @@
#include "shill/portal_detector.h"
+#include <memory>
#include <string>
#include <base/bind.h>
-#include <base/memory/scoped_ptr.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -156,10 +156,10 @@
StrictMock<MockEventDispatcher> dispatcher_;
MockControl control_;
- scoped_ptr<MockDeviceInfo> device_info_;
+ std::unique_ptr<MockDeviceInfo> device_info_;
scoped_refptr<MockConnection> connection_;
CallbackTarget callback_target_;
- scoped_ptr<PortalDetector> portal_detector_;
+ std::unique_ptr<PortalDetector> portal_detector_;
MockConnectivityTrial* connectivity_trial_;
StrictMock<MockTime> time_;
struct timeval current_time_;
diff --git a/power_manager.h b/power_manager.h
index 6dc6c1b..20e16fd 100644
--- a/power_manager.h
+++ b/power_manager.h
@@ -10,11 +10,11 @@
// PowerManagerProxy.
#include <map>
+#include <memory>
#include <string>
#include <base/callback.h>
#include <base/cancelable_callback.h>
-#include <base/memory/scoped_ptr.h>
#include "shill/power_manager_proxy_interface.h"
@@ -106,8 +106,8 @@
// The power manager proxy created by this class. It dispatches the inherited
// delegate methods of this object when changes in the power state occur.
- const scoped_ptr<PowerManagerProxyInterface> power_manager_proxy_;
- scoped_ptr<DBusNameWatcher> power_manager_name_watcher_;
+ const std::unique_ptr<PowerManagerProxyInterface> power_manager_proxy_;
+ std::unique_ptr<DBusNameWatcher> power_manager_name_watcher_;
// The delay (in milliseconds) to request powerd to wait after a suspend
// notification is received. powerd will actually suspend the system at least
// |suspend_delay_| after the notification, if we do not
diff --git a/power_manager_unittest.cc b/power_manager_unittest.cc
index 50c57c8..d8dfa55 100644
--- a/power_manager_unittest.cc
+++ b/power_manager_unittest.cc
@@ -4,10 +4,10 @@
#include "shill/power_manager.h"
+#include <memory>
#include <string>
#include <base/bind.h>
-#include <base/memory/scoped_ptr.h>
#include <chromeos/dbus/service_constants.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -74,8 +74,8 @@
PowerManagerProxyDelegate *delegate_;
MockPowerManagerProxy *const power_manager_proxy_raw_;
MockDBusServiceProxy *const dbus_service_proxy_raw_;
- scoped_ptr<MockPowerManagerProxy> power_manager_proxy_;
- scoped_ptr<MockDBusServiceProxy> dbus_service_proxy_;
+ std::unique_ptr<MockPowerManagerProxy> power_manager_proxy_;
+ std::unique_ptr<MockDBusServiceProxy> dbus_service_proxy_;
};
} // namespace
diff --git a/property_store_unittest.h b/property_store_unittest.h
index 175418b..6b22a9a 100644
--- a/property_store_unittest.h
+++ b/property_store_unittest.h
@@ -6,10 +6,10 @@
#define SHILL_PROPERTY_STORE_UNITTEST_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
-#include <base/memory/scoped_ptr.h>
#include <base/files/scoped_temp_dir.h>
#include <dbus-c++/dbus.h>
#include <gmock/gmock.h>
diff --git a/proxy_factory.h b/proxy_factory.h
index b56c4ba..343bdce 100644
--- a/proxy_factory.h
+++ b/proxy_factory.h
@@ -5,11 +5,11 @@
#ifndef SHILL_PROXY_FACTORY_H_
#define SHILL_PROXY_FACTORY_H_
+#include <memory>
#include <string>
#include <base/lazy_instance.h>
#include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
#include <dbus-c++/dbus.h>
#include "shill/refptr_types.h"
@@ -181,7 +181,7 @@
private:
friend struct base::DefaultLazyInstanceTraits<ProxyFactory>;
- scoped_ptr<DBus::Connection> connection_;
+ std::unique_ptr<DBus::Connection> connection_;
DISALLOW_COPY_AND_ASSIGN(ProxyFactory);
};
diff --git a/routing_table.cc b/routing_table.cc
index ee56197..3f8df00 100644
--- a/routing_table.cc
+++ b/routing_table.cc
@@ -16,12 +16,12 @@
#include <time.h>
#include <unistd.h>
+#include <memory>
#include <string>
#include <base/bind.h>
#include <base/files/file_path.h>
#include <base/files/file_util.h>
-#include <base/memory/scoped_ptr.h>
#include <base/stl_util.h>
#include <base/strings/stringprintf.h>
diff --git a/routing_table.h b/routing_table.h
index 78b5ce3..679d86a 100644
--- a/routing_table.h
+++ b/routing_table.h
@@ -6,6 +6,7 @@
#define SHILL_ROUTING_TABLE_H_
#include <deque>
+#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
@@ -13,7 +14,6 @@
#include <base/callback.h>
#include <base/lazy_instance.h>
#include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
#include "shill/ip_address.h"
#include "shill/refptr_types.h"
@@ -153,7 +153,7 @@
Tables tables_;
base::Callback<void(const RTNLMessage &)> route_callback_;
- scoped_ptr<RTNLListener> route_listener_;
+ std::unique_ptr<RTNLListener> route_listener_;
std::deque<Query> route_queries_;
// Cache singleton pointer for performance and test purposes.
diff --git a/routing_table_unittest.cc b/routing_table_unittest.cc
index 2382711..a1d43a6 100644
--- a/routing_table_unittest.cc
+++ b/routing_table_unittest.cc
@@ -5,9 +5,9 @@
#include <linux/rtnetlink.h>
#include <sys/socket.h>
+#include <memory>
#include <vector>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include <base/stl_util.h>
#include <gtest/gtest.h>
@@ -133,7 +133,7 @@
const RoutingTable::Query::Callback unreached_callback_;
};
- scoped_ptr<RoutingTable> routing_table_;
+ std::unique_ptr<RoutingTable> routing_table_;
TestEventDispatcher dispatcher_;
StrictMock<MockRTNLHandler> rtnl_handler_;
};
@@ -773,7 +773,7 @@
TEST_F(RoutingTableTest, CancelQueryCallback) {
IPAddress destination_address(IPAddress::kFamilyIPv4);
destination_address.SetAddressFromString(kTestRemoteAddress4);
- scoped_ptr<QueryCallbackTarget> target(new QueryCallbackTarget());
+ std::unique_ptr<QueryCallbackTarget> target(new QueryCallbackTarget());
EXPECT_CALL(rtnl_handler_, SendMessage(_))
.WillOnce(Invoke(this, &RoutingTableTest::SetSequenceForMessage));
EXPECT_TRUE(
diff --git a/rpc_task.h b/rpc_task.h
index 79814d7..089af18 100644
--- a/rpc_task.h
+++ b/rpc_task.h
@@ -6,11 +6,11 @@
#define SHILL_RPC_TASK_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
namespace shill {
@@ -59,7 +59,7 @@
RPCTaskDelegate *delegate_;
static unsigned int serial_number_;
std::string unique_name_; // MUST be unique amongst RPC task instances
- scoped_ptr<RPCTaskAdaptorInterface> adaptor_;
+ std::unique_ptr<RPCTaskAdaptorInterface> adaptor_;
DISALLOW_COPY_AND_ASSIGN(RPCTask);
};
diff --git a/service.cc b/service.cc
index 1f39cf7..1443b61 100644
--- a/service.cc
+++ b/service.cc
@@ -9,10 +9,10 @@
#include <algorithm>
#include <map>
+#include <memory>
#include <string>
#include <vector>
-#include <base/memory/scoped_ptr.h>
#include <base/strings/string_number_conversions.h>
#include <base/strings/stringprintf.h>
#include <chromeos/dbus/service_constants.h>
diff --git a/service.h b/service.h
index acbca74..8a2a990 100644
--- a/service.h
+++ b/service.h
@@ -9,13 +9,13 @@
#include <deque>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
#include <base/cancelable_callback.h>
#include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
#include <base/memory/weak_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@@ -808,7 +808,7 @@
std::string ui_data_;
std::string guid_;
bool save_credentials_;
- scoped_ptr<EapCredentials> eap_;
+ std::unique_ptr<EapCredentials> eap_;
Technology::Identifier technology_;
// The time of the most recent failure. Value is 0 if the service is
// not currently failed.
@@ -839,14 +839,14 @@
// List of subject names reported by remote entity during TLS setup.
std::vector<std::string> remote_certification_;
- scoped_ptr<ServiceAdaptorInterface> adaptor_;
- scoped_ptr<ServicePropertyChangeNotifier> property_change_notifier_;
- scoped_ptr<HTTPProxy> http_proxy_;
+ std::unique_ptr<ServiceAdaptorInterface> adaptor_;
+ std::unique_ptr<ServicePropertyChangeNotifier> property_change_notifier_;
+ std::unique_ptr<HTTPProxy> http_proxy_;
ConnectionRefPtr connection_;
StaticIPParameters static_ip_parameters_;
Metrics *metrics_;
Manager *manager_;
- scoped_ptr<Sockets> sockets_;
+ std::unique_ptr<Sockets> sockets_;
Time *time_;
DiagnosticsReporter *diagnostics_reporter_;
diff --git a/service_property_change_notifier.h b/service_property_change_notifier.h
index 5715275..e656349 100644
--- a/service_property_change_notifier.h
+++ b/service_property_change_notifier.h
@@ -5,12 +5,12 @@
#ifndef SHILL_SERVICE_PROPERTY_CHANGE_NOTIFIER_H_
#define SHILL_SERVICE_PROPERTY_CHANGE_NOTIFIER_H_
+#include <memory>
#include <string>
#include <vector>
#include <base/callback.h>
#include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
#include "shill/accessor_interface.h"
@@ -58,7 +58,7 @@
void Int32PropertyUpdater(const std::string &name, const int32_t &value);
ServiceAdaptorInterface *rpc_adaptor_;
- std::vector<scoped_ptr<PropertyObserverInterface>> property_observers_;
+ std::vector<std::unique_ptr<PropertyObserverInterface>> property_observers_;
DISALLOW_COPY_AND_ASSIGN(ServicePropertyChangeNotifier);
};
diff --git a/service_unittest.cc b/service_unittest.cc
index d1bb632..0566539 100644
--- a/service_unittest.cc
+++ b/service_unittest.cc
@@ -5,6 +5,7 @@
#include "shill/service.h"
#include <map>
+#include <memory>
#include <string>
#include <vector>
@@ -1255,7 +1256,7 @@
TEST_F(ServiceTest, IsDependentOn) {
EXPECT_FALSE(service_->IsDependentOn(nullptr));
- scoped_ptr<MockDeviceInfo> mock_device_info(
+ std::unique_ptr<MockDeviceInfo> mock_device_info(
new NiceMock<MockDeviceInfo>(control_interface(), dispatcher(), metrics(),
&mock_manager_));
scoped_refptr<MockConnection> mock_connection0(
@@ -1444,7 +1445,7 @@
EXPECT_EQ(Error::kNotFound, error.type());
}
- scoped_ptr<MockDeviceInfo> mock_device_info(
+ std::unique_ptr<MockDeviceInfo> mock_device_info(
new NiceMock<MockDeviceInfo>(control_interface(), dispatcher(), metrics(),
&mock_manager_));
scoped_refptr<MockConnection> mock_connection(
diff --git a/shill_daemon.h b/shill_daemon.h
index 6833559..de70262 100644
--- a/shill_daemon.h
+++ b/shill_daemon.h
@@ -5,10 +5,9 @@
#ifndef SHILL_SHILL_DAEMON_H_
#define SHILL_SHILL_DAEMON_H_
+#include <memory>
#include <string>
-#include <base/memory/scoped_ptr.h>
-
#include "shill/callback80211_metrics.h"
#include "shill/control_interface.h"
#include "shill/event_dispatcher.h"
@@ -55,17 +54,17 @@
void Stop();
Config *config_;
- scoped_ptr<ControlInterface> control_;
+ std::unique_ptr<ControlInterface> control_;
EventDispatcher dispatcher_;
GLib glib_;
Sockets sockets_;
- scoped_ptr<Metrics> metrics_;
+ std::unique_ptr<Metrics> metrics_;
ProxyFactory *proxy_factory_;
RTNLHandler *rtnl_handler_;
RoutingTable *routing_table_;
DHCPProvider *dhcp_provider_;
NetlinkManager *netlink_manager_;
- scoped_ptr<Manager> manager_;
+ std::unique_ptr<Manager> manager_;
Callback80211Metrics callback80211_metrics_;
};
diff --git a/shill_unittest.cc b/shill_unittest.cc
index 92b6b80..10681ed 100644
--- a/shill_unittest.cc
+++ b/shill_unittest.cc
@@ -4,6 +4,8 @@
#include <stdint.h>
+#include <memory>
+
#include <base/bind.h>
#include <base/cancelable_callback.h>
#include <base/memory/ref_counted.h>
@@ -173,7 +175,7 @@
bool got_ready_;
Callback<void(InputData*)> data_callback_;
Callback<void(int)> ready_callback_;
- scoped_ptr<IOHandler> input_handler_;
+ std::unique_ptr<IOHandler> input_handler_;
WeakPtrFactory<MockEventDispatchTester> tester_factory_;
CancelableClosure failsafe_;
};
diff --git a/shims/crypto_util.cc b/shims/crypto_util.cc
index de3f9c2..dccdb01 100644
--- a/shims/crypto_util.cc
+++ b/shims/crypto_util.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <unistd.h>
+
#include <limits>
#include <string>
#include <vector>
-#include <unistd.h>
#include <base/command_line.h>
#include <base/logging.h>
-#include <base/memory/scoped_ptr.h>
#include <base/posix/eintr_wrapper.h>
#include <chromeos/syslog_logging.h>
#include <openssl/bio.h>
@@ -71,14 +71,14 @@
return false;
}
- scoped_ptr<unsigned char[]> rsa_output(new unsigned char[RSA_size(rsa)]);
+ vector<unsigned char> rsa_output(RSA_size(rsa));
LOG(INFO) << "Encrypting data with public key.";
const int encrypted_length = RSA_public_encrypt(
data.length(),
// The API helpfully tells us that this operation will treat this buffer
// as read only, but fails to mark the parameter const.
reinterpret_cast<unsigned char *>(const_cast<char *>(data.data())),
- rsa_output.get(),
+ rsa_output.data(),
rsa,
RSA_PKCS1_PADDING);
if (encrypted_length <= 0) {
@@ -86,7 +86,7 @@
return false;
}
- encrypted_output->assign(reinterpret_cast<char *>(rsa_output.get()),
+ encrypted_output->assign(reinterpret_cast<char *>(rsa_output.data()),
encrypted_length);
return true;
}
diff --git a/shims/ppp.h b/shims/ppp.h
index 1f538df..3c3c487 100644
--- a/shims/ppp.h
+++ b/shims/ppp.h
@@ -5,11 +5,11 @@
#ifndef SHILL_SHIMS_PPP_H_
#define SHILL_SHIMS_PPP_H_
+#include <memory>
#include <string>
#include <base/macros.h>
#include <base/lazy_instance.h>
-#include <base/memory/scoped_ptr.h>
namespace DBus {
class BusDispatcher;
@@ -48,9 +48,9 @@
static std::string ConvertIPToText(const void *addr);
- scoped_ptr<DBus::BusDispatcher> dispatcher_;
- scoped_ptr<DBus::Connection> connection_;
- scoped_ptr<TaskProxy> proxy_;
+ std::unique_ptr<DBus::BusDispatcher> dispatcher_;
+ std::unique_ptr<DBus::Connection> connection_;
+ std::unique_ptr<TaskProxy> proxy_;
bool running_;
DISALLOW_COPY_AND_ASSIGN(PPP);
diff --git a/testing.h b/testing.h
index cdc8353..979b070 100644
--- a/testing.h
+++ b/testing.h
@@ -14,14 +14,14 @@
namespace shill {
// A Google Mock action (similar to testing::ReturnPointee) that takes a pointer
-// to a scoped_ptr object, releases and returns the raw pointer managed by the
-// scoped_ptr object when the action is invoked.
+// to a unique_ptr object, releases and returns the raw pointer managed by the
+// unique_ptr object when the action is invoked.
//
// Example usage:
//
// TEST(FactoryTest, CreateStuff) {
// MockFactory factory;
-// scoped_ptr<Stuff> stuff(new Stuff());
+// unique_ptr<Stuff> stuff(new Stuff());
// EXPECT_CALL(factory, CreateStuff())
// .WillOnce(ReturnAndReleasePointee(&stuff));
// }
@@ -30,8 +30,8 @@
// managed by |stuff| is transferred to the caller of |factory.CreateStuff()|.
// Otherwise, the Stuff object will be destroyed once |stuff| goes out of
// scope when the test completes.
-ACTION_P(ReturnAndReleasePointee, scoped_pointer) {
- return scoped_pointer->release();
+ACTION_P(ReturnAndReleasePointee, unique_pointer) {
+ return unique_pointer->release();
}
MATCHER(IsSuccess, "") {