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-Commit-Position: refs/heads/master@{#12501}
This commit is contained in:
jbauch 2016-04-26 03:13:22 -07:00 committed by Commit bot
parent 4e7f6c1887
commit 555604a746
117 changed files with 512 additions and 433 deletions

View File

@ -101,8 +101,7 @@
rtc::SSLIdentity::Generate(webrtc::kIdentityName, rtc::KT_ECDSA));
if (identity) {
nativeConfig.certificates.push_back(
rtc::RTCCertificate::Create(
rtc::UniqueToScoped(std::move(identity))));
rtc::RTCCertificate::Create(std::move(identity)));
} else {
RTCLogWarning(@"Failed to generate ECDSA identity. RSA will be used.");
}

View File

@ -51,7 +51,7 @@ class DtlsIdentityStoreImpl::WorkerTask : public sigslot::has_slots<>,
private:
void GenerateIdentity_w() {
LOG(LS_INFO) << "Generating identity, using keytype " << key_type_;
rtc::scoped_ptr<rtc::SSLIdentity> identity(
std::unique_ptr<rtc::SSLIdentity> identity(
rtc::SSLIdentity::Generate(kIdentityName, key_type_));
// Posting to |this| avoids touching |store_| on threads other than
@ -186,7 +186,8 @@ void DtlsIdentityStoreImpl::GenerateIdentity(
}
void DtlsIdentityStoreImpl::OnIdentityGenerated(
rtc::KeyType key_type, rtc::scoped_ptr<rtc::SSLIdentity> identity) {
rtc::KeyType key_type,
std::unique_ptr<rtc::SSLIdentity> identity) {
RTC_DCHECK(signaling_thread_->IsCurrent());
RTC_DCHECK(request_info_[key_type].gen_in_progress_counts_);

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_API_DTLSIDENTITYSTORE_H_
#define WEBRTC_API_DTLSIDENTITYSTORE_H_
#include <memory>
#include <queue>
#include <string>
#include <utility>
@ -19,7 +20,6 @@
#include "webrtc/base/messagequeue.h"
#include "webrtc/base/optional.h"
#include "webrtc/base/refcount.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/base/sslidentity.h"
#include "webrtc/base/thread.h"
@ -39,9 +39,9 @@ class DtlsIdentityRequestObserver : public rtc::RefCountInterface {
// TODO(hbos): Unify the OnSuccess method once Chrome code is updated.
virtual void OnSuccess(const std::string& der_cert,
const std::string& der_private_key) = 0;
// |identity| is a scoped_ptr because rtc::SSLIdentity is not copyable and the
// |identity| is a unique_ptr because rtc::SSLIdentity is not copyable and the
// client has to get the ownership of the object to make use of it.
virtual void OnSuccess(rtc::scoped_ptr<rtc::SSLIdentity> identity) = 0;
virtual void OnSuccess(std::unique_ptr<rtc::SSLIdentity> identity) = 0;
protected:
virtual ~DtlsIdentityRequestObserver() {}
@ -106,7 +106,7 @@ class DtlsIdentityStoreImpl : public DtlsIdentityStoreInterface,
rtc::KeyType key_type,
const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer);
void OnIdentityGenerated(rtc::KeyType key_type,
rtc::scoped_ptr<rtc::SSLIdentity> identity);
std::unique_ptr<rtc::SSLIdentity> identity);
class WorkerTask;
typedef rtc::ScopedMessageData<DtlsIdentityStoreImpl::WorkerTask>
@ -115,11 +115,11 @@ class DtlsIdentityStoreImpl : public DtlsIdentityStoreInterface,
// A key type-identity pair.
struct IdentityResult {
IdentityResult(rtc::KeyType key_type,
rtc::scoped_ptr<rtc::SSLIdentity> identity)
std::unique_ptr<rtc::SSLIdentity> identity)
: key_type_(key_type), identity_(std::move(identity)) {}
rtc::KeyType key_type_;
rtc::scoped_ptr<rtc::SSLIdentity> identity_;
std::unique_ptr<rtc::SSLIdentity> identity_;
};
typedef rtc::ScopedMessageData<IdentityResult> IdentityResultMessageData;
@ -139,7 +139,7 @@ class DtlsIdentityStoreImpl : public DtlsIdentityStoreInterface,
std::queue<rtc::scoped_refptr<DtlsIdentityRequestObserver>>
request_observers_;
size_t gen_in_progress_counts_;
rtc::scoped_ptr<rtc::SSLIdentity> free_identity_;
std::unique_ptr<rtc::SSLIdentity> free_identity_;
};
// One RequestInfo per KeyType. Only touch on the |signaling_thread_|.

