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