Replace scoped_ptr with unique_ptr in webrtc/base/
This propagated into various other places. Also had to #include headers that
were implicitly pulled by "scoped_ptr.h".
BUG=webrtc:5520
Review URL: https://codereview.webrtc.org/1920043002
Cr-Original-Commit-Position: refs/heads/master@{#12501}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 555604a7463c6a6677f54aff340e7852a16b3c58
diff --git a/base/asynctcpsocket.cc b/base/asynctcpsocket.cc
index 65ec0f2..120bcfb 100644
--- a/base/asynctcpsocket.cc
+++ b/base/asynctcpsocket.cc
@@ -13,6 +13,7 @@
#include <string.h>
#include <algorithm>
+#include <memory>
#include "webrtc/base/byteorder.h"
#include "webrtc/base/checks.h"
@@ -44,7 +45,7 @@
rtc::AsyncSocket* socket,
const rtc::SocketAddress& bind_address,
const rtc::SocketAddress& remote_address) {
- rtc::scoped_ptr<rtc::AsyncSocket> owned_socket(socket);
+ std::unique_ptr<rtc::AsyncSocket> owned_socket(socket);
if (socket->Bind(bind_address) < 0) {
LOG(LS_ERROR) << "Bind() failed with error " << socket->GetError();
return NULL;
diff --git a/base/asynctcpsocket.h b/base/asynctcpsocket.h
index ea31493..af0410f 100644
--- a/base/asynctcpsocket.h
+++ b/base/asynctcpsocket.h
@@ -11,9 +11,10 @@
#ifndef WEBRTC_BASE_ASYNCTCPSOCKET_H_
#define WEBRTC_BASE_ASYNCTCPSOCKET_H_
+#include <memory>
+
#include "webrtc/base/asyncpacketsocket.h"
#include "webrtc/base/buffer.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/socketfactory.h"
namespace rtc {
@@ -70,7 +71,7 @@
void OnWriteEvent(AsyncSocket* socket);
void OnCloseEvent(AsyncSocket* socket, int error);
- scoped_ptr<AsyncSocket> socket_;
+ std::unique_ptr<AsyncSocket> socket_;
bool listen_;
Buffer inbuf_;
Buffer outbuf_;
diff --git a/base/asynctcpsocket_unittest.cc b/base/asynctcpsocket_unittest.cc
index b931758..592b61d 100644
--- a/base/asynctcpsocket_unittest.cc
+++ b/base/asynctcpsocket_unittest.cc
@@ -8,12 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <string>
#include "webrtc/base/asynctcpsocket.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/physicalsocketserver.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/virtualsocketserver.h"
namespace rtc {
@@ -37,10 +37,10 @@
}
protected:
- scoped_ptr<PhysicalSocketServer> pss_;
- scoped_ptr<VirtualSocketServer> vss_;
+ std::unique_ptr<PhysicalSocketServer> pss_;
+ std::unique_ptr<VirtualSocketServer> vss_;
AsyncSocket* socket_;
- scoped_ptr<AsyncTCPSocket> tcp_socket_;
+ std::unique_ptr<AsyncTCPSocket> tcp_socket_;
bool ready_to_send_;
};
diff --git a/base/asyncudpsocket.cc b/base/asyncudpsocket.cc
index 4e80733..7eb2a0e 100644
--- a/base/asyncudpsocket.cc
+++ b/base/asyncudpsocket.cc
@@ -18,7 +18,7 @@
AsyncUDPSocket* AsyncUDPSocket::Create(
AsyncSocket* socket,
const SocketAddress& bind_address) {
- scoped_ptr<AsyncSocket> owned_socket(socket);
+ std::unique_ptr<AsyncSocket> owned_socket(socket);
if (socket->Bind(bind_address) < 0) {
LOG(LS_ERROR) << "Bind() failed with error " << socket->GetError();
return NULL;
diff --git a/base/asyncudpsocket.h b/base/asyncudpsocket.h
index 4b47007..aa6a904 100644
--- a/base/asyncudpsocket.h
+++ b/base/asyncudpsocket.h
@@ -11,8 +11,9 @@
#ifndef WEBRTC_BASE_ASYNCUDPSOCKET_H_
#define WEBRTC_BASE_ASYNCUDPSOCKET_H_
+#include <memory>
+
#include "webrtc/base/asyncpacketsocket.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/socketfactory.h"
namespace rtc {
@@ -56,7 +57,7 @@
// Called when the underlying socket is ready to send.
void OnWriteEvent(AsyncSocket* socket);
- scoped_ptr<AsyncSocket> socket_;
+ std::unique_ptr<AsyncSocket> socket_;
char* buf_;
size_t size_;
};
diff --git a/base/asyncudpsocket_unittest.cc b/base/asyncudpsocket_unittest.cc
index bd65940..9922005 100644
--- a/base/asyncudpsocket_unittest.cc
+++ b/base/asyncudpsocket_unittest.cc
@@ -8,12 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <string>
#include "webrtc/base/asyncudpsocket.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/physicalsocketserver.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/virtualsocketserver.h"
namespace rtc {
@@ -37,10 +37,10 @@
}
protected:
- scoped_ptr<PhysicalSocketServer> pss_;
- scoped_ptr<VirtualSocketServer> vss_;
+ std::unique_ptr<PhysicalSocketServer> pss_;
+ std::unique_ptr<VirtualSocketServer> vss_;
AsyncSocket* socket_;
- scoped_ptr<AsyncUDPSocket> udp_socket_;
+ std::unique_ptr<AsyncUDPSocket> udp_socket_;
bool ready_to_send_;
};
diff --git a/base/criticalsection_unittest.cc b/base/criticalsection_unittest.cc
index a0e1033..d33afac 100644
--- a/base/criticalsection_unittest.cc
+++ b/base/criticalsection_unittest.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <set>
#include <vector>
@@ -17,7 +18,6 @@
#include "webrtc/base/event.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/platform_thread.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/scopedptrcollection.h"
#include "webrtc/base/thread.h"
@@ -226,8 +226,8 @@
TEST(AtomicOpsTest, SimplePtr) {
class Foo {};
Foo* volatile foo = nullptr;
- scoped_ptr<Foo> a(new Foo());
- scoped_ptr<Foo> b(new Foo());
+ std::unique_ptr<Foo> a(new Foo());
+ std::unique_ptr<Foo> b(new Foo());
// Reading the initial value should work as expected.
EXPECT_TRUE(rtc::AtomicOps::AcquireLoadPtr(&foo) == nullptr);
// Setting using compare and swap should work.
diff --git a/base/cryptstring.h b/base/cryptstring.h
index a6bae51..adaac2f 100644
--- a/base/cryptstring.h
+++ b/base/cryptstring.h
@@ -13,11 +13,11 @@
#include <string.h>
+#include <memory>
#include <string>
#include <vector>
#include "webrtc/base/linked_ptr.h"
-#include "webrtc/base/scoped_ptr.h"
namespace rtc {
@@ -42,8 +42,8 @@
};
class CryptString {
-public:
- CryptString();
+ public:
+ CryptString();
size_t GetLength() const { return impl_->GetLength(); }
void CopyTo(char * dest, bool nullterminate) const { impl_->CopyTo(dest, nullterminate); }
CryptString(const CryptString& other);
@@ -60,9 +60,9 @@
void CopyRawTo(std::vector<unsigned char> * dest) const {
return impl_->CopyRawTo(dest);
}
-
-private:
- scoped_ptr<const CryptStringImpl> impl_;
+
+ private:
+ std::unique_ptr<const CryptStringImpl> impl_;
};
diff --git a/base/dbus_unittest.cc b/base/dbus_unittest.cc
index 17752f1..38c507d 100644
--- a/base/dbus_unittest.cc
+++ b/base/dbus_unittest.cc
@@ -10,6 +10,8 @@
#ifdef HAVE_DBUS_GLIB
+#include <memory>
+
#include "webrtc/base/dbus.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/thread.h"
@@ -51,7 +53,7 @@
TEST(DBusMonitorTest, StartStopStartStop) {
DBusSigFilterTest filter;
- rtc::scoped_ptr<rtc::DBusMonitor> monitor;
+ std::unique_ptr<rtc::DBusMonitor> monitor;
monitor.reset(rtc::DBusMonitor::Create(DBUS_BUS_SYSTEM));
if (monitor) {
EXPECT_TRUE(monitor->AddFilter(&filter));
@@ -83,7 +85,7 @@
// This test is to make sure that we capture the "NameAcquired" signal.
TEST(DBusMonitorTest, ReceivedNameAcquiredSignal) {
DBusSigFilterTest filter;
- rtc::scoped_ptr<rtc::DBusMonitor> monitor;
+ std::unique_ptr<rtc::DBusMonitor> monitor;
monitor.reset(rtc::DBusMonitor::Create(DBUS_BUS_SYSTEM));
if (monitor) {
EXPECT_TRUE(monitor->AddFilter(&filter));
@@ -100,12 +102,12 @@
TEST(DBusMonitorTest, ConcurrentMonitors) {
DBusSigFilterTest filter1;
- rtc::scoped_ptr<rtc::DBusMonitor> monitor1;
+ std::unique_ptr<rtc::DBusMonitor> monitor1;
monitor1.reset(rtc::DBusMonitor::Create(DBUS_BUS_SYSTEM));
if (monitor1) {
EXPECT_TRUE(monitor1->AddFilter(&filter1));
DBusSigFilterTest filter2;
- rtc::scoped_ptr<rtc::DBusMonitor> monitor2;
+ std::unique_ptr<rtc::DBusMonitor> monitor2;
monitor2.reset(rtc::DBusMonitor::Create(DBUS_BUS_SYSTEM));
EXPECT_TRUE(monitor2->AddFilter(&filter2));
@@ -129,7 +131,7 @@
TEST(DBusMonitorTest, ConcurrentFilters) {
DBusSigFilterTest filter1;
DBusSigFilterTest filter2;
- rtc::scoped_ptr<rtc::DBusMonitor> monitor;
+ std::unique_ptr<rtc::DBusMonitor> monitor;
monitor.reset(rtc::DBusMonitor::Create(DBUS_BUS_SYSTEM));
if (monitor) {
EXPECT_TRUE(monitor->AddFilter(&filter1));
@@ -151,7 +153,7 @@
TEST(DBusMonitorTest, NoAddFilterIfRunning) {
DBusSigFilterTest filter1;
DBusSigFilterTest filter2;
- rtc::scoped_ptr<rtc::DBusMonitor> monitor;
+ std::unique_ptr<rtc::DBusMonitor> monitor;
monitor.reset(rtc::DBusMonitor::Create(DBUS_BUS_SYSTEM));
if (monitor) {
EXPECT_TRUE(monitor->AddFilter(&filter1));
@@ -170,7 +172,7 @@
TEST(DBusMonitorTest, AddFilterAfterStop) {
DBusSigFilterTest filter1;
DBusSigFilterTest filter2;
- rtc::scoped_ptr<rtc::DBusMonitor> monitor;
+ std::unique_ptr<rtc::DBusMonitor> monitor;
monitor.reset(rtc::DBusMonitor::Create(DBUS_BUS_SYSTEM));
if (monitor) {
EXPECT_TRUE(monitor->AddFilter(&filter1));
@@ -194,7 +196,7 @@
TEST(DBusMonitorTest, StopRightAfterStart) {
DBusSigFilterTest filter;
- rtc::scoped_ptr<rtc::DBusMonitor> monitor;
+ std::unique_ptr<rtc::DBusMonitor> monitor;
monitor.reset(rtc::DBusMonitor::Create(DBUS_BUS_SYSTEM));
if (monitor) {
EXPECT_TRUE(monitor->AddFilter(&filter));
diff --git a/base/diskcache.cc b/base/diskcache.cc
index a1fba6a..233d2ab 100644
--- a/base/diskcache.cc
+++ b/base/diskcache.cc
@@ -15,6 +15,8 @@
#endif
#include <algorithm>
+#include <memory>
+
#include "webrtc/base/arraysize.h"
#include "webrtc/base/common.h"
#include "webrtc/base/diskcache.h"
@@ -123,7 +125,7 @@
previous_size = entry->size;
}
- scoped_ptr<FileStream> file(new FileStream);
+ std::unique_ptr<FileStream> file(new FileStream);
if (!file->Open(filename, "wb", NULL)) {
LOG_F(LS_ERROR) << "Couldn't create cache file";
return NULL;
@@ -161,7 +163,7 @@
if (index >= entry->streams)
return NULL;
- scoped_ptr<FileStream> file(new FileStream);
+ std::unique_ptr<FileStream> file(new FileStream);
if (!file->Open(IdToFilename(id, index), "rb", NULL))
return NULL;
diff --git a/base/fakenetwork.h b/base/fakenetwork.h
index e3996e6..2dd2137 100644
--- a/base/fakenetwork.h
+++ b/base/fakenetwork.h
@@ -11,6 +11,7 @@
#ifndef WEBRTC_BASE_FAKENETWORK_H_
#define WEBRTC_BASE_FAKENETWORK_H_
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -99,9 +100,9 @@
prefix_length = kFakeIPv6NetworkPrefixLength;
}
IPAddress prefix = TruncateIP(it->first.ipaddr(), prefix_length);
- scoped_ptr<Network> net(new Network(it->first.hostname(),
- it->first.hostname(), prefix,
- prefix_length, it->second));
+ std::unique_ptr<Network> net(new Network(it->first.hostname(),
+ it->first.hostname(), prefix,
+ prefix_length, it->second));
net->set_default_local_address_provider(this);
net->AddIP(it->first.ipaddr());
networks.push_back(net.release());
diff --git a/base/fakesslidentity.h b/base/fakesslidentity.h
index 47ff86d..6640b02 100644
--- a/base/fakesslidentity.h
+++ b/base/fakesslidentity.h
@@ -12,6 +12,7 @@
#define WEBRTC_BASE_FAKESSLIDENTITY_H_
#include <algorithm>
+#include <memory>
#include <vector>
#include "webrtc/base/common.h"
@@ -68,12 +69,12 @@
digest, size);
return (*length != 0);
}
- virtual rtc::scoped_ptr<SSLCertChain> GetChain() const {
+ virtual std::unique_ptr<SSLCertChain> GetChain() const {
if (certs_.empty())
return nullptr;
std::vector<SSLCertificate*> new_certs(certs_.size());
std::transform(certs_.begin(), certs_.end(), new_certs.begin(), DupCert);
- rtc::scoped_ptr<SSLCertChain> chain(new SSLCertChain(new_certs));
+ std::unique_ptr<SSLCertChain> chain(new SSLCertChain(new_certs));
std::for_each(new_certs.begin(), new_certs.end(), DeleteCert);
return chain;
}
diff --git a/base/filerotatingstream.h b/base/filerotatingstream.h
index 9e8e35d..a8522ff 100644
--- a/base/filerotatingstream.h
+++ b/base/filerotatingstream.h
@@ -11,6 +11,7 @@
#ifndef WEBRTC_BASE_FILEROTATINGSTREAM_H_
#define WEBRTC_BASE_FILEROTATINGSTREAM_H_
+#include <memory>
#include <string>
#include <vector>
@@ -110,7 +111,7 @@
const Mode mode_;
// FileStream is used to write to the current file.
- scoped_ptr<FileStream> file_stream_;
+ std::unique_ptr<FileStream> file_stream_;
// Convenience storage for file names so we don't generate them over and over.
std::vector<std::string> file_names_;
size_t max_file_size_;
diff --git a/base/filerotatingstream_unittest.cc b/base/filerotatingstream_unittest.cc
index 09438f8..bac2a3a 100644
--- a/base/filerotatingstream_unittest.cc
+++ b/base/filerotatingstream_unittest.cc
@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/base/arraysize.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/filerotatingstream.h"
@@ -57,13 +59,13 @@
const size_t expected_length,
const std::string& dir_path,
const char* file_prefix) {
- scoped_ptr<FileRotatingStream> stream;
+ std::unique_ptr<FileRotatingStream> stream;
stream.reset(new FileRotatingStream(dir_path, file_prefix));
ASSERT_TRUE(stream->Open());
size_t read = 0;
size_t stream_size = 0;
EXPECT_TRUE(stream->GetSize(&stream_size));
- scoped_ptr<uint8_t[]> buffer(new uint8_t[expected_length]);
+ std::unique_ptr<uint8_t[]> buffer(new uint8_t[expected_length]);
EXPECT_EQ(SR_SUCCESS,
stream->ReadAll(buffer.get(), expected_length, &read, nullptr));
EXPECT_EQ(0, memcmp(expected_contents, buffer.get(), expected_length));
@@ -74,8 +76,8 @@
void VerifyFileContents(const char* expected_contents,
const size_t expected_length,
const std::string& file_path) {
- scoped_ptr<uint8_t[]> buffer(new uint8_t[expected_length]);
- scoped_ptr<FileStream> stream(Filesystem::OpenFile(file_path, "r"));
+ std::unique_ptr<uint8_t[]> buffer(new uint8_t[expected_length]);
+ std::unique_ptr<FileStream> stream(Filesystem::OpenFile(file_path, "r"));
EXPECT_TRUE(stream);
if (!stream) {
return;
@@ -88,7 +90,7 @@
EXPECT_EQ(file_size, expected_length);
}
- scoped_ptr<FileRotatingStream> stream_;
+ std::unique_ptr<FileRotatingStream> stream_;
std::string dir_path_;
};
@@ -114,7 +116,7 @@
WriteAndFlush("a", 0);
std::string logfile_path = stream_->GetFilePath(0);
- scoped_ptr<FileStream> stream(Filesystem::OpenFile(logfile_path, "r"));
+ std::unique_ptr<FileStream> stream(Filesystem::OpenFile(logfile_path, "r"));
size_t file_size = 0;
EXPECT_TRUE(stream->GetSize(&file_size));
EXPECT_EQ(0u, file_size);
@@ -215,13 +217,13 @@
void VerifyStreamRead(const char* expected_contents,
const size_t expected_length,
const std::string& dir_path) {
- scoped_ptr<CallSessionFileRotatingStream> stream(
+ std::unique_ptr<CallSessionFileRotatingStream> stream(
new CallSessionFileRotatingStream(dir_path));
ASSERT_TRUE(stream->Open());
size_t read = 0;
size_t stream_size = 0;
EXPECT_TRUE(stream->GetSize(&stream_size));
- scoped_ptr<uint8_t[]> buffer(new uint8_t[expected_length]);
+ std::unique_ptr<uint8_t[]> buffer(new uint8_t[expected_length]);
EXPECT_EQ(SR_SUCCESS,
stream->ReadAll(buffer.get(), expected_length, &read, nullptr));
EXPECT_EQ(0, memcmp(expected_contents, buffer.get(), expected_length));
@@ -229,7 +231,7 @@
EXPECT_EQ(stream_size, read);
}
- scoped_ptr<CallSessionFileRotatingStream> stream_;
+ std::unique_ptr<CallSessionFileRotatingStream> stream_;
std::string dir_path_;
};
@@ -266,7 +268,7 @@
ASSERT_TRUE(stream_->Open());
const size_t buffer_size = 1024 * 1024;
- scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
+ std::unique_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
for (int i = 0; i < 8; i++) {
memset(buffer.get(), i, buffer_size);
EXPECT_EQ(SR_SUCCESS,
@@ -275,7 +277,7 @@
stream_.reset(new CallSessionFileRotatingStream(dir_path_));
ASSERT_TRUE(stream_->Open());
- scoped_ptr<uint8_t[]> expected_buffer(new uint8_t[buffer_size]);
+ std::unique_ptr<uint8_t[]> expected_buffer(new uint8_t[buffer_size]);
int expected_vals[] = {0, 1, 2, 6, 7};
for (size_t i = 0; i < arraysize(expected_vals); ++i) {
memset(expected_buffer.get(), expected_vals[i], buffer_size);
@@ -293,7 +295,7 @@
6 * 1024 * 1024);
ASSERT_TRUE(stream_->Open());
const size_t buffer_size = 1024 * 1024;
- scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
+ std::unique_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
for (int i = 0; i < 2; i++) {
memset(buffer.get(), i, buffer_size);
EXPECT_EQ(SR_SUCCESS,
@@ -302,7 +304,7 @@
stream_.reset(new CallSessionFileRotatingStream(dir_path_));
ASSERT_TRUE(stream_->Open());
- scoped_ptr<uint8_t[]> expected_buffer(new uint8_t[buffer_size]);
+ std::unique_ptr<uint8_t[]> expected_buffer(new uint8_t[buffer_size]);
int expected_vals[] = {0, 1};
for (size_t i = 0; i < arraysize(expected_vals); ++i) {
memset(expected_buffer.get(), expected_vals[i], buffer_size);
diff --git a/base/fileutils.h b/base/fileutils.h
index bf02571..a59e97e 100644
--- a/base/fileutils.h
+++ b/base/fileutils.h
@@ -24,7 +24,6 @@
#include "webrtc/base/basictypes.h"
#include "webrtc/base/common.h"
#include "webrtc/base/platform_file.h"
-#include "webrtc/base/scoped_ptr.h"
namespace rtc {
diff --git a/base/fileutils_unittest.cc b/base/fileutils_unittest.cc
index 6e98e14..51396ca 100644
--- a/base/fileutils_unittest.cc
+++ b/base/fileutils_unittest.cc
@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/base/fileutils.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/pathutils.h"
@@ -74,7 +76,7 @@
EXPECT_FALSE(Filesystem::CreatePrivateFile(path));
// Verify that we have permission to open the file for reading and writing.
- scoped_ptr<FileStream> fs(Filesystem::OpenFile(path, "wb"));
+ std::unique_ptr<FileStream> fs(Filesystem::OpenFile(path, "wb"));
EXPECT_TRUE(fs.get() != NULL);
// Have to close the file on Windows before it will let us delete it.
fs.reset();
diff --git a/base/helpers.cc b/base/helpers.cc
index 1ad5d0e..0a39ee9 100644
--- a/base/helpers.cc
+++ b/base/helpers.cc
@@ -11,6 +11,7 @@
#include "webrtc/base/helpers.h"
#include <limits>
+#include <memory>
#if defined(FEATURE_ENABLE_SSL)
#include "webrtc/base/sslconfig.h"
@@ -28,7 +29,6 @@
#include "webrtc/base/base64.h"
#include "webrtc/base/basictypes.h"
#include "webrtc/base/logging.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/timeutils.h"
// Protect against max macro inclusion.
@@ -181,8 +181,8 @@
// This round about way of creating a global RNG is to safe-guard against
// indeterminant static initialization order.
-scoped_ptr<RandomGenerator>& GetGlobalRng() {
- RTC_DEFINE_STATIC_LOCAL(scoped_ptr<RandomGenerator>, global_rng,
+std::unique_ptr<RandomGenerator>& GetGlobalRng() {
+ RTC_DEFINE_STATIC_LOCAL(std::unique_ptr<RandomGenerator>, global_rng,
(new SecureRandomGenerator()));
return global_rng;
}
@@ -223,7 +223,7 @@
const char* table, int table_size,
std::string* str) {
str->clear();
- scoped_ptr<uint8_t[]> bytes(new uint8_t[len]);
+ std::unique_ptr<uint8_t[]> bytes(new uint8_t[len]);
if (!Rng().Generate(bytes.get(), len)) {
LOG(LS_ERROR) << "Failed to generate random string!";
return false;
@@ -250,7 +250,7 @@
// Where 'x' is a hex digit, and 'y' is 8, 9, a or b.
std::string CreateRandomUuid() {
std::string str;
- scoped_ptr<uint8_t[]> bytes(new uint8_t[31]);
+ std::unique_ptr<uint8_t[]> bytes(new uint8_t[31]);
if (!Rng().Generate(bytes.get(), 31)) {
LOG(LS_ERROR) << "Failed to generate random string!";
return str;
diff --git a/base/httpbase.cc b/base/httpbase.cc
index 81ca4cc..efdc8af 100644
--- a/base/httpbase.cc
+++ b/base/httpbase.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#if defined(WEBRTC_WIN)
#include "webrtc/base/win32.h"
@@ -271,9 +272,8 @@
// When the method returns, we restore the old document. Ideally, we would
// pass our StreamInterface* to DoReceiveLoop, but due to the callbacks
// of HttpParser, we would still need to store the pointer temporarily.
- scoped_ptr<StreamInterface>
- stream(new BlockingMemoryStream(reinterpret_cast<char*>(buffer),
- buffer_len));
+ std::unique_ptr<StreamInterface> stream(
+ new BlockingMemoryStream(reinterpret_cast<char*>(buffer), buffer_len));
// Replace the existing document with our wrapped buffer.
base_->data_->document.swap(stream);
diff --git a/base/httpclient.cc b/base/httpclient.cc
index e078334..a458590 100644
--- a/base/httpclient.cc
+++ b/base/httpclient.cc
@@ -10,6 +10,7 @@
#include <time.h>
#include <algorithm>
+#include <memory>
#include "webrtc/base/asyncsocket.h"
#include "webrtc/base/common.h"
#include "webrtc/base/diskcache.h"
@@ -17,7 +18,6 @@
#include "webrtc/base/httpcommon-inl.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/pathutils.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/socketstream.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/base/stringutils.h"
@@ -466,7 +466,8 @@
return false;
}
- scoped_ptr<StreamInterface> stream(cache_->WriteResource(id, kCacheBody));
+ std::unique_ptr<StreamInterface> stream(
+ cache_->WriteResource(id, kCacheBody));
if (!stream) {
LOG_F(LS_ERROR) << "Couldn't open body cache";
return false;
@@ -485,7 +486,8 @@
}
HttpError HttpClient::WriteCacheHeaders(const std::string& id) {
- scoped_ptr<StreamInterface> stream(cache_->WriteResource(id, kCacheHeader));
+ std::unique_ptr<StreamInterface> stream(
+ cache_->WriteResource(id, kCacheHeader));
if (!stream) {
LOG_F(LS_ERROR) << "Couldn't open header cache";
return HE_CACHE;
@@ -563,7 +565,8 @@
}
HttpError HttpClient::ReadCacheHeaders(const std::string& id, bool override) {
- scoped_ptr<StreamInterface> stream(cache_->ReadResource(id, kCacheHeader));
+ std::unique_ptr<StreamInterface> stream(
+ cache_->ReadResource(id, kCacheHeader));
if (!stream) {
return HE_CACHE;
}
@@ -586,7 +589,7 @@
HttpError error = HE_NONE;
size_t data_size;
- scoped_ptr<StreamInterface> stream(cache_->ReadResource(id, kCacheBody));
+ std::unique_ptr<StreamInterface> stream(cache_->ReadResource(id, kCacheBody));
if (!stream || !stream->GetAvailable(&data_size)) {
LOG_F(LS_ERROR) << "Unavailable cache body";
error = HE_CACHE;
@@ -599,7 +602,7 @@
&& response().document) {
// Allocate on heap to not explode the stack.
const int array_size = 1024 * 64;
- scoped_ptr<char[]> buffer(new char[array_size]);
+ std::unique_ptr<char[]> buffer(new char[array_size]);
StreamResult result = Flow(stream.get(), buffer.get(), array_size,
response().document.get());
if (SR_SUCCESS != result) {
diff --git a/base/httpclient.h b/base/httpclient.h
index e7d2c5c..0c19d2e 100644
--- a/base/httpclient.h
+++ b/base/httpclient.h
@@ -11,11 +11,12 @@
#ifndef WEBRTC_BASE_HTTPCLIENT_H__
#define WEBRTC_BASE_HTTPCLIENT_H__
+#include <memory>
+
#include "webrtc/base/common.h"
#include "webrtc/base/httpbase.h"
#include "webrtc/base/nethelpers.h"
#include "webrtc/base/proxyinfo.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/sigslot.h"
#include "webrtc/base/socketaddress.h"
#include "webrtc/base/socketpool.h"
@@ -172,7 +173,7 @@
size_t retries_, attempt_, redirects_;
RedirectAction redirect_action_;
UriForm uri_form_;
- scoped_ptr<HttpAuthContext> context_;
+ std::unique_ptr<HttpAuthContext> context_;
DiskCache* cache_;
CacheState cache_state_;
AsyncResolverInterface* resolver_;
diff --git a/base/httpcommon.h b/base/httpcommon.h
index addc1bc..3450b58 100644
--- a/base/httpcommon.h
+++ b/base/httpcommon.h
@@ -12,11 +12,11 @@
#define WEBRTC_BASE_HTTPCOMMON_H__
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "webrtc/base/basictypes.h"
#include "webrtc/base/common.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/stringutils.h"
#include "webrtc/base/stream.h"
@@ -292,7 +292,7 @@
typedef HeaderMap::iterator iterator;
HttpVersion version;
- scoped_ptr<StreamInterface> document;
+ std::unique_ptr<StreamInterface> document;
HttpData();
diff --git a/base/httpserver.h b/base/httpserver.h
index 30c8f4c..c322e81 100644
--- a/base/httpserver.h
+++ b/base/httpserver.h
@@ -12,6 +12,8 @@
#define WEBRTC_BASE_HTTPSERVER_H__
#include <map>
+#include <memory>
+
#include "webrtc/base/httpbase.h"
namespace rtc {
@@ -127,7 +129,7 @@
void OnConnectionClosed(HttpServer* server, int connection_id,
StreamInterface* stream);
- scoped_ptr<AsyncSocket> listener_;
+ std::unique_ptr<AsyncSocket> listener_;
};
//////////////////////////////////////////////////////////////////////
diff --git a/base/linux.h b/base/linux.h
index ba73b85..b69de3b 100644
--- a/base/linux.h
+++ b/base/linux.h
@@ -14,9 +14,9 @@
#if defined(WEBRTC_LINUX)
#include <string>
#include <map>
+#include <memory>
#include <vector>
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/stream.h"
namespace rtc {
@@ -51,7 +51,7 @@
virtual bool ParseLine(std::string* key, std::string* value);
private:
- scoped_ptr<StreamInterface> instream_;
+ std::unique_ptr<StreamInterface> instream_;
};
//////////////////////////////////////////////////////////////////////////////
diff --git a/base/logging.cc b/base/logging.cc
index 8f7d33c..6265668 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -42,7 +42,6 @@
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/platform_thread.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/base/stringutils.h"
#include "webrtc/base/timeutils.h"
diff --git a/base/logsinks.h b/base/logsinks.h
index eabf056..e75120e 100644
--- a/base/logsinks.h
+++ b/base/logsinks.h
@@ -11,12 +11,12 @@
#ifndef WEBRTC_BASE_FILE_ROTATING_LOG_SINK_H_
#define WEBRTC_BASE_FILE_ROTATING_LOG_SINK_H_
+#include <memory>
#include <string>
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/filerotatingstream.h"
#include "webrtc/base/logging.h"
-#include "webrtc/base/scoped_ptr.h"
namespace rtc {
@@ -46,7 +46,7 @@
explicit FileRotatingLogSink(FileRotatingStream* stream);
private:
- scoped_ptr<FileRotatingStream> stream_;
+ std::unique_ptr<FileRotatingStream> stream_;
RTC_DISALLOW_COPY_AND_ASSIGN(FileRotatingLogSink);
};
diff --git a/base/maccocoasocketserver_unittest.mm b/base/maccocoasocketserver_unittest.mm
index 5401ffb..3d9e4da 100644
--- a/base/maccocoasocketserver_unittest.mm
+++ b/base/maccocoasocketserver_unittest.mm
@@ -9,7 +9,6 @@
*/
#include "webrtc/base/gunit.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread.h"
#include "webrtc/base/maccocoasocketserver.h"
diff --git a/base/macifaddrs_converter.cc b/base/macifaddrs_converter.cc
index 0916cb5..2ad070e 100644
--- a/base/macifaddrs_converter.cc
+++ b/base/macifaddrs_converter.cc
@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include <net/if.h>
#include <sys/ioctl.h>
#include <unistd.h>
@@ -15,7 +17,6 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/ifaddrs_converter.h"
#include "webrtc/base/logging.h"
-#include "webrtc/base/scoped_ptr.h"
#if !defined(WEBRTC_IOS)
#include <net/if_media.h>
@@ -269,7 +270,7 @@
}
private:
- rtc::scoped_ptr<IPv6AttributesGetter> ip_attribute_getter_;
+ std::unique_ptr<IPv6AttributesGetter> ip_attribute_getter_;
};
} // namespace
diff --git a/base/macsocketserver_unittest.cc b/base/macsocketserver_unittest.cc
index ecb9a70..87cfe07 100644
--- a/base/macsocketserver_unittest.cc
+++ b/base/macsocketserver_unittest.cc
@@ -8,8 +8,9 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/base/gunit.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/socket_unittest.h"
#include "webrtc/base/thread.h"
#include "webrtc/base/macsocketserver.h"
@@ -98,7 +99,7 @@
virtual MacBaseSocketServer* CreateSocketServer() {
return new MacCFSocketServer();
};
- rtc::scoped_ptr<MacBaseSocketServer> server_;
+ std::unique_ptr<MacBaseSocketServer> server_;
SocketServerScope scope_;
};
diff --git a/base/macutils.cc b/base/macutils.cc
index 7b1ff47..74b4919 100644
--- a/base/macutils.cc
+++ b/base/macutils.cc
@@ -8,12 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <sstream>
#include "webrtc/base/common.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/macutils.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/stringutils.h"
namespace rtc {
@@ -26,7 +26,7 @@
}
size_t maxlen = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str16),
kCFStringEncodingUTF8) + 1;
- scoped_ptr<char[]> buffer(new char[maxlen]);
+ std::unique_ptr<char[]> buffer(new char[maxlen]);
if (!buffer || !CFStringGetCString(str16, buffer.get(), maxlen,
kCFStringEncodingUTF8)) {
return false;
diff --git a/base/messagedigest.cc b/base/messagedigest.cc
index 0c2b4a1..c08cab4 100644
--- a/base/messagedigest.cc
+++ b/base/messagedigest.cc
@@ -10,6 +10,8 @@
#include "webrtc/base/messagedigest.h"
+#include <memory>
+
#include <string.h>
#include "webrtc/base/basictypes.h"
@@ -20,7 +22,6 @@
#include "webrtc/base/md5digest.h"
#include "webrtc/base/sha1digest.h"
#endif
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/stringencode.h"
namespace rtc {
@@ -75,14 +76,14 @@
size_t ComputeDigest(const std::string& alg, const void* input, size_t in_len,
void* output, size_t out_len) {
- scoped_ptr<MessageDigest> digest(MessageDigestFactory::Create(alg));
+ std::unique_ptr<MessageDigest> digest(MessageDigestFactory::Create(alg));
return (digest) ?
ComputeDigest(digest.get(), input, in_len, output, out_len) :
0;
}
std::string ComputeDigest(MessageDigest* digest, const std::string& input) {
- scoped_ptr<char[]> output(new char[digest->Size()]);
+ std::unique_ptr<char[]> output(new char[digest->Size()]);
ComputeDigest(digest, input.data(), input.size(),
output.get(), digest->Size());
return hex_encode(output.get(), digest->Size());
@@ -90,7 +91,7 @@
bool ComputeDigest(const std::string& alg, const std::string& input,
std::string* output) {
- scoped_ptr<MessageDigest> digest(MessageDigestFactory::Create(alg));
+ std::unique_ptr<MessageDigest> digest(MessageDigestFactory::Create(alg));
if (!digest) {
return false;
}
@@ -117,7 +118,7 @@
}
// Copy the key to a block-sized buffer to simplify padding.
// If the key is longer than a block, hash it and use the result instead.
- scoped_ptr<uint8_t[]> new_key(new uint8_t[block_len]);
+ std::unique_ptr<uint8_t[]> new_key(new uint8_t[block_len]);
if (key_len > block_len) {
ComputeDigest(digest, key, key_len, new_key.get(), block_len);
memset(new_key.get() + digest->Size(), 0, block_len - digest->Size());
@@ -126,14 +127,14 @@
memset(new_key.get() + key_len, 0, block_len - key_len);
}
// Set up the padding from the key, salting appropriately for each padding.
- scoped_ptr<uint8_t[]> o_pad(new uint8_t[block_len]);
- scoped_ptr<uint8_t[]> i_pad(new uint8_t[block_len]);
+ std::unique_ptr<uint8_t[]> o_pad(new uint8_t[block_len]);
+ std::unique_ptr<uint8_t[]> i_pad(new uint8_t[block_len]);
for (size_t i = 0; i < block_len; ++i) {
o_pad[i] = 0x5c ^ new_key[i];
i_pad[i] = 0x36 ^ new_key[i];
}
// Inner hash; hash the inner padding, and then the input buffer.
- scoped_ptr<uint8_t[]> inner(new uint8_t[digest->Size()]);
+ std::unique_ptr<uint8_t[]> inner(new uint8_t[digest->Size()]);
digest->Update(i_pad.get(), block_len);
digest->Update(input, in_len);
digest->Finish(inner.get(), digest->Size());
@@ -146,7 +147,7 @@
size_t ComputeHmac(const std::string& alg, const void* key, size_t key_len,
const void* input, size_t in_len,
void* output, size_t out_len) {
- scoped_ptr<MessageDigest> digest(MessageDigestFactory::Create(alg));
+ std::unique_ptr<MessageDigest> digest(MessageDigestFactory::Create(alg));
if (!digest) {
return 0;
}
@@ -156,7 +157,7 @@
std::string ComputeHmac(MessageDigest* digest, const std::string& key,
const std::string& input) {
- scoped_ptr<char[]> output(new char[digest->Size()]);
+ std::unique_ptr<char[]> output(new char[digest->Size()]);
ComputeHmac(digest, key.data(), key.size(),
input.data(), input.size(), output.get(), digest->Size());
return hex_encode(output.get(), digest->Size());
@@ -164,7 +165,7 @@
bool ComputeHmac(const std::string& alg, const std::string& key,
const std::string& input, std::string* output) {
- scoped_ptr<MessageDigest> digest(MessageDigestFactory::Create(alg));
+ std::unique_ptr<MessageDigest> digest(MessageDigestFactory::Create(alg));
if (!digest) {
return false;
}
diff --git a/base/messagehandler.h b/base/messagehandler.h
index 90563e4..2d964df 100644
--- a/base/messagehandler.h
+++ b/base/messagehandler.h
@@ -11,6 +11,7 @@
#ifndef WEBRTC_BASE_MESSAGEHANDLER_H_
#define WEBRTC_BASE_MESSAGEHANDLER_H_
+#include <memory>
#include <utility>
#include "webrtc/base/constructormagic.h"
diff --git a/base/messagequeue.h b/base/messagequeue.h
index efc479c..d323283 100644
--- a/base/messagequeue.h
+++ b/base/messagequeue.h
@@ -15,6 +15,7 @@
#include <algorithm>
#include <list>
+#include <memory>
#include <queue>
#include <vector>
@@ -22,7 +23,6 @@
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/messagehandler.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/base/sharedexclusivelock.h"
#include "webrtc/base/sigslot.h"
@@ -89,10 +89,11 @@
class ScopedMessageData : public MessageData {
public:
explicit ScopedMessageData(T* data) : data_(data) { }
- const scoped_ptr<T>& data() const { return data_; }
- scoped_ptr<T>& data() { return data_; }
+ const std::unique_ptr<T>& data() const { return data_; }
+ std::unique_ptr<T>& data() { return data_; }
+
private:
- scoped_ptr<T> data_;
+ std::unique_ptr<T> data_;
};
// Like ScopedMessageData, but for reference counted pointers.
@@ -278,7 +279,7 @@
// The SocketServer is not owned by MessageQueue.
SocketServer* ss_ GUARDED_BY(ss_lock_);
// If a server isn't supplied in the constructor, use this one.
- scoped_ptr<SocketServer> default_ss_;
+ std::unique_ptr<SocketServer> default_ss_;
SharedExclusiveLock ss_lock_;
RTC_DISALLOW_COPY_AND_ASSIGN(MessageQueue);
diff --git a/base/multipart_unittest.cc b/base/multipart_unittest.cc
index 9db316b..627d1c6 100644
--- a/base/multipart_unittest.cc
+++ b/base/multipart_unittest.cc
@@ -8,13 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <string>
#include "webrtc/base/gunit.h"
#include "webrtc/base/helpers.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/pathutils.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/multipart.h"
namespace rtc {
@@ -61,7 +61,7 @@
EXPECT_TRUE(multipart.GetSize(&size));
EXPECT_EQ(part_size, size);
- rtc::scoped_ptr<rtc::MemoryStream> stream(
+ std::unique_ptr<rtc::MemoryStream> stream(
new rtc::MemoryStream(kTestStreamContent));
size_t stream_size = 0;
EXPECT_TRUE(stream->GetSize(&stream_size));
diff --git a/base/nat_unittest.cc b/base/nat_unittest.cc
index 8be1be9..ca72c93 100644
--- a/base/nat_unittest.cc
+++ b/base/nat_unittest.cc
@@ -9,6 +9,7 @@
*/
#include <algorithm>
+#include <memory>
#include <string>
#include "webrtc/base/gunit.h"
@@ -178,11 +179,11 @@
// The physical NAT tests require connectivity to the selected ip from the
// internal address used for the NAT. Things like firewalls can break that, so
// check to see if it's worth even trying with this ip.
- scoped_ptr<PhysicalSocketServer> pss(new PhysicalSocketServer());
- scoped_ptr<AsyncSocket> client(pss->CreateAsyncSocket(src.family(),
- SOCK_DGRAM));
- scoped_ptr<AsyncSocket> server(pss->CreateAsyncSocket(src.family(),
- SOCK_DGRAM));
+ std::unique_ptr<PhysicalSocketServer> pss(new PhysicalSocketServer());
+ std::unique_ptr<AsyncSocket> client(
+ pss->CreateAsyncSocket(src.family(), SOCK_DGRAM));
+ std::unique_ptr<AsyncSocket> server(
+ pss->CreateAsyncSocket(src.family(), SOCK_DGRAM));
if (client->Bind(SocketAddress(src.ipaddr(), 0)) != 0 ||
server->Bind(SocketAddress(dst, 0)) != 0) {
return false;
@@ -244,8 +245,8 @@
SocketAddress(ext_addr2)
};
- scoped_ptr<PhysicalSocketServer> int_pss(new PhysicalSocketServer());
- scoped_ptr<PhysicalSocketServer> ext_pss(new PhysicalSocketServer());
+ std::unique_ptr<PhysicalSocketServer> int_pss(new PhysicalSocketServer());
+ std::unique_ptr<PhysicalSocketServer> ext_pss(new PhysicalSocketServer());
TestBindings(int_pss.get(), int_addr, ext_pss.get(), ext_addrs);
TestFilters(int_pss.get(), int_addr, ext_pss.get(), ext_addrs);
@@ -274,16 +275,16 @@
IPAddress GetNextIP(int af) { return VirtualSocketServer::GetNextIP(af); }
private:
- scoped_ptr<SocketServer> ss_;
+ std::unique_ptr<SocketServer> ss_;
};
} // namespace
void TestVirtualInternal(int family) {
- scoped_ptr<TestVirtualSocketServer> int_vss(new TestVirtualSocketServer(
- new PhysicalSocketServer()));
- scoped_ptr<TestVirtualSocketServer> ext_vss(new TestVirtualSocketServer(
- new PhysicalSocketServer()));
+ std::unique_ptr<TestVirtualSocketServer> int_vss(
+ new TestVirtualSocketServer(new PhysicalSocketServer()));
+ std::unique_ptr<TestVirtualSocketServer> ext_vss(
+ new TestVirtualSocketServer(new PhysicalSocketServer()));
SocketAddress int_addr;
SocketAddress ext_addrs[4];
@@ -351,15 +352,15 @@
bool connected_;
PhysicalSocketServer* int_pss_;
PhysicalSocketServer* ext_pss_;
- rtc::scoped_ptr<TestVirtualSocketServer> int_vss_;
- rtc::scoped_ptr<TestVirtualSocketServer> ext_vss_;
- rtc::scoped_ptr<Thread> int_thread_;
- rtc::scoped_ptr<Thread> ext_thread_;
- rtc::scoped_ptr<NATServer> nat_;
- rtc::scoped_ptr<NATSocketFactory> natsf_;
- rtc::scoped_ptr<AsyncSocket> client_;
- rtc::scoped_ptr<AsyncSocket> server_;
- rtc::scoped_ptr<AsyncSocket> accepted_;
+ std::unique_ptr<TestVirtualSocketServer> int_vss_;
+ std::unique_ptr<TestVirtualSocketServer> ext_vss_;
+ std::unique_ptr<Thread> int_thread_;
+ std::unique_ptr<Thread> ext_thread_;
+ std::unique_ptr<NATServer> nat_;
+ std::unique_ptr<NATSocketFactory> natsf_;
+ std::unique_ptr<AsyncSocket> client_;
+ std::unique_ptr<AsyncSocket> server_;
+ std::unique_ptr<AsyncSocket> accepted_;
};
TEST_F(NatTcpTest, DISABLED_TestConnectOut) {
@@ -377,8 +378,8 @@
EXPECT_EQ(client_->GetRemoteAddress(), server_->GetLocalAddress());
EXPECT_EQ(accepted_->GetRemoteAddress().ipaddr(), ext_addr_.ipaddr());
- rtc::scoped_ptr<rtc::TestClient> in(CreateTCPTestClient(client_.release()));
- rtc::scoped_ptr<rtc::TestClient> out(
+ std::unique_ptr<rtc::TestClient> in(CreateTCPTestClient(client_.release()));
+ std::unique_ptr<rtc::TestClient> out(
CreateTCPTestClient(accepted_.release()));
const char* buf = "test_packet";
diff --git a/base/natserver.cc b/base/natserver.cc
index b071e01..222d270 100644
--- a/base/natserver.cc
+++ b/base/natserver.cc
@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/base/natsocketfactory.h"
#include "webrtc/base/natserver.h"
#include "webrtc/base/logging.h"
@@ -195,7 +197,7 @@
// Forward this packet to the internal address.
// First prepend the address in a quasi-STUN format.
- scoped_ptr<char[]> real_buf(new char[size + kNATEncodedIPv6AddressSize]);
+ std::unique_ptr<char[]> real_buf(new char[size + kNATEncodedIPv6AddressSize]);
size_t addrlength = PackAddressForNAT(real_buf.get(),
size + kNATEncodedIPv6AddressSize,
remote_addr);
diff --git a/base/natsocketfactory.cc b/base/natsocketfactory.cc
index 0abd2a1..985748c 100644
--- a/base/natsocketfactory.cc
+++ b/base/natsocketfactory.cc
@@ -141,7 +141,7 @@
return socket_->SendTo(data, size, addr);
}
// This array will be too large for IPv4 packets, but only by 12 bytes.
- scoped_ptr<char[]> buf(new char[size + kNATEncodedIPv6AddressSize]);
+ std::unique_ptr<char[]> buf(new char[size + kNATEncodedIPv6AddressSize]);
size_t addrlength = PackAddressForNAT(buf.get(),
size + kNATEncodedIPv6AddressSize,
addr);
diff --git a/base/natsocketfactory.h b/base/natsocketfactory.h
index 9ca0739..82c2a87 100644
--- a/base/natsocketfactory.h
+++ b/base/natsocketfactory.h
@@ -13,6 +13,7 @@
#include <string>
#include <map>
+#include <memory>
#include <set>
#include "webrtc/base/natserver.h"
@@ -116,8 +117,8 @@
private:
NATSocketServer* server_;
- scoped_ptr<SocketFactory> internal_factory_;
- scoped_ptr<NATServer> nat_server_;
+ std::unique_ptr<SocketFactory> internal_factory_;
+ std::unique_ptr<NATServer> nat_server_;
TranslatorMap nats_;
std::set<SocketAddress> clients_;
};
diff --git a/base/nethelpers.cc b/base/nethelpers.cc
index 0c7cce6..d901528 100644
--- a/base/nethelpers.cc
+++ b/base/nethelpers.cc
@@ -10,6 +10,8 @@
#include "webrtc/base/nethelpers.h"
+#include <memory>
+
#if defined(WEBRTC_WIN)
#include <ws2spi.h>
#include <ws2tcpip.h>
@@ -127,7 +129,7 @@
return false;
}
DWORD protbuff_size = 4096;
- scoped_ptr<char[]> protocols;
+ std::unique_ptr<char[]> protocols;
LPWSAPROTOCOL_INFOW protocol_infos = NULL;
int requested_protocols[2] = {AF_INET6, 0};
diff --git a/base/network.cc b/base/network.cc
index c9ad181..b6caaa8 100644
--- a/base/network.cc
+++ b/base/network.cc
@@ -32,10 +32,10 @@
#include <stdio.h>
#include <algorithm>
+#include <memory>
#include "webrtc/base/logging.h"
#include "webrtc/base/networkmonitor.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/socket.h" // includes something that makes windows happy
#include "webrtc/base/stream.h"
#include "webrtc/base/stringencode.h"
@@ -471,9 +471,9 @@
}
#endif
// TODO(phoglund): Need to recognize other types as well.
- scoped_ptr<Network> network(new Network(cursor->ifa_name,
- cursor->ifa_name, prefix,
- prefix_length, adapter_type));
+ std::unique_ptr<Network> network(
+ new Network(cursor->ifa_name, cursor->ifa_name, prefix, prefix_length,
+ adapter_type));
network->set_default_local_address_provider(this);
network->set_scope_id(scope_id);
network->AddIP(ip);
@@ -497,7 +497,7 @@
return false;
}
- rtc::scoped_ptr<IfAddrsConverter> ifaddrs_converter(CreateIfAddrsConverter());
+ std::unique_ptr<IfAddrsConverter> ifaddrs_converter(CreateIfAddrsConverter());
ConvertIfAddrs(interfaces, ifaddrs_converter.get(), include_ignored,
networks);
@@ -553,7 +553,7 @@
NetworkMap current_networks;
// MSDN recommends a 15KB buffer for the first try at GetAdaptersAddresses.
size_t buffer_size = 16384;
- scoped_ptr<char[]> adapter_info(new char[buffer_size]);
+ std::unique_ptr<char[]> adapter_info(new char[buffer_size]);
PIP_ADAPTER_ADDRESSES adapter_addrs =
reinterpret_cast<PIP_ADAPTER_ADDRESSES>(adapter_info.get());
int adapter_flags = (GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_ANYCAST |
@@ -589,7 +589,7 @@
IPAddress ip;
int scope_id = 0;
- scoped_ptr<Network> network;
+ std::unique_ptr<Network> network;
switch (address->Address.lpSockaddr->sa_family) {
case AF_INET: {
sockaddr_in* v4_addr =
@@ -628,8 +628,8 @@
// TODO(phoglund): Need to recognize other types as well.
adapter_type = ADAPTER_TYPE_LOOPBACK;
}
- scoped_ptr<Network> network(new Network(name, description, prefix,
- prefix_length, adapter_type));
+ std::unique_ptr<Network> network(new Network(
+ name, description, prefix, prefix_length, adapter_type));
network->set_default_local_address_provider(this);
network->set_scope_id(scope_id);
network->AddIP(ip);
@@ -792,7 +792,7 @@
ASSERT(thread_->socketserver() != nullptr);
ASSERT(family == AF_INET || family == AF_INET6);
- scoped_ptr<AsyncSocket> socket(
+ std::unique_ptr<AsyncSocket> socket(
thread_->socketserver()->CreateAsyncSocket(family, SOCK_DGRAM));
if (!socket) {
LOG_ERR(LERROR) << "Socket creation failed";
diff --git a/base/network.h b/base/network.h
index 7c328ff..a41da4a 100644
--- a/base/network.h
+++ b/base/network.h
@@ -13,6 +13,7 @@
#include <deque>
#include <map>
+#include <memory>
#include <string>
#include <vector>
@@ -20,7 +21,6 @@
#include "webrtc/base/ipaddress.h"
#include "webrtc/base/networkmonitor.h"
#include "webrtc/base/messagehandler.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/sigslot.h"
#if defined(WEBRTC_POSIX)
@@ -170,8 +170,8 @@
NetworkMap networks_map_;
bool ipv6_enabled_;
- rtc::scoped_ptr<rtc::Network> ipv4_any_address_network_;
- rtc::scoped_ptr<rtc::Network> ipv6_any_address_network_;
+ std::unique_ptr<rtc::Network> ipv4_any_address_network_;
+ std::unique_ptr<rtc::Network> ipv6_any_address_network_;
IPAddress default_local_ipv4_address_;
IPAddress default_local_ipv6_address_;
@@ -254,7 +254,7 @@
int start_count_;
std::vector<std::string> network_ignore_list_;
bool ignore_non_default_routes_;
- scoped_ptr<NetworkMonitorInterface> network_monitor_;
+ std::unique_ptr<NetworkMonitorInterface> network_monitor_;
};
// Represents a Unix-type network interface, with a name and single address.
diff --git a/base/network_unittest.cc b/base/network_unittest.cc
index d365477..f3193e2 100644
--- a/base/network_unittest.cc
+++ b/base/network_unittest.cc
@@ -12,6 +12,7 @@
#include "webrtc/base/nethelpers.h"
#include "webrtc/base/networkmonitor.h"
+#include <memory>
#include <vector>
#if defined(WEBRTC_POSIX)
#include <sys/types.h>
@@ -108,7 +109,7 @@
bool include_ignored,
NetworkManager::NetworkList* networks) {
// Use the base IfAddrsConverter for test cases.
- rtc::scoped_ptr<IfAddrsConverter> ifaddrs_converter(new IfAddrsConverter());
+ std::unique_ptr<IfAddrsConverter> ifaddrs_converter(new IfAddrsConverter());
network_manager.ConvertIfAddrs(interfaces, ifaddrs_converter.get(),
include_ignored, networks);
}
diff --git a/base/networkmonitor.h b/base/networkmonitor.h
index 35ab2b1..5459cd6 100644
--- a/base/networkmonitor.h
+++ b/base/networkmonitor.h
@@ -12,7 +12,6 @@
#define WEBRTC_BASE_NETWORKMONITOR_H_
#include "webrtc/base/logging.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/sigslot.h"
#include "webrtc/base/thread.h"
diff --git a/base/onetimeevent.h b/base/onetimeevent.h
index 9708b4b..240cf14 100644
--- a/base/onetimeevent.h
+++ b/base/onetimeevent.h
@@ -11,7 +11,6 @@
#ifndef WEBRTC_BASE_ONETIMEEVENT_H_
#define WEBRTC_BASE_ONETIMEEVENT_H_
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/typedefs.h"
diff --git a/base/opensslidentity.cc b/base/opensslidentity.cc
index 9c2112e..ec9c007 100644
--- a/base/opensslidentity.cc
+++ b/base/opensslidentity.cc
@@ -12,6 +12,8 @@
#include "webrtc/base/opensslidentity.h"
+#include <memory>
+
// Must be included first before openssl headers.
#include "webrtc/base/win32.h" // NOLINT
@@ -280,7 +282,7 @@
return true;
}
-rtc::scoped_ptr<SSLCertChain> OpenSSLCertificate::GetChain() const {
+std::unique_ptr<SSLCertChain> OpenSSLCertificate::GetChain() const {
// Chains are not yet supported when using OpenSSL.
// OpenSSLStreamAdapter::SSLVerifyCallback currently requires the remote
// certificate to be self-signed.
@@ -430,7 +432,7 @@
SSLIdentity* OpenSSLIdentity::FromPEMStrings(
const std::string& private_key,
const std::string& certificate) {
- scoped_ptr<OpenSSLCertificate> cert(
+ std::unique_ptr<OpenSSLCertificate> cert(
OpenSSLCertificate::FromPEMString(certificate));
if (!cert) {
LOG(LS_ERROR) << "Failed to create OpenSSLCertificate from PEM string.";
diff --git a/base/opensslidentity.h b/base/opensslidentity.h
index df49508..332da18 100644
--- a/base/opensslidentity.h
+++ b/base/opensslidentity.h
@@ -14,10 +14,10 @@
#include <openssl/evp.h>
#include <openssl/x509.h>
+#include <memory>
#include <string>
#include "webrtc/base/common.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/sslidentity.h"
typedef struct ssl_ctx_st SSL_CTX;
@@ -85,7 +85,7 @@
size_t* length);
bool GetSignatureDigestAlgorithm(std::string* algorithm) const override;
- rtc::scoped_ptr<SSLCertChain> GetChain() const override;
+ std::unique_ptr<SSLCertChain> GetChain() const override;
int64_t CertificateExpirationTime() const override;
@@ -120,8 +120,8 @@
static OpenSSLIdentity* GenerateInternal(const SSLIdentityParams& params);
- scoped_ptr<OpenSSLKeyPair> key_pair_;
- scoped_ptr<OpenSSLCertificate> certificate_;
+ std::unique_ptr<OpenSSLKeyPair> key_pair_;
+ std::unique_ptr<OpenSSLCertificate> certificate_;
RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLIdentity);
};
diff --git a/base/opensslstreamadapter.cc b/base/opensslstreamadapter.cc
index b09c2a5..abdf5e4 100644
--- a/base/opensslstreamadapter.cc
+++ b/base/opensslstreamadapter.cc
@@ -22,6 +22,7 @@
#include <openssl/dtls1.h>
#endif
+#include <memory>
#include <vector>
#include "webrtc/base/common.h"
@@ -293,9 +294,9 @@
role_ = role;
}
-rtc::scoped_ptr<SSLCertificate> OpenSSLStreamAdapter::GetPeerCertificate()
+std::unique_ptr<SSLCertificate> OpenSSLStreamAdapter::GetPeerCertificate()
const {
- return peer_certificate_ ? rtc::scoped_ptr<SSLCertificate>(
+ return peer_certificate_ ? std::unique_ptr<SSLCertificate>(
peer_certificate_->GetReference())
: nullptr;
}
diff --git a/base/opensslstreamadapter.h b/base/opensslstreamadapter.h
index 463c8f2..1e90bac 100644
--- a/base/opensslstreamadapter.h
+++ b/base/opensslstreamadapter.h
@@ -12,6 +12,7 @@
#define WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__
#include <string>
+#include <memory>
#include <vector>
#include "webrtc/base/buffer.h"
@@ -69,7 +70,7 @@
const unsigned char* digest_val,
size_t digest_len) override;
- rtc::scoped_ptr<SSLCertificate> GetPeerCertificate() const override;
+ std::unique_ptr<SSLCertificate> GetPeerCertificate() const override;
int StartSSLWithServer(const char* server_name) override;
int StartSSLWithPeer() override;
@@ -184,13 +185,13 @@
SSL_CTX* ssl_ctx_;
// Our key and certificate, mostly useful in peer-to-peer mode.
- scoped_ptr<OpenSSLIdentity> identity_;
+ std::unique_ptr<OpenSSLIdentity> identity_;
// in traditional mode, the server name that the server's certificate
// must specify. Empty in peer-to-peer mode.
std::string ssl_server_name_;
// The certificate that the peer must present or did present. Initially
// null in traditional mode, until the connection is established.
- scoped_ptr<OpenSSLCertificate> peer_certificate_;
+ std::unique_ptr<OpenSSLCertificate> peer_certificate_;
// In peer-to-peer mode, the digest of the certificate that
// the peer must present.
Buffer peer_certificate_digest_value_;
diff --git a/base/optional_unittest.cc b/base/optional_unittest.cc
index 8ddbeba..af82b92 100644
--- a/base/optional_unittest.cc
+++ b/base/optional_unittest.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <sstream>
#include <string>
#include <utility>
@@ -64,8 +65,8 @@
}
void Foo() { Log("Foo()"); }
void Foo() const { Log("Foo() const"); }
- static rtc::scoped_ptr<std::vector<std::string>> Setup() {
- rtc::scoped_ptr<std::vector<std::string>> s(new std::vector<std::string>);
+ static std::unique_ptr<std::vector<std::string>> Setup() {
+ std::unique_ptr<std::vector<std::string>> s(new std::vector<std::string>);
g_log = s.get();
g_next_id = 0;
return s;
diff --git a/base/optionsfile_unittest.cc b/base/optionsfile_unittest.cc
index bcfb3ef..f22a2f1 100644
--- a/base/optionsfile_unittest.cc
+++ b/base/optionsfile_unittest.cc
@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/base/fileutils.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/optionsfile.h"
@@ -51,7 +53,7 @@
store_.reset(new OptionsFile(test_file_));
}
- rtc::scoped_ptr<OptionsFile> store_;
+ std::unique_ptr<OptionsFile> store_;
private:
std::string test_file_;
diff --git a/base/physicalsocketserver.h b/base/physicalsocketserver.h
index 583306c..f5867d2 100644
--- a/base/physicalsocketserver.h
+++ b/base/physicalsocketserver.h
@@ -11,11 +11,11 @@
#ifndef WEBRTC_BASE_PHYSICALSOCKETSERVER_H__
#define WEBRTC_BASE_PHYSICALSOCKETSERVER_H__
+#include <memory>
#include <vector>
#include "webrtc/base/asyncfile.h"
#include "webrtc/base/nethelpers.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/socketserver.h"
#include "webrtc/base/criticalsection.h"
@@ -104,7 +104,7 @@
#if defined(WEBRTC_POSIX)
static bool InstallSignal(int signum, void (*handler)(int));
- scoped_ptr<PosixSignalDispatcher> signal_dispatcher_;
+ std::unique_ptr<PosixSignalDispatcher> signal_dispatcher_;
#endif
DispatcherList dispatchers_;
IteratorList iterators_;
diff --git a/base/physicalsocketserver_unittest.cc b/base/physicalsocketserver_unittest.cc
index c53441d..a04362d 100644
--- a/base/physicalsocketserver_unittest.cc
+++ b/base/physicalsocketserver_unittest.cc
@@ -8,13 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <signal.h>
#include <stdarg.h>
#include "webrtc/base/gunit.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/physicalsocketserver.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/socket_unittest.h"
#include "webrtc/base/testutils.h"
#include "webrtc/base/thread.h"
@@ -100,7 +100,7 @@
void ConnectInternalAcceptError(const IPAddress& loopback);
void WritableAfterPartialWrite(const IPAddress& loopback);
- rtc::scoped_ptr<FakePhysicalSocketServer> server_;
+ std::unique_ptr<FakePhysicalSocketServer> server_;
SocketServerScope scope_;
bool fail_accept_;
int max_send_size_;
@@ -172,20 +172,20 @@
SocketAddress accept_addr;
// Create two clients.
- scoped_ptr<AsyncSocket> client1(server_->CreateAsyncSocket(loopback.family(),
- SOCK_STREAM));
+ std::unique_ptr<AsyncSocket> client1(
+ server_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(client1.get());
EXPECT_EQ(AsyncSocket::CS_CLOSED, client1->GetState());
EXPECT_PRED1(IsUnspecOrEmptyIP, client1->GetLocalAddress().ipaddr());
- scoped_ptr<AsyncSocket> client2(server_->CreateAsyncSocket(loopback.family(),
- SOCK_STREAM));
+ std::unique_ptr<AsyncSocket> client2(
+ server_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(client2.get());
EXPECT_EQ(AsyncSocket::CS_CLOSED, client2->GetState());
EXPECT_PRED1(IsUnspecOrEmptyIP, client2->GetLocalAddress().ipaddr());
// Create server and listen.
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
server_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(server.get());
EXPECT_EQ(0, server->Bind(SocketAddress(loopback, 0)));
@@ -211,7 +211,7 @@
EXPECT_TRUE_WAIT((sink.Check(server.get(), testing::SSE_READ)), kTimeout);
// Simulate "::accept" returning an error.
SetFailAccept(true);
- scoped_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
+ std::unique_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
EXPECT_FALSE(accepted);
ASSERT_TRUE(accept_addr.IsNil());
@@ -233,7 +233,7 @@
// Server has pending connection, try to accept it (will succeed).
EXPECT_TRUE_WAIT((sink.Check(server.get(), testing::SSE_READ)), kTimeout);
SetFailAccept(false);
- scoped_ptr<AsyncSocket> accepted2(server->Accept(&accept_addr));
+ std::unique_ptr<AsyncSocket> accepted2(server->Accept(&accept_addr));
ASSERT_TRUE(accepted2);
EXPECT_FALSE(accept_addr.IsNil());
EXPECT_EQ(accepted2->GetRemoteAddress(), accept_addr);
@@ -515,7 +515,7 @@
static std::vector<int> signals_received_;
static Thread *signaled_thread_;
- scoped_ptr<PhysicalSocketServer> ss_;
+ std::unique_ptr<PhysicalSocketServer> ss_;
};
std::vector<int> PosixSignalDeliveryTest::signals_received_;
@@ -583,8 +583,8 @@
// Start a new thread that raises it. It will have to be delivered to that
// thread. Our implementation should safely handle it and dispatch
// RecordSignal() on this thread.
- scoped_ptr<Thread> thread(new Thread());
- scoped_ptr<RaiseSigTermRunnable> runnable(new RaiseSigTermRunnable());
+ std::unique_ptr<Thread> thread(new Thread());
+ std::unique_ptr<RaiseSigTermRunnable> runnable(new RaiseSigTermRunnable());
thread->Start(runnable.get());
EXPECT_TRUE(ss_->Wait(1500, true));
EXPECT_TRUE(ExpectSignal(SIGTERM));
diff --git a/base/platform_thread.h b/base/platform_thread.h
index 8c2161b..d74aec2 100644
--- a/base/platform_thread.h
+++ b/base/platform_thread.h
@@ -16,7 +16,6 @@
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/event.h"
#include "webrtc/base/platform_thread_types.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread_checker.h"
namespace rtc {
diff --git a/base/platform_thread_unittest.cc b/base/platform_thread_unittest.cc
index d06a738..847946a 100644
--- a/base/platform_thread_unittest.cc
+++ b/base/platform_thread_unittest.cc
@@ -11,7 +11,6 @@
#include "webrtc/base/platform_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/system_wrappers/include/sleep.h"
namespace rtc {
diff --git a/base/proxy_unittest.cc b/base/proxy_unittest.cc
index d8a523f..4dba0dd 100644
--- a/base/proxy_unittest.cc
+++ b/base/proxy_unittest.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <string>
#include "webrtc/base/autodetectproxy.h"
#include "webrtc/base/gunit.h"
@@ -67,10 +68,10 @@
}
private:
- rtc::scoped_ptr<rtc::SocketServer> ss_;
- rtc::scoped_ptr<rtc::SocksProxyServer> socks_;
+ std::unique_ptr<rtc::SocketServer> ss_;
+ std::unique_ptr<rtc::SocksProxyServer> socks_;
// TODO: Make this a real HTTPS proxy server.
- rtc::scoped_ptr<rtc::HttpListenServer> https_;
+ std::unique_ptr<rtc::HttpListenServer> https_;
};
// Tests whether we can use a SOCKS5 proxy to connect to a server.
diff --git a/base/proxydetect.cc b/base/proxydetect.cc
index abb8f0a..10e7a02 100644
--- a/base/proxydetect.cc
+++ b/base/proxydetect.cc
@@ -29,6 +29,7 @@
#endif
#include <map>
+#include <memory>
#include "webrtc/base/arraysize.h"
#include "webrtc/base/fileutils.h"
@@ -430,7 +431,7 @@
// Note: we are looking for the first entry with "Default=1", or the last
// entry in the file
path.SetFilename("profiles.ini");
- scoped_ptr<FileStream> fs(Filesystem::OpenFile(path, "r"));
+ std::unique_ptr<FileStream> fs(Filesystem::OpenFile(path, "r"));
if (!fs) {
return false;
}
@@ -495,7 +496,7 @@
bool ReadFirefoxPrefs(const Pathname& filename,
const char * prefix,
StringMap* settings) {
- scoped_ptr<FileStream> fs(Filesystem::OpenFile(filename, "r"));
+ std::unique_ptr<FileStream> fs(Filesystem::OpenFile(filename, "r"));
if (!fs) {
LOG(LS_ERROR) << "Failed to open file: " << filename.pathname();
return false;
diff --git a/base/proxyserver.h b/base/proxyserver.h
index adb26ae..5dfa37c 100644
--- a/base/proxyserver.h
+++ b/base/proxyserver.h
@@ -12,6 +12,7 @@
#define WEBRTC_BASE_PROXYSERVER_H_
#include <list>
+#include <memory>
#include "webrtc/base/asyncsocket.h"
#include "webrtc/base/socketadapters.h"
#include "webrtc/base/socketaddress.h"
@@ -50,8 +51,8 @@
void Destroy();
static const int kBufferSize = 4096;
- scoped_ptr<AsyncProxyServerSocket> int_socket_;
- scoped_ptr<AsyncSocket> ext_socket_;
+ std::unique_ptr<AsyncProxyServerSocket> int_socket_;
+ std::unique_ptr<AsyncSocket> ext_socket_;
bool connected_;
FifoBuffer out_buffer_;
FifoBuffer in_buffer_;
@@ -76,7 +77,7 @@
typedef std::list<ProxyBinding*> BindingList;
SocketFactory* ext_factory_;
SocketAddress ext_ip_;
- scoped_ptr<AsyncSocket> server_socket_;
+ std::unique_ptr<AsyncSocket> server_socket_;
BindingList bindings_;
RTC_DISALLOW_COPY_AND_ASSIGN(ProxyServer);
};
diff --git a/base/rate_statistics.h b/base/rate_statistics.h
index 21f6ce6..aea8d79 100644
--- a/base/rate_statistics.h
+++ b/base/rate_statistics.h
@@ -11,7 +11,8 @@
#ifndef WEBRTC_BASE_RATE_STATISTICS_H_
#define WEBRTC_BASE_RATE_STATISTICS_H_
-#include "webrtc/base/scoped_ptr.h"
+#include <memory>
+
#include "webrtc/typedefs.h"
namespace webrtc {
@@ -34,7 +35,7 @@
// Counters are kept in buckets (circular buffer), with one bucket
// per millisecond.
const int num_buckets_;
- rtc::scoped_ptr<size_t[]> buckets_;
+ std::unique_ptr<size_t[]> buckets_;
// Total count recorded in buckets.
size_t accumulated_count_;
diff --git a/base/referencecountedsingletonfactory.h b/base/referencecountedsingletonfactory.h
index f955986..1a41695 100644
--- a/base/referencecountedsingletonfactory.h
+++ b/base/referencecountedsingletonfactory.h
@@ -11,10 +11,11 @@
#ifndef WEBRTC_BASE_REFERENCECOUNTEDSINGLETONFACTORY_H_
#define WEBRTC_BASE_REFERENCECOUNTEDSINGLETONFACTORY_H_
+#include <memory>
+
#include "webrtc/base/common.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/logging.h"
-#include "webrtc/base/scoped_ptr.h"
namespace rtc {
@@ -41,11 +42,11 @@
protected:
// Must be implemented in a sub-class. The sub-class may choose whether or not
// to cache the instance across lifetimes by either reset()'ing or not
- // reset()'ing the scoped_ptr in CleanupInstance().
+ // reset()'ing the unique_ptr in CleanupInstance().
virtual bool SetupInstance() = 0;
virtual void CleanupInstance() = 0;
- scoped_ptr<Interface> instance_;
+ std::unique_ptr<Interface> instance_;
private:
Interface* GetInstance() {
diff --git a/base/rtccertificate.cc b/base/rtccertificate.cc
index 7b764bd..70959ee 100644
--- a/base/rtccertificate.cc
+++ b/base/rtccertificate.cc
@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/base/rtccertificate.h"
#include "webrtc/base/checks.h"
@@ -15,7 +17,7 @@
namespace rtc {
scoped_refptr<RTCCertificate> RTCCertificate::Create(
- scoped_ptr<SSLIdentity> identity) {
+ std::unique_ptr<SSLIdentity> identity) {
return new RefCountedObject<RTCCertificate>(identity.release());
}
diff --git a/base/rtccertificate.h b/base/rtccertificate.h
index 600739b..3d4f36e 100644
--- a/base/rtccertificate.h
+++ b/base/rtccertificate.h
@@ -11,9 +11,10 @@
#ifndef WEBRTC_BASE_RTCCERTIFICATE_H_
#define WEBRTC_BASE_RTCCERTIFICATE_H_
+#include <memory>
+
#include "webrtc/base/basictypes.h"
#include "webrtc/base/refcount.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/base/sslidentity.h"
@@ -25,7 +26,8 @@
class RTCCertificate : public RefCountInterface {
public:
// Takes ownership of |identity|.
- static scoped_refptr<RTCCertificate> Create(scoped_ptr<SSLIdentity> identity);
+ static scoped_refptr<RTCCertificate> Create(
+ std::unique_ptr<SSLIdentity> identity);
// Returns the expiration time in ms relative to epoch, 1970-01-01T00:00:00Z.
uint64_t Expires() const;
@@ -47,7 +49,7 @@
private:
// The SSLIdentity is the owner of the SSLCertificate. To protect our
// ssl_certificate() we take ownership of |identity_|.
- scoped_ptr<SSLIdentity> identity_;
+ std::unique_ptr<SSLIdentity> identity_;
};
} // namespace rtc
diff --git a/base/rtccertificate_unittests.cc b/base/rtccertificate_unittests.cc
index 84c8544..7795fe7 100644
--- a/base/rtccertificate_unittests.cc
+++ b/base/rtccertificate_unittests.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <utility>
#include "webrtc/base/checks.h"
@@ -16,7 +17,6 @@
#include "webrtc/base/logging.h"
#include "webrtc/base/rtccertificate.h"
#include "webrtc/base/safe_conversions.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/sslidentity.h"
#include "webrtc/base/thread.h"
#include "webrtc/base/timeutils.h"
@@ -77,7 +77,7 @@
// is fast to generate.
params.key_params = KeyParams::ECDSA();
- scoped_ptr<SSLIdentity> identity(SSLIdentity::GenerateForTest(params));
+ std::unique_ptr<SSLIdentity> identity(SSLIdentity::GenerateForTest(params));
return RTCCertificate::Create(std::move(identity));
}
};
@@ -85,7 +85,7 @@
TEST_F(RTCCertificateTest, NewCertificateNotExpired) {
// Generate a real certificate without specifying the expiration time.
// Certificate type doesn't matter, using ECDSA because it's fast to generate.
- scoped_ptr<SSLIdentity> identity(
+ std::unique_ptr<SSLIdentity> identity(
SSLIdentity::Generate(kTestCertCommonName, KeyParams::ECDSA()));
scoped_refptr<RTCCertificate> certificate =
RTCCertificate::Create(std::move(identity));
diff --git a/base/rtccertificategenerator.cc b/base/rtccertificategenerator.cc
index d4572b0..f0d72e7 100644
--- a/base/rtccertificategenerator.cc
+++ b/base/rtccertificategenerator.cc
@@ -11,6 +11,7 @@
#include "webrtc/base/rtccertificategenerator.h"
#include <algorithm>
+#include <memory>
#include "webrtc/base/checks.h"
#include "webrtc/base/sslidentity.h"
@@ -124,7 +125,7 @@
}
if (!identity)
return nullptr;
- scoped_ptr<SSLIdentity> identity_sptr(identity);
+ std::unique_ptr<SSLIdentity> identity_sptr(identity);
return RTCCertificate::Create(std::move(identity_sptr));
}
diff --git a/base/rtccertificategenerator_unittest.cc b/base/rtccertificategenerator_unittest.cc
index 162a2d5..750839c 100644
--- a/base/rtccertificategenerator_unittest.cc
+++ b/base/rtccertificategenerator_unittest.cc
@@ -10,11 +10,12 @@
#include "webrtc/base/rtccertificategenerator.h"
+#include <memory>
+
#include "webrtc/base/checks.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/optional.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread.h"
namespace rtc {
@@ -59,8 +60,8 @@
protected:
Thread* const signaling_thread_;
- scoped_ptr<Thread> worker_thread_;
- scoped_ptr<RTCCertificateGenerator> generator_;
+ std::unique_ptr<Thread> worker_thread_;
+ std::unique_ptr<RTCCertificateGenerator> generator_;
scoped_refptr<RTCCertificate> certificate_;
bool generate_async_completed_;
};
diff --git a/base/scopedptrcollection_unittest.cc b/base/scopedptrcollection_unittest.cc
index 933173e..267b110 100644
--- a/base/scopedptrcollection_unittest.cc
+++ b/base/scopedptrcollection_unittest.cc
@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/base/scopedptrcollection.h"
#include "webrtc/base/gunit.h"
@@ -41,7 +43,7 @@
}
int num_instances_;
- scoped_ptr<ScopedPtrCollection<InstanceCounter> > collection_;
+ std::unique_ptr<ScopedPtrCollection<InstanceCounter> > collection_;
};
TEST_F(ScopedPtrCollectionTest, PushBack) {
diff --git a/base/sharedexclusivelock_unittest.cc b/base/sharedexclusivelock_unittest.cc
index 9b64ed7..bf75b31 100644
--- a/base/sharedexclusivelock_unittest.cc
+++ b/base/sharedexclusivelock_unittest.cc
@@ -8,11 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/base/common.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/messagehandler.h"
#include "webrtc/base/messagequeue.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/sharedexclusivelock.h"
#include "webrtc/base/thread.h"
#include "webrtc/base/timeutils.h"
@@ -42,7 +43,7 @@
int waiting_time_in_ms() const { return waiting_time_in_ms_; }
protected:
- scoped_ptr<Thread> worker_thread_;
+ std::unique_ptr<Thread> worker_thread_;
SharedExclusiveLock* shared_exclusive_lock_;
int waiting_time_in_ms_;
int* value_;
@@ -127,7 +128,7 @@
}
protected:
- scoped_ptr<SharedExclusiveLock> shared_exclusive_lock_;
+ std::unique_ptr<SharedExclusiveLock> shared_exclusive_lock_;
int value_;
};
diff --git a/base/signalthread_unittest.cc b/base/signalthread_unittest.cc
index a583aef..22d65b6 100644
--- a/base/signalthread_unittest.cc
+++ b/base/signalthread_unittest.cc
@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/base/gunit.h"
#include "webrtc/base/signalthread.h"
#include "webrtc/base/thread.h"
@@ -135,7 +137,7 @@
// when shutting down the process.
TEST_F(SignalThreadTest, OwnerThreadGoesAway) {
{
- scoped_ptr<OwnerThread> owner(new OwnerThread(this));
+ std::unique_ptr<OwnerThread> owner(new OwnerThread(this));
main_thread_ = owner.get();
owner->Start();
while (!owner->has_run()) {
diff --git a/base/socket_unittest.cc b/base/socket_unittest.cc
index d1369e2..5f6de42 100644
--- a/base/socket_unittest.cc
+++ b/base/socket_unittest.cc
@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/base/socket_unittest.h"
#include "webrtc/base/arraysize.h"
@@ -198,14 +200,14 @@
SocketAddress accept_addr;
// Create client.
- scoped_ptr<AsyncSocket> client(ss_->CreateAsyncSocket(loopback.family(),
- SOCK_STREAM));
+ std::unique_ptr<AsyncSocket> client(
+ ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(client.get());
EXPECT_EQ(AsyncSocket::CS_CLOSED, client->GetState());
EXPECT_PRED1(IsUnspecOrEmptyIP, client->GetLocalAddress().ipaddr());
// Create server and listen.
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(server.get());
EXPECT_EQ(0, server->Bind(SocketAddress(loopback, 0)));
@@ -229,7 +231,7 @@
// Server has pending connection, accept it.
EXPECT_TRUE_WAIT((sink.Check(server.get(), testing::SSE_READ)), kTimeout);
- scoped_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
+ std::unique_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
ASSERT_TRUE(accepted);
EXPECT_FALSE(accept_addr.IsNil());
EXPECT_EQ(accepted->GetRemoteAddress(), accept_addr);
@@ -253,12 +255,12 @@
SocketAddress accept_addr;
// Create client.
- scoped_ptr<AsyncSocket> client(
+ std::unique_ptr<AsyncSocket> client(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(client.get());
// Create server and listen.
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(server.get());
EXPECT_EQ(0, server->Bind(SocketAddress(loopback, 0)));
@@ -278,7 +280,7 @@
// Server has pending connection, accept it.
EXPECT_TRUE_WAIT((sink.Check(server.get(), testing::SSE_READ)), kTimeout);
- scoped_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
+ std::unique_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
ASSERT_TRUE(accepted);
EXPECT_FALSE(accept_addr.IsNil());
EXPECT_EQ(accepted->GetRemoteAddress(), accept_addr);
@@ -301,12 +303,12 @@
SocketAddress accept_addr;
// Create client.
- scoped_ptr<AsyncSocket> client(
+ std::unique_ptr<AsyncSocket> client(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(client.get());
// Create server, but don't listen yet.
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(server.get());
EXPECT_EQ(0, server->Bind(SocketAddress(loopback, 0)));
@@ -334,12 +336,12 @@
SocketAddress accept_addr;
// Create client.
- scoped_ptr<AsyncSocket> client(
+ std::unique_ptr<AsyncSocket> client(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(client.get());
// Create server, but don't listen yet.
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(server.get());
EXPECT_EQ(0, server->Bind(SocketAddress(loopback, 0)));
@@ -372,13 +374,13 @@
void SocketTest::ConnectWithClosedSocketInternal(const IPAddress& loopback) {
// Create server and listen.
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
EXPECT_EQ(0, server->Bind(SocketAddress(loopback, 0)));
EXPECT_EQ(0, server->Listen(5));
// Create a client and put in to CS_CLOSED state.
- scoped_ptr<AsyncSocket> client(
+ std::unique_ptr<AsyncSocket> client(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
EXPECT_EQ(0, client->Close());
EXPECT_EQ(AsyncSocket::CS_CLOSED, client->GetState());
@@ -391,13 +393,13 @@
void SocketTest::ConnectWhileNotClosedInternal(const IPAddress& loopback) {
// Create server and listen.
testing::StreamSink sink;
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(server.get());
EXPECT_EQ(0, server->Bind(SocketAddress(loopback, 0)));
EXPECT_EQ(0, server->Listen(5));
// Create client, connect.
- scoped_ptr<AsyncSocket> client(
+ std::unique_ptr<AsyncSocket> client(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
EXPECT_EQ(0, client->Connect(SocketAddress(server->GetLocalAddress())));
EXPECT_EQ(AsyncSocket::CS_CONNECTING, client->GetState());
@@ -408,7 +410,7 @@
// Accept the original connection.
SocketAddress accept_addr;
EXPECT_TRUE_WAIT((sink.Check(server.get(), testing::SSE_READ)), kTimeout);
- scoped_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
+ std::unique_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
ASSERT_TRUE(accepted);
EXPECT_FALSE(accept_addr.IsNil());
@@ -435,12 +437,12 @@
testing::StreamSink sink;
// Create client.
- scoped_ptr<AsyncSocket> client(
+ std::unique_ptr<AsyncSocket> client(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(client.get());
// Create server and listen.
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(server.get());
EXPECT_EQ(0, server->Bind(SocketAddress(loopback, 0)));
@@ -464,12 +466,12 @@
SocketAddress accept_addr;
// Create client.
- scoped_ptr<AsyncSocket> client(
+ std::unique_ptr<AsyncSocket> client(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(client.get());
// Create server and listen.
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(server.get());
EXPECT_EQ(0, server->Bind(SocketAddress(loopback, 0)));
@@ -483,7 +485,7 @@
client->Close();
// The connection should still be able to be accepted.
- scoped_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
+ std::unique_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
ASSERT_TRUE(accepted);
sink.Monitor(accepted.get());
EXPECT_EQ(AsyncSocket::CS_CONNECTED, accepted->GetState());
@@ -502,12 +504,12 @@
SocketAddress accept_addr;
// Create client.
- scoped_ptr<AsyncSocket> client(
+ std::unique_ptr<AsyncSocket> client(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(client.get());
// Create server and listen.
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(server.get());
EXPECT_EQ(0, server->Bind(SocketAddress(loopback, 0)));
@@ -518,7 +520,7 @@
// Accept connection.
EXPECT_TRUE_WAIT((sink.Check(server.get(), testing::SSE_READ)), kTimeout);
- scoped_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
+ std::unique_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
ASSERT_TRUE(accepted);
sink.Monitor(accepted.get());
@@ -576,13 +578,13 @@
SocketAddress accept_addr;
// Create client.
- scoped_ptr<AsyncSocket> client(
+ std::unique_ptr<AsyncSocket> client(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(client.get());
client->SignalCloseEvent.connect(&closer, &SocketCloser::OnClose);
// Create server and listen.
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(server.get());
EXPECT_EQ(0, server->Bind(SocketAddress(loopback, 0)));
@@ -593,7 +595,7 @@
// Accept connection.
EXPECT_TRUE_WAIT((sink.Check(server.get(), testing::SSE_READ)), kTimeout);
- scoped_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
+ std::unique_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
ASSERT_TRUE(accepted);
sink.Monitor(accepted.get());
@@ -630,9 +632,9 @@
SocketAddress accept_addr;
// Create & connect server and client sockets.
- scoped_ptr<AsyncSocket> client(
+ std::unique_ptr<AsyncSocket> client(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(client.get());
sink.Monitor(server.get());
@@ -642,7 +644,7 @@
EXPECT_EQ(0, client->Connect(server->GetLocalAddress()));
EXPECT_TRUE_WAIT((sink.Check(server.get(), testing::SSE_READ)), kTimeout);
- scoped_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
+ std::unique_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
ASSERT_TRUE(accepted);
sink.Monitor(accepted.get());
EXPECT_EQ(AsyncSocket::CS_CONNECTED, accepted->GetState());
@@ -663,7 +665,7 @@
EXPECT_FALSE(sink.Check(accepted.get(), testing::SSE_READ));
// Shouldn't signal when blocked in a thread Send, where process_io is false.
- scoped_ptr<Thread> thread(new Thread());
+ std::unique_ptr<Thread> thread(new Thread());
thread->Start();
Sleeper sleeper;
TypedMessageData<AsyncSocket*> data(client.get());
@@ -681,12 +683,12 @@
SocketAddress accept_addr;
// Create receiving client.
- scoped_ptr<AsyncSocket> receiver(
+ std::unique_ptr<AsyncSocket> receiver(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(receiver.get());
// Create server and listen.
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(server.get());
EXPECT_EQ(0, server->Bind(SocketAddress(loopback, 0)));
@@ -697,7 +699,7 @@
// Accept connection which will be used for sending.
EXPECT_TRUE_WAIT((sink.Check(server.get(), testing::SSE_READ)), kTimeout);
- scoped_ptr<AsyncSocket> sender(server->Accept(&accept_addr));
+ std::unique_ptr<AsyncSocket> sender(server->Accept(&accept_addr));
ASSERT_TRUE(sender);
sink.Monitor(sender.get());
@@ -809,12 +811,12 @@
SocketAddress accept_addr;
// Create client.
- scoped_ptr<AsyncSocket> client(
+ std::unique_ptr<AsyncSocket> client(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(client.get());
// Create server and listen.
- scoped_ptr<AsyncSocket> server(
+ std::unique_ptr<AsyncSocket> server(
ss_->CreateAsyncSocket(loopback.family(), SOCK_STREAM));
sink.Monitor(server.get());
EXPECT_EQ(0, server->Bind(SocketAddress(loopback, 0)));
@@ -825,7 +827,7 @@
// Accept connection.
EXPECT_TRUE_WAIT((sink.Check(server.get(), testing::SSE_READ)), kTimeout);
- scoped_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
+ std::unique_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
ASSERT_TRUE(accepted);
sink.Monitor(accepted.get());
@@ -887,9 +889,9 @@
delete socket;
// Test send/receive behavior.
- scoped_ptr<TestClient> client1(
+ std::unique_ptr<TestClient> client1(
new TestClient(AsyncUDPSocket::Create(ss_, addr1)));
- scoped_ptr<TestClient> client2(
+ std::unique_ptr<TestClient> client2(
new TestClient(AsyncUDPSocket::Create(ss_, empty)));
SocketAddress addr2;
@@ -928,10 +930,10 @@
SocketAddress test_addr(dest, 2345);
// Test send
- scoped_ptr<TestClient> client(
+ std::unique_ptr<TestClient> client(
new TestClient(AsyncUDPSocket::Create(ss_, empty)));
int test_packet_size = 1200;
- rtc::scoped_ptr<char[]> test_packet(new char[test_packet_size]);
+ std::unique_ptr<char[]> test_packet(new char[test_packet_size]);
// Init the test packet just to avoid memcheck warning.
memset(test_packet.get(), 0, test_packet_size);
// Set the send buffer size to the same size as the test packet to have a
@@ -965,7 +967,7 @@
}
void SocketTest::GetSetOptionsInternal(const IPAddress& loopback) {
- rtc::scoped_ptr<AsyncSocket> socket(
+ std::unique_ptr<AsyncSocket> socket(
ss_->CreateAsyncSocket(loopback.family(), SOCK_DGRAM));
socket->Bind(SocketAddress(loopback, 0));
@@ -1000,9 +1002,8 @@
// Skip the esimate MTU test for IPv6 for now.
if (loopback.family() != AF_INET6) {
// Try estimating MTU.
- rtc::scoped_ptr<AsyncSocket>
- mtu_socket(
- ss_->CreateAsyncSocket(loopback.family(), SOCK_DGRAM));
+ std::unique_ptr<AsyncSocket> mtu_socket(
+ ss_->CreateAsyncSocket(loopback.family(), SOCK_DGRAM));
mtu_socket->Bind(SocketAddress(loopback, 0));
uint16_t mtu;
// should fail until we connect
diff --git a/base/ssladapter_unittest.cc b/base/ssladapter_unittest.cc
index 7869b6e..16e5c2e 100644
--- a/base/ssladapter_unittest.cc
+++ b/base/ssladapter_unittest.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <string>
#include "webrtc/base/gunit.h"
@@ -123,7 +124,7 @@
private:
const rtc::SSLMode ssl_mode_;
- rtc::scoped_ptr<rtc::SSLAdapter> ssl_adapter_;
+ std::unique_ptr<rtc::SSLAdapter> ssl_adapter_;
std::string data_;
};
@@ -259,10 +260,10 @@
const rtc::SSLMode ssl_mode_;
- rtc::scoped_ptr<rtc::AsyncSocket> server_socket_;
- rtc::scoped_ptr<rtc::SSLStreamAdapter> ssl_stream_adapter_;
+ std::unique_ptr<rtc::AsyncSocket> server_socket_;
+ std::unique_ptr<rtc::SSLStreamAdapter> ssl_stream_adapter_;
- rtc::scoped_ptr<rtc::SSLIdentity> ssl_identity_;
+ std::unique_ptr<rtc::SSLIdentity> ssl_identity_;
std::string data_;
};
@@ -339,8 +340,8 @@
const rtc::SocketServerScope ss_scope_;
- rtc::scoped_ptr<SSLAdapterTestDummyServer> server_;
- rtc::scoped_ptr<SSLAdapterTestDummyClient> client_;
+ std::unique_ptr<SSLAdapterTestDummyServer> server_;
+ std::unique_ptr<SSLAdapterTestDummyClient> client_;
int handshake_wait_;
};
diff --git a/base/sslidentity.h b/base/sslidentity.h
index 77c9e18..af0149b 100644
--- a/base/sslidentity.h
+++ b/base/sslidentity.h
@@ -14,12 +14,12 @@
#define WEBRTC_BASE_SSLIDENTITY_H_
#include <algorithm>
+#include <memory>
#include <string>
#include <vector>
#include "webrtc/base/buffer.h"
#include "webrtc/base/messagedigest.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/timeutils.h"
namespace rtc {
@@ -53,7 +53,7 @@
// Provides the cert chain, or null. The chain includes a copy of each
// certificate, excluding the leaf.
- virtual rtc::scoped_ptr<SSLCertChain> GetChain() const = 0;
+ virtual std::unique_ptr<SSLCertChain> GetChain() const = 0;
// Returns a PEM encoded string representation of the certificate.
virtual std::string ToPEMString() const = 0;
diff --git a/base/sslidentity_unittest.cc b/base/sslidentity_unittest.cc
index f110f76..e108b7d 100644
--- a/base/sslidentity_unittest.cc
+++ b/base/sslidentity_unittest.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <string>
#include "webrtc/base/gunit.h"
@@ -174,11 +175,11 @@
}
private:
- rtc::scoped_ptr<SSLIdentity> identity_rsa1_;
- rtc::scoped_ptr<SSLIdentity> identity_rsa2_;
- rtc::scoped_ptr<SSLIdentity> identity_ecdsa1_;
- rtc::scoped_ptr<SSLIdentity> identity_ecdsa2_;
- rtc::scoped_ptr<rtc::SSLCertificate> test_cert_;
+ std::unique_ptr<SSLIdentity> identity_rsa1_;
+ std::unique_ptr<SSLIdentity> identity_rsa2_;
+ std::unique_ptr<SSLIdentity> identity_ecdsa1_;
+ std::unique_ptr<SSLIdentity> identity_ecdsa2_;
+ std::unique_ptr<rtc::SSLCertificate> test_cert_;
};
TEST_F(SSLIdentityTest, FixedDigestSHA1) {
@@ -251,7 +252,7 @@
"UD0A8qfhfDM+LK6rPAnCsVN0NRDY3jvd6rzix9M=\n"
"-----END CERTIFICATE-----\n";
- rtc::scoped_ptr<SSLIdentity> identity(
+ std::unique_ptr<SSLIdentity> identity(
SSLIdentity::FromPEMStrings(kRSA_PRIVATE_KEY_PEM, kCERT_PEM));
EXPECT_TRUE(identity);
EXPECT_EQ(kCERT_PEM, identity->certificate().ToPEMString());
@@ -278,7 +279,7 @@
"GWP/PwIgJynB4AUDsPT0DWmethOXYijB5sY5UPd9DvgmiS/Mr6s=\n"
"-----END CERTIFICATE-----\n";
- rtc::scoped_ptr<SSLIdentity> identity(
+ std::unique_ptr<SSLIdentity> identity(
SSLIdentity::FromPEMStrings(kRSA_PRIVATE_KEY_PEM, kCERT_PEM));
EXPECT_TRUE(identity);
EXPECT_EQ(kCERT_PEM, identity->certificate().ToPEMString());
diff --git a/base/sslsocketfactory.cc b/base/sslsocketfactory.cc
index d6ec56f..7ab58fd 100644
--- a/base/sslsocketfactory.cc
+++ b/base/sslsocketfactory.cc
@@ -8,10 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/base/autodetectproxy.h"
#include "webrtc/base/httpcommon.h"
#include "webrtc/base/httpcommon-inl.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/socketadapters.h"
#include "webrtc/base/ssladapter.h"
#include "webrtc/base/sslsocketfactory.h"
@@ -167,7 +168,7 @@
}
if (!hostname_.empty()) {
- rtc::scoped_ptr<SSLAdapter> ssl_adapter(SSLAdapter::Create(socket));
+ std::unique_ptr<SSLAdapter> ssl_adapter(SSLAdapter::Create(socket));
if (!ssl_adapter) {
LOG_F(LS_ERROR) << "SSL unavailable";
delete socket;
diff --git a/base/sslstreamadapter.h b/base/sslstreamadapter.h
index 9a94462..c5045f1 100644
--- a/base/sslstreamadapter.h
+++ b/base/sslstreamadapter.h
@@ -11,6 +11,7 @@
#ifndef WEBRTC_BASE_SSLSTREAMADAPTER_H_
#define WEBRTC_BASE_SSLSTREAMADAPTER_H_
+#include <memory>
#include <string>
#include <vector>
@@ -159,7 +160,7 @@
// Retrieves the peer's X.509 certificate, if a connection has been
// established. It returns the transmitted over SSL, including the entire
// chain.
- virtual rtc::scoped_ptr<SSLCertificate> GetPeerCertificate() const = 0;
+ virtual std::unique_ptr<SSLCertificate> GetPeerCertificate() const = 0;
// Retrieves the IANA registration id of the cipher suite used for the
// connection (e.g. 0x2F for "TLS_RSA_WITH_AES_128_CBC_SHA").
diff --git a/base/sslstreamadapter_unittest.cc b/base/sslstreamadapter_unittest.cc
index 8d5b275..ac9fef9 100644
--- a/base/sslstreamadapter_unittest.cc
+++ b/base/sslstreamadapter_unittest.cc
@@ -10,13 +10,13 @@
#include <algorithm>
+#include <memory>
#include <set>
#include <string>
#include "webrtc/base/bufferqueue.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/helpers.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/ssladapter.h"
#include "webrtc/base/sslconfig.h"
#include "webrtc/base/sslidentity.h"
@@ -474,7 +474,7 @@
return server_ssl_->GetDtlsSrtpCryptoSuite(retval);
}
- rtc::scoped_ptr<rtc::SSLCertificate> GetPeerCertificate(bool client) {
+ std::unique_ptr<rtc::SSLCertificate> GetPeerCertificate(bool client) {
if (client)
return client_ssl_->GetPeerCertificate();
else
@@ -526,8 +526,8 @@
rtc::KeyParams server_key_type_;
SSLDummyStreamBase *client_stream_; // freed by client_ssl_ destructor
SSLDummyStreamBase *server_stream_; // freed by server_ssl_ destructor
- rtc::scoped_ptr<rtc::SSLStreamAdapter> client_ssl_;
- rtc::scoped_ptr<rtc::SSLStreamAdapter> server_ssl_;
+ std::unique_ptr<rtc::SSLStreamAdapter> client_ssl_;
+ std::unique_ptr<rtc::SSLStreamAdapter> server_ssl_;
rtc::SSLIdentity *client_identity_; // freed by client_ssl_ destructor
rtc::SSLIdentity *server_identity_; // freed by server_ssl_ destructor
int delay_;
@@ -1043,7 +1043,7 @@
TestHandshake();
// The client should have a peer certificate after the handshake.
- rtc::scoped_ptr<rtc::SSLCertificate> client_peer_cert =
+ std::unique_ptr<rtc::SSLCertificate> client_peer_cert =
GetPeerCertificate(true);
ASSERT_TRUE(client_peer_cert);
@@ -1055,7 +1055,7 @@
ASSERT_FALSE(client_peer_cert->GetChain());
// The server should have a peer certificate after the handshake.
- rtc::scoped_ptr<rtc::SSLCertificate> server_peer_cert =
+ std::unique_ptr<rtc::SSLCertificate> server_peer_cert =
GetPeerCertificate(false);
ASSERT_TRUE(server_peer_cert);
diff --git a/base/stream.h b/base/stream.h
index e624df5..2d76ee2 100644
--- a/base/stream.h
+++ b/base/stream.h
@@ -11,6 +11,7 @@
#ifndef WEBRTC_BASE_STREAM_H_
#define WEBRTC_BASE_STREAM_H_
+#include <memory>
#include <stdio.h>
#include "webrtc/base/basictypes.h"
@@ -19,7 +20,6 @@
#include "webrtc/base/logging.h"
#include "webrtc/base/messagehandler.h"
#include "webrtc/base/messagequeue.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/sigslot.h"
namespace rtc {
@@ -334,7 +334,7 @@
int* error) override;
private:
- scoped_ptr<StreamInterface> tap_;
+ std::unique_ptr<StreamInterface> tap_;
StreamResult tap_result_;
int tap_error_;
RTC_DISALLOW_COPY_AND_ASSIGN(StreamTap);
@@ -554,7 +554,7 @@
// keeps the opened/closed state of the stream
StreamState state_ GUARDED_BY(crit_);
// the allocated buffer
- scoped_ptr<char[]> buffer_ GUARDED_BY(crit_);
+ std::unique_ptr<char[]> buffer_ GUARDED_BY(crit_);
// size of the allocated buffer
size_t buffer_length_ GUARDED_BY(crit_);
// amount of readable data in the buffer
diff --git a/base/task.h b/base/task.h
index 28702e4..b2a6067 100644
--- a/base/task.h
+++ b/base/task.h
@@ -13,7 +13,6 @@
#include <string>
#include "webrtc/base/basictypes.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/sigslot.h"
#include "webrtc/base/taskparent.h"
diff --git a/base/taskparent.h b/base/taskparent.h
index 41008fa..3c0b81c 100644
--- a/base/taskparent.h
+++ b/base/taskparent.h
@@ -11,10 +11,11 @@
#ifndef WEBRTC_BASE_TASKPARENT_H__
#define WEBRTC_BASE_TASKPARENT_H__
+#include <memory>
#include <set>
#include "webrtc/base/basictypes.h"
-#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/constructormagic.h"
namespace rtc {
@@ -52,7 +53,7 @@
TaskRunner *runner_;
bool child_error_;
typedef std::set<Task *> ChildSet;
- scoped_ptr<ChildSet> children_;
+ std::unique_ptr<ChildSet> children_;
RTC_DISALLOW_COPY_AND_ASSIGN(TaskParent);
};
diff --git a/base/taskrunner.cc b/base/taskrunner.cc
index c50c9f8..73916a0 100644
--- a/base/taskrunner.cc
+++ b/base/taskrunner.cc
@@ -13,7 +13,6 @@
#include "webrtc/base/taskrunner.h"
#include "webrtc/base/common.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/task.h"
#include "webrtc/base/logging.h"
diff --git a/base/testechoserver.h b/base/testechoserver.h
index 51d7d53..e87a63f 100644
--- a/base/testechoserver.h
+++ b/base/testechoserver.h
@@ -12,6 +12,7 @@
#define WEBRTC_BASE_TESTECHOSERVER_H_
#include <list>
+#include <memory>
#include "webrtc/base/asynctcpsocket.h"
#include "webrtc/base/socketaddress.h"
#include "webrtc/base/sigslot.h"
@@ -63,7 +64,7 @@
}
typedef std::list<AsyncTCPSocket*> ClientList;
- scoped_ptr<AsyncSocket> server_socket_;
+ std::unique_ptr<AsyncSocket> server_socket_;
ClientList client_sockets_;
RTC_DISALLOW_COPY_AND_ASSIGN(TestEchoServer);
};
diff --git a/base/testutils.h b/base/testutils.h
index 6e7e22a..e5e571b 100644
--- a/base/testutils.h
+++ b/base/testutils.h
@@ -24,6 +24,7 @@
#include <algorithm>
#include <map>
+#include <memory>
#include <vector>
#include "webrtc/base/arraysize.h"
#include "webrtc/base/asyncsocket.h"
@@ -371,7 +372,7 @@
void OnCloseEvent(AsyncSocket* socket, int error) {
}
- scoped_ptr<AsyncSocket> socket_;
+ std::unique_ptr<AsyncSocket> socket_;
Buffer send_buffer_, recv_buffer_;
};
@@ -414,7 +415,7 @@
clients_.push_back(new SocketTestClient(accepted));
}
- scoped_ptr<AsyncSocket> socket_;
+ std::unique_ptr<AsyncSocket> socket_;
std::vector<SocketTestClient*> clients_;
};
diff --git a/base/thread_checker_unittest.cc b/base/thread_checker_unittest.cc
index 3381900..8fcaa7a 100644
--- a/base/thread_checker_unittest.cc
+++ b/base/thread_checker_unittest.cc
@@ -10,11 +10,12 @@
// Borrowed from Chromium's src/base/threading/thread_checker_unittest.cc.
+#include <memory>
+
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/thread.h"
#include "webrtc/base/thread_checker.h"
-#include "webrtc/base/scoped_ptr.h"
// Duplicated from base/threading/thread_checker.h so that we can be
// good citizens there and undef the macro.
@@ -91,7 +92,7 @@
}
private:
- scoped_ptr<ThreadCheckerClass> thread_checker_class_;
+ std::unique_ptr<ThreadCheckerClass> thread_checker_class_;
RTC_DISALLOW_COPY_AND_ASSIGN(DeleteThreadCheckerClassOnThread);
};
@@ -99,7 +100,7 @@
} // namespace
TEST(ThreadCheckerTest, CallsAllowedOnSameThread) {
- scoped_ptr<ThreadCheckerClass> thread_checker_class(
+ std::unique_ptr<ThreadCheckerClass> thread_checker_class(
new ThreadCheckerClass);
// Verify that DoStuff doesn't assert.
@@ -110,7 +111,7 @@
}
TEST(ThreadCheckerTest, DestructorAllowedOnDifferentThread) {
- scoped_ptr<ThreadCheckerClass> thread_checker_class(
+ std::unique_ptr<ThreadCheckerClass> thread_checker_class(
new ThreadCheckerClass);
// Verify that the destructor doesn't assert
@@ -123,7 +124,7 @@
}
TEST(ThreadCheckerTest, DetachFromThread) {
- scoped_ptr<ThreadCheckerClass> thread_checker_class(
+ std::unique_ptr<ThreadCheckerClass> thread_checker_class(
new ThreadCheckerClass);
// Verify that DoStuff doesn't assert when called on a different thread after
@@ -138,7 +139,7 @@
#if GTEST_HAS_DEATH_TEST || !ENABLE_THREAD_CHECKER
void ThreadCheckerClass::MethodOnDifferentThreadImpl() {
- scoped_ptr<ThreadCheckerClass> thread_checker_class(
+ std::unique_ptr<ThreadCheckerClass> thread_checker_class(
new ThreadCheckerClass);
// DoStuff should assert in debug builds only when called on a
@@ -162,7 +163,7 @@
#endif // ENABLE_THREAD_CHECKER
void ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl() {
- scoped_ptr<ThreadCheckerClass> thread_checker_class(
+ std::unique_ptr<ThreadCheckerClass> thread_checker_class(
new ThreadCheckerClass);
// DoStuff doesn't assert when called on a different thread
diff --git a/base/thread_unittest.cc b/base/thread_unittest.cc
index 7889e29..d733058 100644
--- a/base/thread_unittest.cc
+++ b/base/thread_unittest.cc
@@ -589,17 +589,18 @@
// Functor for creating an invoker.
struct CreateInvoker {
- CreateInvoker(scoped_ptr<GuardedAsyncInvoker>* invoker) : invoker_(invoker) {}
+ CreateInvoker(std::unique_ptr<GuardedAsyncInvoker>* invoker)
+ : invoker_(invoker) {}
void operator()() { invoker_->reset(new GuardedAsyncInvoker()); }
- scoped_ptr<GuardedAsyncInvoker>* invoker_;
+ std::unique_ptr<GuardedAsyncInvoker>* invoker_;
};
// Test that we can call AsyncInvoke<void>() after the thread died.
TEST_F(GuardedAsyncInvokeTest, KillThreadFireAndForget) {
// Create and start the thread.
- scoped_ptr<Thread> thread(new Thread());
+ std::unique_ptr<Thread> thread(new Thread());
thread->Start();
- scoped_ptr<GuardedAsyncInvoker> invoker;
+ std::unique_ptr<GuardedAsyncInvoker> invoker;
// Create the invoker on |thread|.
thread->Invoke<void>(CreateInvoker(&invoker));
// Kill |thread|.
@@ -615,9 +616,9 @@
// Test that we can call AsyncInvoke with callback after the thread died.
TEST_F(GuardedAsyncInvokeTest, KillThreadWithCallback) {
// Create and start the thread.
- scoped_ptr<Thread> thread(new Thread());
+ std::unique_ptr<Thread> thread(new Thread());
thread->Start();
- scoped_ptr<GuardedAsyncInvoker> invoker;
+ std::unique_ptr<GuardedAsyncInvoker> invoker;
// Create the invoker on |thread|.
thread->Invoke<void>(CreateInvoker(&invoker));
// Kill |thread|.
diff --git a/base/virtualsocket_unittest.cc b/base/virtualsocket_unittest.cc
index 2cd2b5e..bdbf06a 100644
--- a/base/virtualsocket_unittest.cc
+++ b/base/virtualsocket_unittest.cc
@@ -14,6 +14,8 @@
#include <netinet/in.h>
#endif
+#include <memory>
+
#include "webrtc/base/arraysize.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/gunit.h"
@@ -63,7 +65,7 @@
}
Thread* thread;
- scoped_ptr<AsyncUDPSocket> socket;
+ std::unique_ptr<AsyncUDPSocket> socket;
rtc::PacketOptions options;
bool done;
uint32_t rate; // bytes per second
@@ -123,7 +125,7 @@
}
Thread* thread;
- scoped_ptr<AsyncUDPSocket> socket;
+ std::unique_ptr<AsyncUDPSocket> socket;
uint32_t bandwidth;
bool done;
size_t count;
@@ -345,11 +347,11 @@
EmptySocketAddressWithFamily(initial_addr.family());
// Create client and server
- scoped_ptr<AsyncSocket> client(ss_->CreateAsyncSocket(initial_addr.family(),
- SOCK_STREAM));
+ std::unique_ptr<AsyncSocket> client(
+ ss_->CreateAsyncSocket(initial_addr.family(), SOCK_STREAM));
sink.Monitor(client.get());
- scoped_ptr<AsyncSocket> server(ss_->CreateAsyncSocket(initial_addr.family(),
- SOCK_STREAM));
+ std::unique_ptr<AsyncSocket> server(
+ ss_->CreateAsyncSocket(initial_addr.family(), SOCK_STREAM));
sink.Monitor(server.get());
// Initiate connect
@@ -406,7 +408,7 @@
// Server accepts connection
EXPECT_TRUE(sink.Check(server.get(), testing::SSE_READ));
- scoped_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
+ std::unique_ptr<AsyncSocket> accepted(server->Accept(&accept_addr));
ASSERT_TRUE(NULL != accepted.get());
sink.Monitor(accepted.get());
@@ -435,9 +437,8 @@
a->Bind(initial_addr);
EXPECT_EQ(a->GetLocalAddress().family(), initial_addr.family());
-
- scoped_ptr<AsyncSocket> b(ss_->CreateAsyncSocket(initial_addr.family(),
- SOCK_STREAM));
+ std::unique_ptr<AsyncSocket> b(
+ ss_->CreateAsyncSocket(initial_addr.family(), SOCK_STREAM));
sink.Monitor(b.get());
b->Bind(initial_addr);
EXPECT_EQ(b->GetLocalAddress().family(), initial_addr.family());
diff --git a/base/virtualsocketserver.cc b/base/virtualsocketserver.cc
index c6d402f..f5b7db7 100644
--- a/base/virtualsocketserver.cc
+++ b/base/virtualsocketserver.cc
@@ -15,6 +15,7 @@
#include <algorithm>
#include <map>
+#include <memory>
#include <vector>
#include "webrtc/base/checks.h"
@@ -771,7 +772,7 @@
VirtualSocket* recipient = LookupBinding(remote_addr);
if (!recipient) {
// Make a fake recipient for address family checking.
- scoped_ptr<VirtualSocket> dummy_socket(
+ std::unique_ptr<VirtualSocket> dummy_socket(
CreateSocketInternal(AF_INET, SOCK_DGRAM));
dummy_socket->SetLocalAddress(remote_addr);
if (!CanInteractWith(socket, dummy_socket.get())) {
diff --git a/base/win32filesystem.cc b/base/win32filesystem.cc
index b731974..8457403 100644
--- a/base/win32filesystem.cc
+++ b/base/win32filesystem.cc
@@ -15,10 +15,11 @@
#include <shlobj.h>
#include <tchar.h>
+#include <memory>
+
#include "webrtc/base/arraysize.h"
#include "webrtc/base/fileutils.h"
#include "webrtc/base/pathutils.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/stream.h"
#include "webrtc/base/stringutils.h"
@@ -95,7 +96,7 @@
&token_user_size);
// Get the TOKEN_USER structure.
- scoped_ptr<char[]> token_user_bytes(new char[token_user_size]);
+ std::unique_ptr<char[]> token_user_bytes(new char[token_user_size]);
PTOKEN_USER token_user = reinterpret_cast<PTOKEN_USER>(
token_user_bytes.get());
memset(token_user, 0, token_user_size);
@@ -121,7 +122,7 @@
GetLengthSid(token_user->User.Sid);
// Allocate it.
- scoped_ptr<char[]> acl_bytes(new char[acl_size]);
+ std::unique_ptr<char[]> acl_bytes(new char[acl_size]);
PACL acl = reinterpret_cast<PACL>(acl_bytes.get());
memset(acl, 0, acl_size);
if (!::InitializeAcl(acl, acl_size, ACL_REVISION)) {
@@ -425,7 +426,7 @@
Pathname Win32Filesystem::GetCurrentDirectory() {
Pathname cwd;
int path_len = 0;
- scoped_ptr<wchar_t[]> path;
+ std::unique_ptr<wchar_t[]> path;
do {
int needed = ::GetCurrentDirectory(path_len, path.get());
if (needed == 0) {
diff --git a/base/win32regkey.cc b/base/win32regkey.cc
index c53386f..447086a 100644
--- a/base/win32regkey.cc
+++ b/base/win32regkey.cc
@@ -21,9 +21,10 @@
#include <shlwapi.h>
+#include <memory>
+
#include "webrtc/base/common.h"
#include "webrtc/base/logging.h"
-#include "webrtc/base/scoped_ptr.h"
namespace rtc {
@@ -146,7 +147,7 @@
byte* buffer_raw = nullptr;
HRESULT hr = GetValueStaticHelper(full_key_name, value_name,
REG_BINARY, &buffer_raw, &byte_count);
- scoped_ptr<byte[]> buffer(buffer_raw);
+ std::unique_ptr<byte[]> buffer(buffer_raw);
if (SUCCEEDED(hr)) {
ASSERT(byte_count == sizeof(*value));
if (byte_count == sizeof(*value)) {
@@ -166,7 +167,7 @@
byte* buffer_raw = nullptr;
HRESULT hr = GetValueStaticHelper(full_key_name, value_name,
REG_BINARY, &buffer_raw, &byte_count);
- scoped_ptr<byte[]> buffer(buffer_raw);
+ std::unique_ptr<byte[]> buffer(buffer_raw);
if (SUCCEEDED(hr)) {
ASSERT(byte_count == sizeof(*value));
if (byte_count == sizeof(*value)) {
@@ -193,7 +194,7 @@
wchar_t* buffer_raw = nullptr;
HRESULT hr = RegKey::GetValue(full_key_name, value_name, &buffer_raw);
- scoped_ptr<wchar_t[]> buffer(buffer_raw);
+ std::unique_ptr<wchar_t[]> buffer(buffer_raw);
if (SUCCEEDED(hr)) {
value->assign(buffer.get());
}
diff --git a/base/windowpicker_unittest.cc b/base/windowpicker_unittest.cc
index edd01bc..a125832 100644
--- a/base/windowpicker_unittest.cc
+++ b/base/windowpicker_unittest.cc
@@ -7,6 +7,8 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/base/gunit.h"
#include "webrtc/base/testutils.h"
#include "webrtc/base/window.h"
@@ -25,7 +27,7 @@
LOG(LS_INFO) << "skipping test: window capturing is not supported with "
<< "current configuration.";
}
- rtc::scoped_ptr<rtc::WindowPicker> picker(
+ std::unique_ptr<rtc::WindowPicker> picker(
rtc::WindowPickerFactory::CreateWindowPicker());
EXPECT_TRUE(picker->Init());
rtc::WindowDescriptionList descriptions;
@@ -40,7 +42,7 @@
LOG(LS_INFO) << "skipping test: window capturing is not supported with "
<< "current configuration.";
}
- rtc::scoped_ptr<rtc::WindowPicker> picker(
+ std::unique_ptr<rtc::WindowPicker> picker(
rtc::WindowPickerFactory::CreateWindowPicker());
EXPECT_TRUE(picker->Init());
rtc::DesktopDescriptionList descriptions;
diff --git a/base/x11windowpicker.h b/base/x11windowpicker.h
index 501adf5..d741759 100644
--- a/base/x11windowpicker.h
+++ b/base/x11windowpicker.h
@@ -11,8 +11,9 @@
#ifndef WEBRTC_BASE_LINUXWINDOWPICKER_H_
#define WEBRTC_BASE_LINUXWINDOWPICKER_H_
+#include <memory>
+
#include "webrtc/base/basictypes.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/windowpicker.h"
// Avoid include <X11/Xlib.h>.
@@ -44,7 +45,7 @@
uint8_t* GetDesktopThumbnail(const DesktopId& id, int width, int height);
private:
- scoped_ptr<XWindowEnumerator> enumerator_;
+ std::unique_ptr<XWindowEnumerator> enumerator_;
};
} // namespace rtc