View File

@ -10,6 +10,8 @@
#include "webrtc/api/dtlsidentitystore.h"
#include <memory>
#include "webrtc/api/webrtcsessiondescriptionfactory.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/logging.h"
@ -34,7 +36,7 @@ class MockDtlsIdentityRequestObserver :
LOG(LS_WARNING) << "The string version of OnSuccess is called unexpectedly";
EXPECT_TRUE(false);
}
void OnSuccess(rtc::scoped_ptr<rtc::SSLIdentity> identity) override {
void OnSuccess(std::unique_ptr<rtc::SSLIdentity> identity) override {
EXPECT_FALSE(call_back_called_);
call_back_called_ = true;
last_request_success_ = true;
@ -77,8 +79,8 @@ class DtlsIdentityStoreTest : public testing::Test {
rtc::CleanupSSL();
}
rtc::scoped_ptr<rtc::Thread> worker_thread_;
rtc::scoped_ptr<DtlsIdentityStoreImpl> store_;
std::unique_ptr<rtc::Thread> worker_thread_;
std::unique_ptr<DtlsIdentityStoreImpl> store_;
rtc::scoped_refptr<MockDtlsIdentityRequestObserver> observer_;
};

View File

@ -40,6 +40,7 @@
#define JNIEXPORT __attribute__((visibility("default")))
#include <limits>
#include <memory>
#include <utility>
#include "webrtc/api/androidvideocapturer.h"
@ -1565,7 +1566,7 @@ JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnection)(
// Create ECDSA certificate.
if (JavaKeyTypeToNativeType(jni, j_key_type) == rtc::KT_ECDSA) {
scoped_ptr<rtc::SSLIdentity> ssl_identity(
std::unique_ptr<rtc::SSLIdentity> ssl_identity(
rtc::SSLIdentity::Generate(webrtc::kIdentityName, rtc::KT_ECDSA));
if (ssl_identity.get()) {
rtc_config.certificates.push_back(

View File

@ -10,6 +10,8 @@
#import "RTCConfiguration.h"
#include <memory>
#include "webrtc/base/sslidentity.h"
#import "webrtc/api/objc/RTCConfiguration+Private.h"
@ -86,7 +88,7 @@
nativeConfig.ice_backup_candidate_pair_ping_interval =
_iceBackupCandidatePairPingInterval;
if (_keyType == RTCEncryptionKeyTypeECDSA) {
rtc::scoped_ptr<rtc::SSLIdentity> identity(
std::unique_ptr<rtc::SSLIdentity> identity(
rtc::SSLIdentity::Generate(webrtc::kIdentityName, rtc::KT_ECDSA));
if (identity) {
nativeConfig.certificates.push_back(

View File

@ -10,18 +10,16 @@
#include "webrtc/api/statscollector.h"
#include <memory>
#include <utility>
#include <vector>
#include "webrtc/api/peerconnection.h"
#include "webrtc/base/base64.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/timing.h"
#include "webrtc/pc/channel.h"
using rtc::scoped_ptr;
namespace webrtc {
namespace {
@ -532,7 +530,7 @@ StatsReport* StatsCollector::AddOneCertificateReport(
if (!cert->GetSignatureDigestAlgorithm(&digest_algorithm))
return nullptr;
rtc::scoped_ptr<rtc::SSLFingerprint> ssl_fingerprint(
std::unique_ptr<rtc::SSLFingerprint> ssl_fingerprint(
rtc::SSLFingerprint::Create(digest_algorithm, cert));
// SSLFingerprint::Create can fail if the algorithm returned by
@ -574,7 +572,7 @@ StatsReport* StatsCollector::AddCertificateReports(
RTC_DCHECK(cert != NULL);
StatsReport* issuer = nullptr;
rtc::scoped_ptr<rtc::SSLCertChain> chain = cert->GetChain();
std::unique_ptr<rtc::SSLCertChain> chain = cert->GetChain();
if (chain) {
// This loop runs in reverse, i.e. from root to leaf, so that each
// certificate's issuer's report ID is known before the child certificate's
@ -702,7 +700,7 @@ void StatsCollector::ExtractSessionInfo() {
local_cert_report_id = r->id();
}
rtc::scoped_ptr<rtc::SSLCertificate> cert =
std::unique_ptr<rtc::SSLCertificate> cert =
pc_->session()->GetRemoteSSLCertificate(
transport_iter.second.transport_name);
if (cert) {

View File

@ -11,6 +11,7 @@
#include <stdio.h>
#include <algorithm>
#include <memory>
#include "webrtc/api/statscollector.h"
@ -84,9 +85,9 @@ class MockWebRtcSession : public webrtc::WebRtcSession {
rtc::scoped_refptr<rtc::RTCCertificate>* certificate));
// Workaround for gmock's inability to cope with move-only return values.
rtc::scoped_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate(
std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate(
const std::string& transport_name) override {
return rtc::scoped_ptr<rtc::SSLCertificate>(
return std::unique_ptr<rtc::SSLCertificate>(
GetRemoteSSLCertificate_ReturnsRawPointer(transport_name));
}
MOCK_METHOD1(GetRemoteSSLCertificate_ReturnsRawPointer,
@ -694,7 +695,7 @@ class StatsCollectorTest : public testing::Test {
// Fake certificate to report
rtc::scoped_refptr<rtc::RTCCertificate> local_certificate(
rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::FakeSSLIdentity>(
rtc::RTCCertificate::Create(std::unique_ptr<rtc::FakeSSLIdentity>(
new rtc::FakeSSLIdentity(local_cert))));
// Configure MockWebRtcSession

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_API_TEST_FAKEDTLSIDENTITYSERVICE_H_
#define WEBRTC_API_TEST_FAKEDTLSIDENTITYSERVICE_H_
#include <memory>
#include <string>
#include <utility>
@ -127,7 +128,7 @@ class FakeDtlsIdentityStore : public webrtc::DtlsIdentityStoreInterface,
rtc::kPemTypeRsaPrivateKey,
reinterpret_cast<const unsigned char*>(key.data()),
key.length());
rtc::scoped_ptr<rtc::SSLIdentity> identity(
std::unique_ptr<rtc::SSLIdentity> identity(
rtc::SSLIdentity::FromPEMStrings(pem_key, pem_cert));
return rtc::RTCCertificate::Create(std::move(identity));

View File

@ -1039,7 +1039,7 @@ bool WebRtcSession::GetLocalCertificate(
certificate);
}
rtc::scoped_ptr<rtc::SSLCertificate> WebRtcSession::GetRemoteSSLCertificate(
std::unique_ptr<rtc::SSLCertificate> WebRtcSession::GetRemoteSSLCertificate(
const std::string& transport_name) {
ASSERT(signaling_thread()->IsCurrent());
return transport_controller_->GetRemoteSSLCertificate(transport_name);

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_API_WEBRTCSESSION_H_
#define WEBRTC_API_WEBRTCSESSION_H_
#include <memory>
#include <set>
#include <string>
#include <vector>
@ -293,7 +294,7 @@ class WebRtcSession : public AudioProviderInterface,
rtc::scoped_refptr<rtc::RTCCertificate>* certificate);
// Caller owns returned certificate
virtual rtc::scoped_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate(
virtual std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate(
const std::string& transport_name);
cricket::DataChannelType data_channel_type() const;

View File

@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include <utility>
#include <vector>
@ -692,7 +693,7 @@ class WebRtcSessionTest
rtc::ToString(rtc::CreateRandomId());
// Confirmed to work with KT_RSA and KT_ECDSA.
tdesc_factory_->set_certificate(
rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>(
rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
rtc::SSLIdentity::Generate(identity_name, rtc::KT_DEFAULT))));
tdesc_factory_->set_secure(cricket::SEC_REQUIRED);
}

View File

@ -82,13 +82,13 @@ void WebRtcIdentityRequestObserver::OnSuccess(
rtc::kPemTypeRsaPrivateKey,
reinterpret_cast<const unsigned char*>(der_private_key.data()),
der_private_key.length());
rtc::scoped_ptr<rtc::SSLIdentity> identity(
std::unique_ptr<rtc::SSLIdentity> identity(
rtc::SSLIdentity::FromPEMStrings(pem_key, pem_cert));
SignalCertificateReady(rtc::RTCCertificate::Create(std::move(identity)));
}
void WebRtcIdentityRequestObserver::OnSuccess(
rtc::scoped_ptr<rtc::SSLIdentity> identity) {
std::unique_ptr<rtc::SSLIdentity> identity) {
SignalCertificateReady(rtc::RTCCertificate::Create(std::move(identity)));
}

View File

@ -11,6 +11,8 @@
#ifndef WEBRTC_API_WEBRTCSESSIONDESCRIPTIONFACTORY_H_
#define WEBRTC_API_WEBRTCSESSIONDESCRIPTIONFACTORY_H_
#include <memory>
#include "webrtc/api/dtlsidentitystore.h"
#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/base/messagehandler.h"
@ -37,7 +39,7 @@ class WebRtcIdentityRequestObserver : public DtlsIdentityRequestObserver,
void OnFailure(int error) override;
void OnSuccess(const std::string& der_cert,
const std::string& der_private_key) override;
void OnSuccess(rtc::scoped_ptr<rtc::SSLIdentity> identity) override;
void OnSuccess(std::unique_ptr<rtc::SSLIdentity> identity) override;
sigslot::signal1<int> SignalRequestFailed;
sigslot::signal1<const rtc::scoped_refptr<rtc::RTCCertificate>&>

View File

@ -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 @@ AsyncSocket* AsyncTCPSocketBase::ConnectSocket(
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;

View File

@ -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 @@ class AsyncTCPSocketBase : public AsyncPacketSocket {
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_;

View File

@ -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 @@ class AsyncTCPSocketTest
}
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_;
};

View File

@ -18,7 +18,7 @@ static const int BUF_SIZE = 64 * 1024;
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;

View File

@ -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 @@ class AsyncUDPSocket : public AsyncPacketSocket {
// 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_;
};

View File

@ -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 @@ class AsyncUdpSocketTest
}
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_;
};

View File

@ -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, Simple) {
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.

View File

@ -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 @@ public:
};
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 @@ public:
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_;
};

View File

@ -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 @@ class DBusSigFilterTest : public DBusSigFilter {
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 @@ TEST(DBusMonitorTest, StartStopStartStop) {
// 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, ReceivedNameAcquiredSignal) {
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, ConcurrentMonitors) {
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, ConcurrentFilters) {
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, NoAddFilterIfRunning) {
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, AddFilterAfterStop) {
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));

View File

@ -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 @@ StreamInterface* DiskCache::WriteResource(const std::string& id, size_t index) {
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 @@ StreamInterface* DiskCache::ReadResource(const std::string& id,
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;

View File

@ -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 @@ class FakeNetworkManager : public NetworkManagerBase,
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());

View File

@ -12,6 +12,7 @@
#define WEBRTC_BASE_FAKESSLIDENTITY_H_
#include <algorithm>
#include <memory>
#include <vector>
#include "webrtc/base/common.h"
@ -68,12 +69,12 @@ class FakeSSLCertificate : public rtc::SSLCertificate {
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;
}

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_BASE_FILEROTATINGSTREAM_H_
#define WEBRTC_BASE_FILEROTATINGSTREAM_H_
#include <memory>
#include <string>
#include <vector>
@ -110,7 +111,7 @@ class FileRotatingStream : public StreamInterface {
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_;

View File

@ -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 @@ class FileRotatingStreamTest : public ::testing::Test {
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 @@ class FileRotatingStreamTest : public ::testing::Test {
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 @@ class FileRotatingStreamTest : public ::testing::Test {
EXPECT_EQ(file_size, expected_length);
}
scoped_ptr<FileRotatingStream> stream_;
std::unique_ptr<FileRotatingStream> stream_;
std::string dir_path_;
};
@ -114,7 +116,7 @@ TEST_F(FileRotatingStreamTest, EmptyWrite) {
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 @@ class CallSessionFileRotatingStreamTest : public ::testing::Test {
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 @@ class CallSessionFileRotatingStreamTest : public ::testing::Test {
EXPECT_EQ(stream_size, read);
}
scoped_ptr<CallSessionFileRotatingStream> stream_;
std::unique_ptr<CallSessionFileRotatingStream> stream_;
std::string dir_path_;
};
@ -266,7 +268,7 @@ TEST_F(CallSessionFileRotatingStreamTest, WriteAndReadLarge) {
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 @@ TEST_F(CallSessionFileRotatingStreamTest, WriteAndReadLarge) {
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 @@ TEST_F(CallSessionFileRotatingStreamTest, WriteAndReadFirstHalf) {
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 @@ TEST_F(CallSessionFileRotatingStreamTest, WriteAndReadFirstHalf) {
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);

View File

@ -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 {

View File

@ -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 @@ TEST(FilesystemTest, TestCreatePrivateFile) {
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();

View File

@ -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 @@ static const char kUuidDigit17[4] = {'8', '9', 'a', 'b'};
// 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 @@ bool CreateRandomString(size_t len,
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 @@ bool CreateRandomString(size_t len, const std::string& table,
// 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;

View File

@ -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 @@ public:
// 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);

View File

@ -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 @@ bool HttpClient::BeginCacheFile() {
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 @@ bool HttpClient::BeginCacheFile() {
}
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 @@ bool HttpClient::CheckCache() {
}
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 HttpClient::ReadCacheBody(const std::string& id) {
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 @@ HttpError HttpClient::ReadCacheBody(const std::string& id) {
&& 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) {

View File

@ -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 @@ private:
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_;

View File

@ -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 @@ struct HttpData {
typedef HeaderMap::iterator iterator;
HttpVersion version;
scoped_ptr<StreamInterface> document;
std::unique_ptr<StreamInterface> document;
HttpData();

View File

@ -12,6 +12,8 @@
#define WEBRTC_BASE_HTTPSERVER_H__
#include <map>
#include <memory>
#include "webrtc/base/httpbase.h"
namespace rtc {
@ -127,7 +129,7 @@ private:
void OnConnectionClosed(HttpServer* server, int connection_id,
StreamInterface* stream);
scoped_ptr<AsyncSocket> listener_;
std::unique_ptr<AsyncSocket> listener_;
};
//////////////////////////////////////////////////////////////////////

View File

@ -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 @@ class ConfigParser {
virtual bool ParseLine(std::string* key, std::string* value);
private:
scoped_ptr<StreamInterface> instream_;
std::unique_ptr<StreamInterface> instream_;
};
//////////////////////////////////////////////////////////////////////////////

View File

@ -42,7 +42,6 @@ static const char kLibjingle[] = "libjingle";
#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"

View File

@ -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 @@ class FileRotatingLogSink : public LogSink {
explicit FileRotatingLogSink(FileRotatingStream* stream);
private:
scoped_ptr<FileRotatingStream> stream_;
std::unique_ptr<FileRotatingStream> stream_;
RTC_DISALLOW_COPY_AND_ASSIGN(FileRotatingLogSink);
};

View File

@ -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"

View File

@ -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 @@ class MacIfAddrsConverter : public IfAddrsConverter {
}
private:
rtc::scoped_ptr<IPv6AttributesGetter> ip_attribute_getter_;
std::unique_ptr<IPv6AttributesGetter> ip_attribute_getter_;
};
} // namespace

View File

@ -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 @@ class MacAsyncSocketTest : public SocketTest {
virtual MacBaseSocketServer* CreateSocketServer() {
return new MacCFSocketServer();
};
rtc::scoped_ptr<MacBaseSocketServer> server_;
std::unique_ptr<MacBaseSocketServer> server_;
SocketServerScope scope_;
};

View File

@ -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 @@ bool ToUtf8(const CFStringRef str16, std::string* str8) {
}
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;

View File

@ -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(MessageDigest* digest, const void* input, size_t in_len,
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 @@ std::string ComputeDigest(MessageDigest* digest, const std::string& input) {
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 @@ size_t ComputeHmac(MessageDigest* digest,
}
// 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 @@ size_t ComputeHmac(MessageDigest* digest,
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(MessageDigest* digest,
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 @@ size_t ComputeHmac(const std::string& alg, const void* key, size_t key_len,
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 @@ std::string ComputeHmac(MessageDigest* digest, const std::string& key,
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;
}

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_BASE_MESSAGEHANDLER_H_
#define WEBRTC_BASE_MESSAGEHANDLER_H_
#include <memory>
#include <utility>
#include "webrtc/base/constructormagic.h"

View File

@ -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 @@ template <class T>
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 @@ class MessageQueue {
// 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);

View File

@ -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 @@ TEST(MultipartTest, TestAddAndRead) {
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));

View File

@ -9,6 +9,7 @@
*/
#include <algorithm>
#include <memory>
#include <string>
#include "webrtc/base/gunit.h"
@ -178,11 +179,11 @@ bool TestConnectivity(const SocketAddress& src, const IPAddress& dst) {
// 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 @@ void TestPhysicalInternal(const SocketAddress& int_addr) {
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 @@ class TestVirtualSocketServer : public VirtualSocketServer {
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 @@ class NatTcpTest : public testing::Test, public sigslot::has_slots<> {
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 @@ TEST_F(NatTcpTest, DISABLED_TestConnectOut) {
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";

View File

@ -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 @@ void NATServer::OnExternalUDPPacket(
// 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);

View File

@ -141,7 +141,7 @@ class NATSocket : public AsyncSocket, public sigslot::has_slots<> {
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);

View File

@ -13,6 +13,7 @@
#include <string>
#include <map>
#include <memory>
#include <set>
#include "webrtc/base/natserver.h"
@ -116,8 +117,8 @@ class NATSocketServer : public SocketServer, public NATInternalSocketFactory {
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_;
};

View File

@ -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 @@ bool HasIPv6Enabled() {
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};

View File

@ -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 @@ void BasicNetworkManager::ConvertIfAddrs(struct ifaddrs* interfaces,
}
#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 @@ bool BasicNetworkManager::CreateNetworks(bool include_ignored,
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 @@ bool BasicNetworkManager::CreateNetworks(bool include_ignored,
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 @@ bool BasicNetworkManager::CreateNetworks(bool include_ignored,
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 @@ bool BasicNetworkManager::CreateNetworks(bool include_ignored,
// 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 @@ IPAddress BasicNetworkManager::QueryDefaultLocalAddress(int family) const {
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";

View File

@ -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 @@ class NetworkManagerBase : public NetworkManager {
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 @@ class BasicNetworkManager : public NetworkManagerBase,
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.

View File

@ -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 @@ class NetworkTest : public testing::Test, public sigslot::has_slots<> {
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);
}

View File

@ -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"

View File

@ -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"

View File

@ -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 @@ bool OpenSSLCertificate::GetSignatureDigestAlgorithm(
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 @@ OpenSSLIdentity* OpenSSLIdentity::GenerateForTest(
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.";

View File

@ -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 @@ class OpenSSLCertificate : public SSLCertificate {
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 @@ class OpenSSLIdentity : public SSLIdentity {
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);
};

View File

@ -22,6 +22,7 @@
#include <openssl/dtls1.h>
#endif
#include <memory>
#include <vector>
#include "webrtc/base/common.h"
@ -293,9 +294,9 @@ void OpenSSLStreamAdapter::SetServerRole(SSLRole role) {
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;
}

View File

@ -12,6 +12,7 @@
#define WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__
#include <string>
#include <memory>
#include <vector>
#include "webrtc/base/buffer.h"
@ -69,7 +70,7 @@ class OpenSSLStreamAdapter : public SSLStreamAdapter {
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 @@ class OpenSSLStreamAdapter : public SSLStreamAdapter {
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_;

View File

@ -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 @@ class Logger {
}
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;

View File

@ -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 @@ class OptionsFileTest : public testing::Test {
store_.reset(new OptionsFile(test_file_));
}
rtc::scoped_ptr<OptionsFile> store_;
std::unique_ptr<OptionsFile> store_;
private:
std::string test_file_;

View File

@ -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 @@ class PhysicalSocketServer : public SocketServer {
#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_;

View File

@ -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 @@ class PhysicalSocketTest : public SocketTest {
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 @@ void PhysicalSocketTest::ConnectInternalAcceptError(const IPAddress& loopback) {
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 @@ void PhysicalSocketTest::ConnectInternalAcceptError(const IPAddress& loopback) {
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 @@ void PhysicalSocketTest::ConnectInternalAcceptError(const IPAddress& loopback) {
// 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 @@ class PosixSignalDeliveryTest : public testing::Test {
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 @@ TEST_F(PosixSignalDeliveryTest, SignalOnDifferentThread) {
// 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));

View File

@ -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 {

View File

@ -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 {

View File

@ -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 @@ class ProxyTest : public testing::Test {
}
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.

View File

@ -29,6 +29,7 @@
#endif
#include <map>
#include <memory>
#include "webrtc/base/arraysize.h"
#include "webrtc/base/fileutils.h"
@ -430,7 +431,7 @@ bool GetDefaultFirefoxProfile(Pathname* profile_path) {
// 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 GetDefaultFirefoxProfile(Pathname* profile_path) {
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;

View File

@ -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 @@ class ProxyBinding : public sigslot::has_slots<> {
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 @@ class ProxyServer : public sigslot::has_slots<> {
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);
};

View File

@ -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 @@ class RateStatistics {
// 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_;

View File

@ -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 @@ class ReferenceCountedSingletonFactory {
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() {

View File

@ -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());
}

View File

@ -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 @@ namespace rtc {
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 @@ class RTCCertificate : public RefCountInterface {
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

View File

@ -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 @@ class RTCCertificateTest : public testing::Test {
// 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 @@ class RTCCertificateTest : public testing::Test {
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));

View File

@ -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 @@ RTCCertificateGenerator::GenerateCertificate(
}
if (!identity)
return nullptr;
scoped_ptr<SSLIdentity> identity_sptr(identity);
std::unique_ptr<SSLIdentity> identity_sptr(identity);
return RTCCertificate::Create(std::move(identity_sptr));
}

View File

@ -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 @@ class RTCCertificateGeneratorFixture : public RTCCertificateGeneratorCallback {
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_;
};

View File

@ -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 @@ class ScopedPtrCollectionTest : public testing::Test {
}
int num_instances_;
scoped_ptr<ScopedPtrCollection<InstanceCounter> > collection_;
std::unique_ptr<ScopedPtrCollection<InstanceCounter> > collection_;
};
TEST_F(ScopedPtrCollectionTest, PushBack) {

View File

@ -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 @@ class SharedExclusiveTask : public MessageHandler {
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 @@ class SharedExclusiveLockTest
}
protected:
scoped_ptr<SharedExclusiveLock> shared_exclusive_lock_;
std::unique_ptr<SharedExclusiveLock> shared_exclusive_lock_;
int value_;
};

View File

@ -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 @@ class OwnerThread : public Thread, public sigslot::has_slots<> {
// 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()) {

View File

@ -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 @@ void SocketTest::ConnectInternal(const IPAddress& loopback) {
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 @@ void SocketTest::ConnectInternal(const IPAddress& loopback) {
// 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 @@ void SocketTest::ConnectWithDnsLookupInternal(const IPAddress& loopback,
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 @@ void SocketTest::ConnectWithDnsLookupInternal(const IPAddress& loopback,
// 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 @@ void SocketTest::ConnectFailInternal(const IPAddress& loopback) {
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 @@ void SocketTest::ConnectWithDnsLookupFailInternal(const IPAddress& loopback) {
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::ConnectWithDnsLookupFailInternal(const IPAddress& loopback) {
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::ConnectWithClosedSocketInternal(const IPAddress& loopback) {
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 @@ void SocketTest::ConnectWhileNotClosedInternal(const IPAddress& loopback) {
// 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 @@ void SocketTest::ServerCloseDuringConnectInternal(const IPAddress& loopback) {
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 @@ void SocketTest::ClientCloseDuringConnectInternal(const IPAddress& loopback) {
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 @@ void SocketTest::ClientCloseDuringConnectInternal(const IPAddress& loopback) {
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 @@ void SocketTest::ServerCloseInternal(const IPAddress& loopback) {
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 @@ void SocketTest::ServerCloseInternal(const IPAddress& loopback) {
// 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 @@ void SocketTest::CloseInClosedCallbackInternal(const IPAddress& loopback) {
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 @@ void SocketTest::CloseInClosedCallbackInternal(const IPAddress& loopback) {
// 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 @@ void SocketTest::SocketServerWaitInternal(const IPAddress& loopback) {
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 @@ void SocketTest::SocketServerWaitInternal(const IPAddress& loopback) {
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 @@ void SocketTest::SocketServerWaitInternal(const IPAddress& loopback) {
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 @@ void SocketTest::TcpInternal(const IPAddress& loopback, size_t data_size,
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 @@ void SocketTest::TcpInternal(const IPAddress& loopback, size_t data_size,
// 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 @@ void SocketTest::SingleFlowControlCallbackInternal(const IPAddress& loopback) {
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 @@ void SocketTest::SingleFlowControlCallbackInternal(const IPAddress& loopback) {
// 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 @@ void SocketTest::UdpInternal(const IPAddress& loopback) {
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 @@ void SocketTest::UdpReadyToSend(const IPAddress& loopback) {
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::UdpReadyToSend(const IPAddress& loopback) {
}
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 @@ void SocketTest::GetSetOptionsInternal(const IPAddress& loopback) {
// 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

View File

@ -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 @@ class SSLAdapterTestDummyClient : public sigslot::has_slots<> {
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 @@ class SSLAdapterTestDummyServer : public sigslot::has_slots<> {
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 @@ class SSLAdapterTestBase : public testing::Test,
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_;
};

View File

@ -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 @@ class SSLCertificate {
// 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;

View File

@ -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 @@ class SSLIdentityTest : public testing::Test {
}
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 @@ TEST_F(SSLIdentityTest, FromPEMStringsRSA) {
"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 @@ TEST_F(SSLIdentityTest, FromPEMStringsEC) {
"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());

View File

@ -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 @@ AsyncSocket* SslSocketFactory::CreateProxySocket(const ProxyInfo& proxy,
}
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;

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_BASE_SSLSTREAMADAPTER_H_
#define WEBRTC_BASE_SSLSTREAMADAPTER_H_
#include <memory>
#include <string>
#include <vector>
@ -159,7 +160,7 @@ class SSLStreamAdapter : public StreamAdapterInterface {
// 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").

View File

@ -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 @@ class SSLStreamAdapterTestBase : public testing::Test,
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 @@ class SSLStreamAdapterTestBase : public testing::Test,
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 @@ TEST_F(SSLStreamAdapterTestDTLSFromPEMStrings, TestDTLSGetPeerCertificate) {
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 @@ TEST_F(SSLStreamAdapterTestDTLSFromPEMStrings, TestDTLSGetPeerCertificate) {
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);

View File

@ -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 @@ class StreamTap : public StreamAdapterInterface {
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 @@ class FifoBuffer : public StreamInterface {
// 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

View File

@ -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"

View File

@ -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 @@ class TaskParent {
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);
};

View File

@ -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"

View File

@ -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 @@ class TestEchoServer : public sigslot::has_slots<> {
}
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);
};

View File

@ -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 @@ private:
void OnCloseEvent(AsyncSocket* socket, int error) {
}
scoped_ptr<AsyncSocket> socket_;
std::unique_ptr<AsyncSocket> socket_;
Buffer send_buffer_, recv_buffer_;
};
@ -414,7 +415,7 @@ class SocketTestServer : public sigslot::has_slots<> {
clients_.push_back(new SocketTestClient(accepted));
}
scoped_ptr<AsyncSocket> socket_;
std::unique_ptr<AsyncSocket> socket_;
std::vector<SocketTestClient*> clients_;
};

View File

@ -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 @@ class DeleteThreadCheckerClassOnThread : public Thread {
}
private:
scoped_ptr<ThreadCheckerClass> thread_checker_class_;
std::unique_ptr<ThreadCheckerClass> thread_checker_class_;
RTC_DISALLOW_COPY_AND_ASSIGN(DeleteThreadCheckerClassOnThread);
};
@ -99,7 +100,7 @@ class DeleteThreadCheckerClassOnThread : public Thread {
} // 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, CallsAllowedOnSameThread) {
}
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, DestructorAllowedOnDifferentThread) {
}
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 @@ TEST(ThreadCheckerTest, DetachFromThread) {
#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 @@ TEST(ThreadCheckerTest, MethodAllowedOnDifferentThreadInRelease) {
#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

View File

@ -589,17 +589,18 @@ class GuardedAsyncInvokeTest : public testing::Test {
// 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_F(GuardedAsyncInvokeTest, KillThreadFireAndForget) {
// 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|.

View File

@ -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 @@ struct Sender : public MessageHandler {
}
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 @@ struct Receiver : public MessageHandler, public sigslot::has_slots<> {
}
Thread* thread;
scoped_ptr<AsyncUDPSocket> socket;
std::unique_ptr<AsyncUDPSocket> socket;
uint32_t bandwidth;
bool done;
size_t count;
@ -345,11 +347,11 @@ class VirtualSocketServerTest : public testing::Test {
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 @@ class VirtualSocketServerTest : public testing::Test {
// 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 @@ class VirtualSocketServerTest : public testing::Test {
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());

View File

@ -15,6 +15,7 @@
#include <algorithm>
#include <map>
#include <memory>
#include <vector>
#include "webrtc/base/checks.h"
@ -771,7 +772,7 @@ int VirtualSocketServer::SendUdp(VirtualSocket* socket,
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())) {

View File

@ -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 @@ bool Win32Filesystem::CreatePrivateFile(const Pathname &filename) {
&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 @@ bool Win32Filesystem::CreatePrivateFile(const Pathname &filename) {
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 @@ bool Win32Filesystem::GetDiskFreeSpace(const Pathname& path,
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) {

View File

@ -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 @@ HRESULT RegKey::GetValue(const wchar_t* full_key_name,
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 @@ HRESULT RegKey::GetValue(const wchar_t* full_key_name,
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 @@ HRESULT RegKey::GetValue(const wchar_t* full_key_name,
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());
}

View File

@ -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 @@ TEST(WindowPickerTest, GetWindowList) {
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 @@ TEST(WindowPickerTest, DISABLE_ON_MAC(GetDesktopList)) {
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;

Some files were not shown because too many files have changed in this diff Show More