Replace scoped_ptr with unique_ptr everywhere

But keep #including scoped_ptr.h in .h files, so as not to break
WebRTC users who expect those .h files to give them rtc::scoped_ptr.

BUG=webrtc:5520

Review-Url: https://codereview.webrtc.org/1937693002
Cr-Commit-Position: refs/heads/master@{#12581}
This commit is contained in:
kwiberg
2016-05-01 14:53:46 -07:00
committed by Commit bot
parent e319059de2
commit bfefb03ec1
75 changed files with 230 additions and 158 deletions

View File

@ -43,7 +43,7 @@
+ (RTCVideoCapturer*)capturerWithDeviceName:(NSString*)deviceName {
cricket::WebRtcVideoDeviceCapturerFactory factory;
cricket::Device device(std::string(deviceName.UTF8String), 0);
rtc::scoped_ptr<cricket::VideoCapturer> capturer(factory.Create(device));
std::unique_ptr<cricket::VideoCapturer> capturer(factory.Create(device));
RTCVideoCapturer* rtcCapturer =
[[RTCVideoCapturer alloc] initWithCapturer:capturer.release()];
return rtcCapturer;

View File

@ -11,13 +11,13 @@
#include "webrtc/api/quicdatachannel.h"
#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
#include "webrtc/base/bind.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/p2p/base/faketransportcontroller.h"
#include "webrtc/p2p/quic/quictransportchannel.h"
@ -66,7 +66,7 @@ static const DataBuffer kOversizedBuffer(kOversizedMessage);
static rtc::SSLFingerprint* CreateFingerprint(rtc::RTCCertificate* cert) {
std::string digest_algorithm;
cert->ssl_certificate().GetSignatureDigestAlgorithm(&digest_algorithm);
rtc::scoped_ptr<rtc::SSLFingerprint> fingerprint(
std::unique_ptr<rtc::SSLFingerprint> fingerprint(
rtc::SSLFingerprint::Create(digest_algorithm, cert->identity()));
return fingerprint.release();
}
@ -176,7 +176,7 @@ class QuicDataChannelPeer {
void GenerateCertificateAndFingerprint() {
rtc::scoped_refptr<rtc::RTCCertificate> local_cert =
rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>(
rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
rtc::SSLIdentity::Generate("cert_name", rtc::KT_DEFAULT)));
quic_transport_channel_.SetLocalCertificate(local_cert);
local_fingerprint_.reset(CreateFingerprint(local_cert.get()));
@ -206,7 +206,7 @@ class QuicDataChannelPeer {
ice_transport_channel_->SetDestination(other_peer->ice_transport_channel_);
}
rtc::scoped_ptr<rtc::SSLFingerprint>& local_fingerprint() {
std::unique_ptr<rtc::SSLFingerprint>& local_fingerprint() {
return local_fingerprint_;
}
@ -222,7 +222,7 @@ class QuicDataChannelPeer {
FakeTransportChannel* ice_transport_channel_;
QuicTransportChannel quic_transport_channel_;
rtc::scoped_ptr<rtc::SSLFingerprint> local_fingerprint_;
std::unique_ptr<rtc::SSLFingerprint> local_fingerprint_;
FakeQuicDataTransport fake_quic_data_transport_;
};
@ -248,9 +248,9 @@ class QuicDataChannelTest : public testing::Test {
peer1_.quic_transport_channel()->SetSslRole(rtc::SSL_CLIENT);
peer2_.quic_transport_channel()->SetSslRole(rtc::SSL_SERVER);
rtc::scoped_ptr<rtc::SSLFingerprint>& peer1_fingerprint =
std::unique_ptr<rtc::SSLFingerprint>& peer1_fingerprint =
peer1_.local_fingerprint();
rtc::scoped_ptr<rtc::SSLFingerprint>& peer2_fingerprint =
std::unique_ptr<rtc::SSLFingerprint>& peer2_fingerprint =
peer2_.local_fingerprint();
peer1_.quic_transport_channel()->SetRemoteFingerprint(

View File

@ -10,6 +10,7 @@
#include "webrtc/api/quicdatatransport.h"
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
@ -71,7 +72,7 @@ class QuicDataTransportPeer {
void GenerateCertificateAndFingerprint() {
rtc::scoped_refptr<rtc::RTCCertificate> local_cert =
rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>(
rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
rtc::SSLIdentity::Generate("cert_name", rtc::KT_DEFAULT)));
quic_transport_channel_.SetLocalCertificate(local_cert);
local_fingerprint_.reset(CreateFingerprint(local_cert.get()));
@ -84,7 +85,7 @@ class QuicDataTransportPeer {
ice_transport_channel_->SetDestination(other_peer->ice_transport_channel_);
}
rtc::scoped_ptr<rtc::SSLFingerprint>& local_fingerprint() {
std::unique_ptr<rtc::SSLFingerprint>& local_fingerprint() {
return local_fingerprint_;
}
@ -116,7 +117,7 @@ class QuicDataTransportPeer {
rtc::SSLFingerprint* CreateFingerprint(rtc::RTCCertificate* cert) {
std::string digest_algorithm;
cert->ssl_certificate().GetSignatureDigestAlgorithm(&digest_algorithm);
rtc::scoped_ptr<rtc::SSLFingerprint> fingerprint(
std::unique_ptr<rtc::SSLFingerprint> fingerprint(
rtc::SSLFingerprint::Create(digest_algorithm, cert->identity()));
return fingerprint.release();
}
@ -124,7 +125,7 @@ class QuicDataTransportPeer {
QuicDataTransport quic_data_transport_;
FakeTransportChannel* ice_transport_channel_;
QuicTransportChannel quic_transport_channel_;
rtc::scoped_ptr<rtc::SSLFingerprint> local_fingerprint_;
std::unique_ptr<rtc::SSLFingerprint> local_fingerprint_;
};
class QuicDataTransportTest : public testing::Test {
@ -154,9 +155,9 @@ class QuicDataTransportTest : public testing::Test {
peer1_.quic_transport_channel()->SetSslRole(rtc::SSL_CLIENT);
peer2_.quic_transport_channel()->SetSslRole(rtc::SSL_SERVER);
rtc::scoped_ptr<rtc::SSLFingerprint>& peer1_fingerprint =
std::unique_ptr<rtc::SSLFingerprint>& peer1_fingerprint =
peer1_.local_fingerprint();
rtc::scoped_ptr<rtc::SSLFingerprint>& peer2_fingerprint =
std::unique_ptr<rtc::SSLFingerprint>& peer2_fingerprint =
peer2_.local_fingerprint();
peer1_.quic_transport_channel()->SetRemoteFingerprint(

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_AUDIO_SEND_STREAM_H_
#define WEBRTC_AUDIO_SEND_STREAM_H_
#include <memory>
#include <string>
#include <vector>
@ -84,7 +85,7 @@ class AudioSendStream : public SendStream {
// Ownership of the encoder object is transferred to Call when the config is
// passed to Call::CreateAudioSendStream().
// TODO(solenberg): Implement, once we configure codecs through the new API.
// rtc::scoped_ptr<AudioEncoder> encoder;
// std::unique_ptr<AudioEncoder> encoder;
int cng_payload_type = -1; // pt, or -1 to disable Comfort Noise Generator.
int red_payload_type = -1; // pt, or -1 to disable REDundant coding.
};

View File

@ -12,6 +12,7 @@
#define WEBRTC_BASE_OPTIONAL_H_
#include <algorithm>
#include <memory>
#include <utility>
#include "webrtc/base/checks.h"
@ -21,7 +22,7 @@ namespace rtc {
// Simple std::experimental::optional-wannabe. It either contains a T or not.
// In order to keep the implementation simple and portable, this implementation
// actually contains a (default-constructed) T even when it supposedly doesn't
// contain a value; use e.g. rtc::scoped_ptr<T> instead if that's too
// contain a value; use e.g. std::unique_ptr<T> instead if that's too
// expensive.
//
// A moved-from Optional<T> may only be destroyed, and assigned to if T allows

View File

@ -33,7 +33,7 @@ namespace rtc {
template <typename T, typename Deleter = std::default_delete<T>>
using scoped_ptr = std::unique_ptr<T, Deleter>;
// These used to convert between rtc::scoped_ptr and std::unique_ptr. Now they
// These used to convert between std::unique_ptr and std::unique_ptr. Now they
// are no-ops.
template <typename T>
std::unique_ptr<T> ScopedToUnique(std::unique_ptr<T> up) {

View File

@ -13,6 +13,7 @@
#include <algorithm>
#include <list>
#include <memory>
#include <string>
#include <vector>

View File

@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "webrtc/base/asyncinvoker.h"
#include "webrtc/base/asyncudpsocket.h"
#include "webrtc/base/event.h"

View File

@ -11,6 +11,8 @@
#define WEBRTC_COMMON_AUDIO_AUDIO_RING_BUFFER_H_
#include <stddef.h>
#include <memory>
#include <vector>
struct RingBuffer;

View File

@ -21,11 +21,11 @@ using std::complex;
const size_t RealFourier::kFftBufferAlignment = 32;
rtc::scoped_ptr<RealFourier> RealFourier::Create(int fft_order) {
std::unique_ptr<RealFourier> RealFourier::Create(int fft_order) {
#if defined(RTC_USE_OPENMAX_DL)
return rtc::scoped_ptr<RealFourier>(new RealFourierOpenmax(fft_order));
return std::unique_ptr<RealFourier>(new RealFourierOpenmax(fft_order));
#else
return rtc::scoped_ptr<RealFourier>(new RealFourierOoura(fft_order));
return std::unique_ptr<RealFourier>(new RealFourierOoura(fft_order));
#endif
}

View File

@ -12,6 +12,7 @@
#define WEBRTC_COMMON_AUDIO_REAL_FOURIER_H_
#include <complex>
#include <memory>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/system_wrappers/include/aligned_malloc.h"
@ -25,8 +26,8 @@ namespace webrtc {
class RealFourier {
public:
// Shorthand typenames for the scopers used by the buffer allocation helpers.
typedef rtc::scoped_ptr<float[], AlignedFreeDeleter> fft_real_scoper;
typedef rtc::scoped_ptr<std::complex<float>[], AlignedFreeDeleter>
typedef std::unique_ptr<float[], AlignedFreeDeleter> fft_real_scoper;
typedef std::unique_ptr<std::complex<float>[], AlignedFreeDeleter>
fft_cplx_scoper;
// The alignment required for all input and output buffers, in bytes.
@ -34,7 +35,7 @@ class RealFourier {
// Construct a wrapper instance for the given input order, which must be
// between 1 and kMaxFftOrder, inclusively.
static rtc::scoped_ptr<RealFourier> Create(int fft_order);
static std::unique_ptr<RealFourier> Create(int fft_order);
virtual ~RealFourier() {};
// Helper to compute the smallest FFT order (a power of 2) which will contain

View File

@ -10,6 +10,8 @@
#include "webrtc/common_audio/vad/include/vad.h"
#include <memory>
#include "webrtc/base/checks.h"
namespace webrtc {

View File

@ -10,6 +10,7 @@
#include "webrtc/examples/peerconnection/client/conductor.h"
#include <memory>
#include <utility>
#include <vector>
@ -308,7 +309,7 @@ void Conductor::OnMessageFromPeer(int peer_id, const std::string& message) {
return;
}
webrtc::SdpParseError error;
rtc::scoped_ptr<webrtc::IceCandidateInterface> candidate(
std::unique_ptr<webrtc::IceCandidateInterface> candidate(
webrtc::CreateIceCandidate(sdp_mid, sdp_mlineindex, sdp, &error));
if (!candidate.get()) {
LOG(WARNING) << "Can't parse received candidate message. "

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_
#define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_
#include <memory>
#include <string>
#include "webrtc/examples/peerconnection/client/main_wnd.h"
@ -92,7 +93,7 @@ class GtkMainWnd : public MainWindow {
protected:
void SetSize(int width, int height);
rtc::scoped_ptr<uint8_t[]> image_;
std::unique_ptr<uint8_t[]> image_;
int width_;
int height_;
GtkMainWnd* main_wnd_;
@ -111,9 +112,9 @@ class GtkMainWnd : public MainWindow {
std::string port_;
bool autoconnect_;
bool autocall_;
rtc::scoped_ptr<VideoRenderer> local_renderer_;
rtc::scoped_ptr<VideoRenderer> remote_renderer_;
rtc::scoped_ptr<uint8_t[]> draw_buffer_;
std::unique_ptr<VideoRenderer> local_renderer_;
std::unique_ptr<VideoRenderer> remote_renderer_;
std::unique_ptr<uint8_t[]> draw_buffer_;
int draw_buffer_size_;
};

View File

@ -13,6 +13,7 @@
#pragma once
#include <map>
#include <memory>
#include <string>
#include "webrtc/api/mediastreaminterface.h"
@ -131,7 +132,7 @@ class MainWnd : public MainWindow {
HWND wnd_;
BITMAPINFO bmi_;
rtc::scoped_ptr<uint8_t[]> image_;
std::unique_ptr<uint8_t[]> image_;
CRITICAL_SECTION buffer_lock_;
rtc::scoped_refptr<webrtc::VideoTrackInterface> rendered_track_;
};
@ -176,8 +177,8 @@ class MainWnd : public MainWindow {
void HandleTabbing();
private:
rtc::scoped_ptr<VideoRenderer> local_renderer_;
rtc::scoped_ptr<VideoRenderer> remote_renderer_;
std::unique_ptr<VideoRenderer> local_renderer_;
std::unique_ptr<VideoRenderer> remote_renderer_;
UI ui_;
HWND wnd_;
DWORD ui_thread_id_;

View File

@ -13,6 +13,7 @@
#pragma once
#include <map>
#include <memory>
#include <string>
#include "webrtc/base/nethelpers.h"
@ -109,8 +110,8 @@ class PeerConnectionClient : public sigslot::has_slots<>,
PeerConnectionClientObserver* callback_;
rtc::SocketAddress server_address_;
rtc::AsyncResolver* resolver_;
rtc::scoped_ptr<rtc::AsyncSocket> control_socket_;
rtc::scoped_ptr<rtc::AsyncSocket> hanging_get_;
std::unique_ptr<rtc::AsyncSocket> control_socket_;
std::unique_ptr<rtc::AsyncSocket> hanging_get_;
std::string onconnect_data_;
std::string control_data_;
std::string notification_data_;

View File

@ -9,9 +9,9 @@
*/
#include <iostream> // NOLINT
#include <memory>
#include "webrtc/p2p/base/relayserver.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread.h"
int main(int argc, char **argv) {
@ -35,7 +35,7 @@ int main(int argc, char **argv) {
rtc::Thread *pthMain = rtc::Thread::Current();
rtc::scoped_ptr<rtc::AsyncUDPSocket> int_socket(
std::unique_ptr<rtc::AsyncUDPSocket> int_socket(
rtc::AsyncUDPSocket::Create(pthMain->socketserver(), int_addr));
if (!int_socket) {
std::cerr << "Failed to create a UDP socket bound at"
@ -43,7 +43,7 @@ int main(int argc, char **argv) {
return 1;
}
rtc::scoped_ptr<rtc::AsyncUDPSocket> ext_socket(
std::unique_ptr<rtc::AsyncUDPSocket> ext_socket(
rtc::AsyncUDPSocket::Create(pthMain->socketserver(), ext_addr));
if (!ext_socket) {
std::cerr << "Failed to create a UDP socket bound at"

View File

@ -10,6 +10,7 @@
#include <limits.h> // For INT_MAX
#include <memory>
#include <string>
#include <vector>

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_MEDIA_BASE_VIDEOBROADCASTER_H_
#define WEBRTC_MEDIA_BASE_VIDEOBROADCASTER_H_
#include <memory>
#include <utility>
#include <vector>
@ -55,7 +56,7 @@ class VideoBroadcaster : public VideoSourceBase,
rtc::CriticalSection sinks_and_wants_lock_;
VideoSinkWants current_wants_ GUARDED_BY(sinks_and_wants_lock_);
rtc::scoped_ptr<cricket::WebRtcVideoFrame> black_frame_;
std::unique_ptr<cricket::WebRtcVideoFrame> black_frame_;
};
} // namespace rtc

View File

@ -9,6 +9,8 @@
*/
#include <stdio.h>
#include <memory>
#include <vector>
#include "webrtc/base/gunit.h"
@ -40,7 +42,7 @@ class VideoCapturerTest
protected:
void InitCapturer(bool is_screencast) {
capturer_ = rtc::scoped_ptr<FakeVideoCapturer>(
capturer_ = std::unique_ptr<FakeVideoCapturer>(
new FakeVideoCapturer(is_screencast));
capturer_->SignalStateChange.connect(this,
&VideoCapturerTest::OnStateChange);
@ -56,7 +58,7 @@ class VideoCapturerTest
cricket::CaptureState capture_state() { return capture_state_; }
int num_state_changes() { return num_state_changes_; }
rtc::scoped_ptr<cricket::FakeVideoCapturer> capturer_;
std::unique_ptr<cricket::FakeVideoCapturer> capturer_;
cricket::CaptureState capture_state_;
int num_state_changes_;
cricket::FakeVideoRenderer renderer_;

View File

@ -11,6 +11,8 @@
#ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_
#define WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_
#include <memory>
#include "webrtc/base/common.h"
#include "webrtc/media/engine/webrtccommon.h"

View File

@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h"

View File

@ -14,6 +14,7 @@
#include <string.h> // size_t
#include <list>
#include <memory>
#include "webrtc/base/constructormagic.h"
#include "webrtc/modules/audio_coding/neteq/tick_timer.h"

View File

@ -412,7 +412,7 @@ bool Transport::VerifyCertificateFingerprint(
return BadTransportDescription(
"Fingerprint provided but no identity available.", error_desc);
}
rtc::scoped_ptr<rtc::SSLFingerprint> fp_tmp(rtc::SSLFingerprint::Create(
std::unique_ptr<rtc::SSLFingerprint> fp_tmp(rtc::SSLFingerprint::Create(
fingerprint->algorithm, certificate->identity()));
ASSERT(fp_tmp.get() != NULL);
if (*fp_tmp == *fingerprint) {

View File

@ -245,7 +245,7 @@ TEST_F(TransportTest, TestVerifyCertificateFingerprint) {
for (auto& key_type : key_types) {
rtc::scoped_refptr<rtc::RTCCertificate> certificate =
rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>(
rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
rtc::SSLIdentity::Generate("testing", key_type)));
ASSERT_NE(nullptr, certificate);
@ -253,7 +253,7 @@ TEST_F(TransportTest, TestVerifyCertificateFingerprint) {
ASSERT_TRUE(certificate->ssl_certificate().GetSignatureDigestAlgorithm(
&digest_algorithm));
ASSERT_FALSE(digest_algorithm.empty());
rtc::scoped_ptr<rtc::SSLFingerprint> good_fingerprint(
std::unique_ptr<rtc::SSLFingerprint> good_fingerprint(
rtc::SSLFingerprint::Create(digest_algorithm, certificate->identity()));
ASSERT_NE(nullptr, good_fingerprint);

View File

@ -13,6 +13,7 @@
#include <string>
#include <map>
#include <memory>
#include "webrtc/p2p/base/transport.h"
#include "webrtc/p2p/quic/quictransportchannel.h"
@ -55,7 +56,7 @@ class QuicTransport : public Transport {
private:
rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_;
rtc::SSLRole local_role_ = rtc::SSL_CLIENT;
rtc::scoped_ptr<rtc::SSLFingerprint> remote_fingerprint_;
std::unique_ptr<rtc::SSLFingerprint> remote_fingerprint_;
};
} // namespace cricket

View File

@ -10,6 +10,7 @@
#include "webrtc/p2p/quic/quictransport.h"
#include <memory>
#include <string>
#include <vector>
@ -30,15 +31,15 @@ static const char kIcePwd2[] = "TESTICEPWD00000000000002";
static rtc::scoped_refptr<rtc::RTCCertificate> CreateCertificate(
std::string name) {
return rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>(
return rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
rtc::SSLIdentity::Generate(name, rtc::KT_DEFAULT)));
}
static rtc::scoped_ptr<rtc::SSLFingerprint> CreateFingerprint(
static std::unique_ptr<rtc::SSLFingerprint> CreateFingerprint(
rtc::RTCCertificate* cert) {
std::string digest_algorithm;
cert->ssl_certificate().GetSignatureDigestAlgorithm(&digest_algorithm);
return rtc::scoped_ptr<rtc::SSLFingerprint>(
return std::unique_ptr<rtc::SSLFingerprint>(
rtc::SSLFingerprint::Create(digest_algorithm, cert->identity()));
}
@ -59,7 +60,7 @@ class QuicTransportTest : public testing::Test {
ASSERT_NE(nullptr, local_certificate);
transport_.SetLocalCertificate(local_certificate);
rtc::scoped_ptr<rtc::SSLFingerprint> local_fingerprint =
std::unique_ptr<rtc::SSLFingerprint> local_fingerprint =
CreateFingerprint(local_certificate.get());
ASSERT_NE(nullptr, local_fingerprint);
TransportDescription local_desc(std::vector<std::string>(), kIceUfrag1,
@ -73,11 +74,11 @@ class QuicTransportTest : public testing::Test {
channel->GetLocalCertificate();
ASSERT_NE(nullptr, channel_local_certificate);
EXPECT_EQ(local_certificate, channel_local_certificate);
rtc::scoped_ptr<rtc::SSLFingerprint> remote_fingerprint =
std::unique_ptr<rtc::SSLFingerprint> remote_fingerprint =
CreateFingerprint(CreateCertificate("remote").get());
// NegotiateTransportDescription was not called yet. The SSL role should
// not be set and neither should the remote fingerprint.
rtc::scoped_ptr<rtc::SSLRole> role(new rtc::SSLRole());
std::unique_ptr<rtc::SSLRole> role(new rtc::SSLRole());
EXPECT_FALSE(channel->GetSslRole(role.get()));
// Setting the remote description should set the SSL role.
ASSERT_NE(nullptr, remote_fingerprint);

View File

@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include <sstream>
#include "libyuv/cpu_id.h"

View File

@ -12,7 +12,7 @@
#import "NSString+StdString.h"
#include "webrtc/base/scoped_ptr.h"
#include <memory>
namespace webrtc {
@ -46,7 +46,7 @@ class DataChannelDelegateAdapter : public DataChannelObserver {
@implementation RTCDataBuffer {
rtc::scoped_ptr<webrtc::DataBuffer> _dataBuffer;
std::unique_ptr<webrtc::DataBuffer> _dataBuffer;
}
- (instancetype)initWithData:(NSData *)data isBinary:(BOOL)isBinary {
@ -86,7 +86,7 @@ class DataChannelDelegateAdapter : public DataChannelObserver {
@implementation RTCDataChannel {
rtc::scoped_refptr<webrtc::DataChannelInterface> _nativeDataChannel;
rtc::scoped_ptr<webrtc::DataChannelDelegateAdapter> _observer;
std::unique_ptr<webrtc::DataChannelDelegateAdapter> _observer;
BOOL _isObserverRegistered;
}

View File

@ -10,11 +10,12 @@
#import "WebRTC/RTCFileLogger.h"
#include <memory>
#include "webrtc/base/checks.h"
#include "webrtc/base/filerotatingstream.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/logsinks.h"
#include "webrtc/base/scoped_ptr.h"
NSString *const kDefaultLogDirName = @"webrtc_logs";
NSUInteger const kDefaultMaxFileSize = 10 * 1024 * 1024; // 10MB.
@ -24,7 +25,7 @@ const char *kRTCFileLoggerRotatingLogPrefix = "rotating_log";
BOOL _hasStarted;
NSString *_dirPath;
NSUInteger _maxFileSize;
rtc::scoped_ptr<rtc::FileRotatingLogSink> _logSink;
std::unique_ptr<rtc::FileRotatingLogSink> _logSink;
}
@synthesize severity = _severity;
@ -129,7 +130,7 @@ const char *kRTCFileLoggerRotatingLogPrefix = "rotating_log";
return nil;
}
NSMutableData* logData = [NSMutableData data];
rtc::scoped_ptr<rtc::FileRotatingStream> stream;
std::unique_ptr<rtc::FileRotatingStream> stream;
switch(_rotationType) {
case RTCFileLoggerTypeApp:
stream.reset(
@ -150,7 +151,7 @@ const char *kRTCFileLoggerRotatingLogPrefix = "rotating_log";
size_t read = 0;
// Allocate memory using malloc so we can pass it direcly to NSData without
// copying.
rtc::scoped_ptr<uint8_t[]> buffer(static_cast<uint8_t*>(malloc(bufferSize)));
std::unique_ptr<uint8_t[]> buffer(static_cast<uint8_t*>(malloc(bufferSize)));
stream->ReadAll(buffer.get(), bufferSize, &read, nullptr);
logData = [[NSMutableData alloc] initWithBytesNoCopy:buffer.release()
length:read];

View File

@ -10,6 +10,8 @@
#import "WebRTC/RTCIceCandidate.h"
#include <memory>
#include "webrtc/api/jsep.h"
#include "webrtc/base/scoped_ptr.h"
@ -22,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
* object. This is needed to pass to the underlying C++ APIs.
*/
@property(nonatomic, readonly)
rtc::scoped_ptr<webrtc::IceCandidateInterface> nativeCandidate;
std::unique_ptr<webrtc::IceCandidateInterface> nativeCandidate;
/**
* Initialize an RTCIceCandidate from a native IceCandidateInterface. No

View File

@ -10,6 +10,8 @@
#import "RTCIceCandidate+Private.h"
#include <memory>
#import "NSString+StdString.h"
#import "WebRTC/RTCLogging.h"
@ -51,7 +53,7 @@
sdpMid:[NSString stringForStdString:candidate->sdp_mid()]];
}
- (rtc::scoped_ptr<webrtc::IceCandidateInterface>)nativeCandidate {
- (std::unique_ptr<webrtc::IceCandidateInterface>)nativeCandidate {
webrtc::SdpParseError error;
webrtc::IceCandidateInterface *candidate = webrtc::CreateIceCandidate(
@ -63,7 +65,7 @@
error.line.c_str());
}
return rtc::scoped_ptr<webrtc::IceCandidateInterface>(candidate);
return std::unique_ptr<webrtc::IceCandidateInterface>(candidate);
}
@end

View File

@ -10,6 +10,8 @@
#import "WebRTC/RTCMediaConstraints.h"
#include <memory>
#include "webrtc/api/mediaconstraintsinterface.h"
#include "webrtc/base/scoped_ptr.h"
@ -41,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
* A MediaConstraints representation of this RTCMediaConstraints object. This is
* needed to pass to the underlying C++ APIs.
*/
- (rtc::scoped_ptr<webrtc::MediaConstraints>)nativeConstraints;
- (std::unique_ptr<webrtc::MediaConstraints>)nativeConstraints;
/** Return a native Constraints object representing these constraints */
+ (webrtc::MediaConstraintsInterface::Constraints)

View File

@ -12,6 +12,8 @@
#import "NSString+StdString.h"
#include <memory>
namespace webrtc {
MediaConstraints::~MediaConstraints() {}
@ -62,7 +64,7 @@ MediaConstraints::GetOptional() const {
#pragma mark - Private
- (rtc::scoped_ptr<webrtc::MediaConstraints>)nativeConstraints {
- (std::unique_ptr<webrtc::MediaConstraints>)nativeConstraints {
webrtc::MediaConstraintsInterface::Constraints mandatory =
[[self class] nativeConstraintsForConstraints:_mandatory];
webrtc::MediaConstraintsInterface::Constraints optional =
@ -70,7 +72,7 @@ MediaConstraints::GetOptional() const {
webrtc::MediaConstraints *nativeConstraints =
new webrtc::MediaConstraints(mandatory, optional);
return rtc::scoped_ptr<webrtc::MediaConstraints>(nativeConstraints);
return std::unique_ptr<webrtc::MediaConstraints>(nativeConstraints);
}
+ (webrtc::MediaConstraintsInterface::Constraints)

View File

@ -16,10 +16,10 @@
#import <OpenGL/gl3.h>
#endif
#include <string.h>
#include <memory>
#import "WebRTC/RTCVideoFrame.h"
#include "webrtc/base/scoped_ptr.h"
// TODO(tkchin): check and log openGL errors. Methods here return BOOLs in
// anticipation of that happening in the future.
@ -162,7 +162,7 @@ static const GLsizei kNumTextures = 3 * kNumTextureSets;
GLint _vSampler;
// Used to create a non-padded plane for GPU upload when we receive padded
// frames.
rtc::scoped_ptr<uint8_t[]> _planeBuffer;
std::unique_ptr<uint8_t[]> _planeBuffer;
}
@synthesize lastDrawnFrame = _lastDrawnFrame;

View File

@ -22,6 +22,8 @@
#import "RTCStatsReport+Private.h"
#import "WebRTC/RTCLogging.h"
#include <memory>
#include "webrtc/base/checks.h"
NSString * const kRTCPeerConnectionErrorDomain =
@ -45,8 +47,8 @@ class CreateSessionDescriptionObserverAdapter
void OnSuccess(SessionDescriptionInterface *desc) override {
RTC_DCHECK(completion_handler_);
rtc::scoped_ptr<webrtc::SessionDescriptionInterface> description =
rtc::scoped_ptr<webrtc::SessionDescriptionInterface>(desc);
std::unique_ptr<webrtc::SessionDescriptionInterface> description =
std::unique_ptr<webrtc::SessionDescriptionInterface>(desc);
RTCSessionDescription* session =
[[RTCSessionDescription alloc] initWithNativeDescription:
description.get()];
@ -184,7 +186,7 @@ void PeerConnectionDelegateAdapter::OnIceCandidate(
@implementation RTCPeerConnection {
NSMutableArray *_localStreams;
rtc::scoped_ptr<webrtc::PeerConnectionDelegateAdapter> _observer;
std::unique_ptr<webrtc::PeerConnectionDelegateAdapter> _observer;
rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection;
}
@ -199,7 +201,7 @@ void PeerConnectionDelegateAdapter::OnIceCandidate(
_observer.reset(new webrtc::PeerConnectionDelegateAdapter(self));
webrtc::PeerConnectionInterface::RTCConfiguration config =
configuration.nativeConfiguration;
rtc::scoped_ptr<webrtc::MediaConstraints> nativeConstraints =
std::unique_ptr<webrtc::MediaConstraints> nativeConstraints =
constraints.nativeConstraints;
_peerConnection =
factory.nativeFactory->CreatePeerConnection(config,
@ -257,7 +259,7 @@ void PeerConnectionDelegateAdapter::OnIceCandidate(
}
- (void)addIceCandidate:(RTCIceCandidate *)candidate {
rtc::scoped_ptr<const webrtc::IceCandidateInterface> iceCandidate(
std::unique_ptr<const webrtc::IceCandidateInterface> iceCandidate(
candidate.nativeCandidate);
_peerConnection->AddIceCandidate(iceCandidate.get());
}

View File

@ -20,9 +20,11 @@
#import "RTCVideoSource+Private.h"
#import "RTCVideoTrack+Private.h"
#include <memory>
@implementation RTCPeerConnectionFactory {
rtc::scoped_ptr<rtc::Thread> _signalingThread;
rtc::scoped_ptr<rtc::Thread> _workerThread;
std::unique_ptr<rtc::Thread> _signalingThread;
std::unique_ptr<rtc::Thread> _workerThread;
}
@synthesize nativeFactory = _nativeFactory;

View File

@ -10,10 +10,10 @@
#import "RTCVideoFrame+Private.h"
#include "webrtc/base/scoped_ptr.h"
#include <memory>
@implementation RTCVideoFrame {
rtc::scoped_ptr<cricket::VideoFrame> _videoFrame;
std::unique_ptr<cricket::VideoFrame> _videoFrame;
rtc::scoped_refptr<webrtc::VideoFrameBuffer> _i420Buffer;
}

View File

@ -12,6 +12,8 @@
#import "RTCVideoFrame+Private.h"
#include <memory>
#include "webrtc/media/engine/webrtcvideoframe.h"
namespace webrtc {
@ -60,7 +62,7 @@ class VideoRendererAdapter
}
@implementation RTCVideoRendererAdapter {
rtc::scoped_ptr<webrtc::VideoRendererAdapter> _adapter;
std::unique_ptr<webrtc::VideoRendererAdapter> _adapter;
}
@synthesize videoRenderer = _videoRenderer;

View File

@ -10,6 +10,8 @@
#import <Foundation/Foundation.h>
#include <memory>
#include "webrtc/base/gunit.h"
#import "NSString+StdString.h"
@ -32,7 +34,7 @@
sdpMLineIndex:0
sdpMid:@"audio"];
rtc::scoped_ptr<webrtc::IceCandidateInterface> nativeCandidate =
std::unique_ptr<webrtc::IceCandidateInterface> nativeCandidate =
candidate.nativeCandidate;
EXPECT_EQ("audio", nativeCandidate->sdp_mid());
EXPECT_EQ(0, nativeCandidate->sdp_mline_index());

View File

@ -10,6 +10,8 @@
#import <Foundation/Foundation.h>
#include <memory>
#include "webrtc/base/gunit.h"
#import "NSString+StdString.h"
@ -29,7 +31,7 @@
RTCMediaConstraints *constraints = [[RTCMediaConstraints alloc]
initWithMandatoryConstraints:mandatory
optionalConstraints:optional];
rtc::scoped_ptr<webrtc::MediaConstraints> nativeConstraints =
std::unique_ptr<webrtc::MediaConstraints> nativeConstraints =
[constraints nativeConstraints];
webrtc::MediaConstraintsInterface::Constraints nativeMandatory =

View File

@ -46,8 +46,8 @@ T* AlignedMalloc(size_t size, size_t alignment) {
return reinterpret_cast<T*>(AlignedMalloc(size, alignment));
}
// Deleter for use with scoped_ptr. E.g., use as
// scoped_ptr<Foo, AlignedFreeDeleter> foo;
// Deleter for use with unique_ptr. E.g., use as
// std::unique_ptr<Foo, AlignedFreeDeleter> foo;
struct AlignedFreeDeleter {
inline void operator()(void* ptr) const {
AlignedFree(ptr);

View File

@ -11,6 +11,8 @@
#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CLOCK_H_
#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CLOCK_H_
#include <memory>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/system_wrappers/include/rw_lock_wrapper.h"
#include "webrtc/typedefs.h"
@ -76,7 +78,7 @@ class SimulatedClock : public Clock {
private:
int64_t time_us_;
rtc::scoped_ptr<RWLockWrapper> lock_;
std::unique_ptr<RWLockWrapper> lock_;
};
}; // namespace webrtc

View File

@ -18,6 +18,7 @@
#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_DATA_LOG_IMPL_H_
#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
@ -139,16 +140,16 @@ class DataLogImpl {
// Collection of tables indexed by the table name as std::string.
typedef std::map<std::string, LogTable*> TableMap;
typedef rtc::scoped_ptr<CriticalSectionWrapper> CritSectScopedPtr;
typedef std::unique_ptr<CriticalSectionWrapper> CritSectScopedPtr;
static CritSectScopedPtr crit_sect_;
static DataLogImpl* instance_;
int counter_;
TableMap tables_;
EventWrapper* flush_event_;
// This is a scoped_ptr so that we don't have to create threads in the no-op
// This is a unique_ptr so that we don't have to create threads in the no-op
// impl.
rtc::scoped_ptr<rtc::PlatformThread> file_writer_thread_;
std::unique_ptr<rtc::PlatformThread> file_writer_thread_;
RWLockWrapper* tables_lock_;
};

View File

@ -15,6 +15,8 @@
#ifdef WIN32
#include <windows.h>
#include <memory>
#include <string>
#include "webrtc/base/scoped_ptr.h"
@ -24,7 +26,7 @@ namespace webrtc {
inline std::wstring ToUtf16(const char* utf8, size_t len) {
int len16 = ::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast<int>(len),
NULL, 0);
rtc::scoped_ptr<wchar_t[]> ws(new wchar_t[len16]);
std::unique_ptr<wchar_t[]> ws(new wchar_t[len16]);
::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast<int>(len), ws.get(),
len16);
return std::wstring(ws.get(), len16);
@ -37,7 +39,7 @@ inline std::wstring ToUtf16(const std::string& str) {
inline std::string ToUtf8(const wchar_t* wide, size_t len) {
int len8 = ::WideCharToMultiByte(CP_UTF8, 0, wide, static_cast<int>(len),
NULL, 0, NULL, NULL);
rtc::scoped_ptr<char[]> ns(new char[len8]);
std::unique_ptr<char[]> ns(new char[len8]);
::WideCharToMultiByte(CP_UTF8, 0, wide, static_cast<int>(len), ns.get(), len8,
NULL, NULL);
return std::string(ns.get(), len8);

View File

@ -10,6 +10,8 @@
#include "webrtc/system_wrappers/include/aligned_malloc.h"
#include <memory>
#if _WIN32
#include <windows.h>
#else
@ -17,14 +19,13 @@
#endif
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/typedefs.h"
namespace webrtc {
// Returns true if |size| and |alignment| are valid combinations.
bool CorrectUsage(size_t size, size_t alignment) {
rtc::scoped_ptr<char, AlignedFreeDeleter> scoped(
std::unique_ptr<char, AlignedFreeDeleter> scoped(
static_cast<char*>(AlignedMalloc(size, alignment)));
if (scoped.get() == NULL) {
return false;
@ -37,7 +38,7 @@ TEST(AlignedMalloc, GetRightAlign) {
const size_t size = 100;
const size_t alignment = 32;
const size_t left_misalignment = 1;
rtc::scoped_ptr<char, AlignedFreeDeleter> scoped(
std::unique_ptr<char, AlignedFreeDeleter> scoped(
static_cast<char*>(AlignedMalloc(size, alignment)));
EXPECT_TRUE(scoped.get() != NULL);
const uintptr_t aligned_address = reinterpret_cast<uintptr_t> (scoped.get());

View File

@ -17,7 +17,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/platform_thread.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
#include "webrtc/system_wrappers/include/tick_util.h"
#include "webrtc/system_wrappers/include/trace.h"

View File

@ -13,6 +13,8 @@
#include <stdio.h>
#include <memory>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/system_wrappers/include/file_wrapper.h"
@ -52,7 +54,7 @@ class FileWrapperImpl : public FileWrapper {
int CloseFileImpl();
int FlushImpl();
rtc::scoped_ptr<RWLockWrapper> rw_lock_;
std::unique_ptr<RWLockWrapper> rw_lock_;
FILE* id_;
bool managed_file_handle_;

View File

@ -13,7 +13,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/arraysize.h"
#include "webrtc/base/event.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/system_wrappers/include/trace.h"
namespace webrtc {

View File

@ -11,6 +11,8 @@
#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_IMPL_H_
#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_IMPL_H_
#include <memory>
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/system_wrappers/include/event_wrapper.h"
@ -97,7 +99,7 @@ class TraceImpl : public Trace {
uint32_t row_count_text_ GUARDED_BY(crit_);
uint32_t file_count_text_ GUARDED_BY(crit_);
const rtc::scoped_ptr<FileWrapper> trace_file_ GUARDED_BY(crit_);
const std::unique_ptr<FileWrapper> trace_file_ GUARDED_BY(crit_);
rtc::CriticalSection crit_;
};

View File

@ -82,22 +82,22 @@ class CallTest : public ::testing::Test {
Clock* const clock_;
rtc::scoped_ptr<Call> sender_call_;
rtc::scoped_ptr<PacketTransport> send_transport_;
std::unique_ptr<Call> sender_call_;
std::unique_ptr<PacketTransport> send_transport_;
VideoSendStream::Config video_send_config_;
VideoEncoderConfig video_encoder_config_;
VideoSendStream* video_send_stream_;
AudioSendStream::Config audio_send_config_;
AudioSendStream* audio_send_stream_;
rtc::scoped_ptr<Call> receiver_call_;
rtc::scoped_ptr<PacketTransport> receive_transport_;
std::unique_ptr<Call> receiver_call_;
std::unique_ptr<PacketTransport> receive_transport_;
std::vector<VideoReceiveStream::Config> video_receive_configs_;
std::vector<VideoReceiveStream*> video_receive_streams_;
std::vector<AudioReceiveStream::Config> audio_receive_configs_;
std::vector<AudioReceiveStream*> audio_receive_streams_;
rtc::scoped_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_;
std::unique_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_;
test::FakeEncoder fake_encoder_;
std::vector<std::unique_ptr<VideoDecoder>> allocated_decoders_;
size_t num_video_streams_;
@ -127,8 +127,8 @@ class CallTest : public ::testing::Test {
VoiceEngineState voe_recv_;
// The audio devices must outlive the voice engines.
rtc::scoped_ptr<test::FakeAudioDevice> fake_send_audio_device_;
rtc::scoped_ptr<test::FakeAudioDevice> fake_recv_audio_device_;
std::unique_ptr<test::FakeAudioDevice> fake_send_audio_device_;
std::unique_ptr<test::FakeAudioDevice> fake_recv_audio_device_;
};
class BaseTest : public RtpRtcpObserver {

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_TEST_CONFIGURABLE_FRAME_SIZE_ENCODER_H_
#define WEBRTC_TEST_CONFIGURABLE_FRAME_SIZE_ENCODER_H_
#include <memory>
#include <vector>
#include "webrtc/base/scoped_ptr.h"
@ -49,7 +50,7 @@ class ConfigurableFrameSizeEncoder : public VideoEncoder {
EncodedImageCallback* callback_;
const size_t max_frame_size_;
size_t current_frame_size_;
rtc::scoped_ptr<uint8_t[]> buffer_;
std::unique_ptr<uint8_t[]> buffer_;
};
} // namespace test

View File

@ -10,6 +10,7 @@
#ifndef WEBRTC_TEST_FAKE_AUDIO_DEVICE_H_
#define WEBRTC_TEST_FAKE_AUDIO_DEVICE_H_
#include <memory>
#include <string>
#include "webrtc/base/criticalsection.h"
@ -59,11 +60,11 @@ class FakeAudioDevice : public FakeAudioDeviceModule {
int64_t last_playout_ms_;
DriftingClock clock_;
rtc::scoped_ptr<EventTimerWrapper> tick_;
std::unique_ptr<EventTimerWrapper> tick_;
rtc::CriticalSection lock_;
rtc::PlatformThread thread_;
rtc::scoped_ptr<ModuleFileUtility> file_utility_;
rtc::scoped_ptr<FileWrapper> input_stream_;
std::unique_ptr<ModuleFileUtility> file_utility_;
std::unique_ptr<FileWrapper> input_stream_;
};
} // namespace test
} // namespace webrtc

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_TEST_FAKE_NETWORK_PIPE_H_
#define WEBRTC_TEST_FAKE_NETWORK_PIPE_H_
#include <memory>
#include <set>
#include <string.h>
#include <queue>
@ -50,7 +51,7 @@ class NetworkPacket {
private:
// The packet data.
rtc::scoped_ptr<uint8_t[]> data_;
std::unique_ptr<uint8_t[]> data_;
// Length of data_.
size_t data_length_;
// The time the packet was sent out on the network.

View File

@ -8,10 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/call.h"
#include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/test/fake_network_pipe.h"
@ -71,7 +72,7 @@ class FakeNetworkPipeTest : public ::testing::Test {
void SendPackets(FakeNetworkPipe* pipe, int number_packets, int packet_size) {
RTC_DCHECK_GE(packet_size, static_cast<int>(sizeof(int)));
rtc::scoped_ptr<uint8_t[]> packet(new uint8_t[packet_size]);
std::unique_ptr<uint8_t[]> packet(new uint8_t[packet_size]);
for (int i = 0; i < number_packets; ++i) {
// Set a sequence number for the packets by
// using the first bytes in the packet.
@ -85,7 +86,7 @@ class FakeNetworkPipeTest : public ::testing::Test {
}
SimulatedClock fake_clock_;
rtc::scoped_ptr<TestReceiver> receiver_;
std::unique_ptr<TestReceiver> receiver_;
};
void DeleteMemory(uint8_t* data, int length) { delete [] data; }
@ -95,7 +96,7 @@ TEST_F(FakeNetworkPipeTest, CapacityTest) {
FakeNetworkPipe::Config config;
config.queue_length_packets = 20;
config.link_capacity_kbps = 80;
rtc::scoped_ptr<FakeNetworkPipe> pipe(
std::unique_ptr<FakeNetworkPipe> pipe(
new FakeNetworkPipe(&fake_clock_, config));
pipe->SetReceiver(receiver_.get());
@ -135,7 +136,7 @@ TEST_F(FakeNetworkPipeTest, ExtraDelayTest) {
config.queue_length_packets = 20;
config.queue_delay_ms = 100;
config.link_capacity_kbps = 80;
rtc::scoped_ptr<FakeNetworkPipe> pipe(
std::unique_ptr<FakeNetworkPipe> pipe(
new FakeNetworkPipe(&fake_clock_, config));
pipe->SetReceiver(receiver_.get());
@ -169,7 +170,7 @@ TEST_F(FakeNetworkPipeTest, QueueLengthTest) {
FakeNetworkPipe::Config config;
config.queue_length_packets = 2;
config.link_capacity_kbps = 80;
rtc::scoped_ptr<FakeNetworkPipe> pipe(
std::unique_ptr<FakeNetworkPipe> pipe(
new FakeNetworkPipe(&fake_clock_, config));
pipe->SetReceiver(receiver_.get());
@ -193,7 +194,7 @@ TEST_F(FakeNetworkPipeTest, StatisticsTest) {
config.queue_length_packets = 2;
config.queue_delay_ms = 20;
config.link_capacity_kbps = 80;
rtc::scoped_ptr<FakeNetworkPipe> pipe(
std::unique_ptr<FakeNetworkPipe> pipe(
new FakeNetworkPipe(&fake_clock_, config));
pipe->SetReceiver(receiver_.get());
@ -223,7 +224,7 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithEmptyPipeTest) {
FakeNetworkPipe::Config config;
config.queue_length_packets = 20;
config.link_capacity_kbps = 80;
rtc::scoped_ptr<FakeNetworkPipe> pipe(
std::unique_ptr<FakeNetworkPipe> pipe(
new FakeNetworkPipe(&fake_clock_, config));
pipe->SetReceiver(receiver_.get());
@ -282,7 +283,7 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithPacketsInPipeTest) {
FakeNetworkPipe::Config config;
config.queue_length_packets = 20;
config.link_capacity_kbps = 80;
rtc::scoped_ptr<FakeNetworkPipe> pipe(
std::unique_ptr<FakeNetworkPipe> pipe(
new FakeNetworkPipe(&fake_clock_, config));
pipe->SetReceiver(receiver_.get());
@ -337,7 +338,7 @@ TEST_F(FakeNetworkPipeTest, DisallowReorderingThenAllowReordering) {
config.link_capacity_kbps = 800;
config.queue_delay_ms = 100;
config.delay_standard_deviation_ms = 10;
rtc::scoped_ptr<FakeNetworkPipe> pipe(
std::unique_ptr<FakeNetworkPipe> pipe(
new FakeNetworkPipe(&fake_clock_, config));
ReorderTestReceiver* receiver = new ReorderTestReceiver();
receiver_.reset(receiver);

View File

@ -13,6 +13,8 @@
#include <stdio.h>
#include <string.h>
#include <memory>
#include "webrtc/base/checks.h"
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/system_wrappers/include/clock.h"
@ -121,7 +123,7 @@ class YuvFileGenerator : public FrameGenerator {
const size_t width_;
const size_t height_;
const size_t frame_size_;
const rtc::scoped_ptr<uint8_t[]> frame_buffer_;
const std::unique_ptr<uint8_t[]> frame_buffer_;
const int frame_display_count_;
int current_display_count_;
VideoFrame last_read_frame_;

View File

@ -10,6 +10,7 @@
#ifndef WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_
#define WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_
#include <memory>
#include <string>
#include "webrtc/base/criticalsection.h"
@ -64,10 +65,10 @@ class FrameGeneratorCapturer : public VideoCapturer {
Clock* const clock_;
bool sending_;
rtc::scoped_ptr<EventTimerWrapper> tick_;
std::unique_ptr<EventTimerWrapper> tick_;
rtc::CriticalSection lock_;
rtc::PlatformThread thread_;
rtc::scoped_ptr<FrameGenerator> frame_generator_;
std::unique_ptr<FrameGenerator> frame_generator_;
int target_fps_;
VideoRotation fake_rotation_ = kVideoRotation_0;

View File

@ -9,10 +9,11 @@
*/
#include <stdio.h>
#include <memory>
#include <string>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/test/frame_generator.h"
#include "webrtc/test/testsupport/fileutils.h"
@ -46,7 +47,7 @@ class FrameGeneratorTest : public ::testing::Test {
protected:
void WriteYuvFile(FILE* file, uint8_t y, uint8_t u, uint8_t v) {
assert(file);
rtc::scoped_ptr<uint8_t[]> plane_buffer(new uint8_t[y_size]);
std::unique_ptr<uint8_t[]> plane_buffer(new uint8_t[y_size]);
memset(plane_buffer.get(), y, y_size);
fwrite(plane_buffer.get(), 1, y_size, file);
memset(plane_buffer.get(), u, uv_size);
@ -88,7 +89,7 @@ class FrameGeneratorTest : public ::testing::Test {
};
TEST_F(FrameGeneratorTest, SingleFrameFile) {
rtc::scoped_ptr<FrameGenerator> generator(FrameGenerator::CreateFromYuvFile(
std::unique_ptr<FrameGenerator> generator(FrameGenerator::CreateFromYuvFile(
std::vector<std::string>(1, one_frame_filename_), kFrameWidth,
kFrameHeight, 1));
CheckFrameAndMutate(generator->NextFrame(), 255, 255, 255);
@ -96,7 +97,7 @@ TEST_F(FrameGeneratorTest, SingleFrameFile) {
}
TEST_F(FrameGeneratorTest, TwoFrameFile) {
rtc::scoped_ptr<FrameGenerator> generator(FrameGenerator::CreateFromYuvFile(
std::unique_ptr<FrameGenerator> generator(FrameGenerator::CreateFromYuvFile(
std::vector<std::string>(1, two_frame_filename_), kFrameWidth,
kFrameHeight, 1));
CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0);
@ -109,7 +110,7 @@ TEST_F(FrameGeneratorTest, MultipleFrameFiles) {
files.push_back(two_frame_filename_);
files.push_back(one_frame_filename_);
rtc::scoped_ptr<FrameGenerator> generator(
std::unique_ptr<FrameGenerator> generator(
FrameGenerator::CreateFromYuvFile(files, kFrameWidth, kFrameHeight, 1));
CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0);
CheckFrameAndMutate(generator->NextFrame(), 127, 127, 127);
@ -119,7 +120,7 @@ TEST_F(FrameGeneratorTest, MultipleFrameFiles) {
TEST_F(FrameGeneratorTest, TwoFrameFileWithRepeat) {
const int kRepeatCount = 3;
rtc::scoped_ptr<FrameGenerator> generator(FrameGenerator::CreateFromYuvFile(
std::unique_ptr<FrameGenerator> generator(FrameGenerator::CreateFromYuvFile(
std::vector<std::string>(1, two_frame_filename_), kFrameWidth,
kFrameHeight, kRepeatCount));
for (int i = 0; i < kRepeatCount; ++i)
@ -134,7 +135,7 @@ TEST_F(FrameGeneratorTest, MultipleFrameFilesWithRepeat) {
std::vector<std::string> files;
files.push_back(two_frame_filename_);
files.push_back(one_frame_filename_);
rtc::scoped_ptr<FrameGenerator> generator(FrameGenerator::CreateFromYuvFile(
std::unique_ptr<FrameGenerator> generator(FrameGenerator::CreateFromYuvFile(
files, kFrameWidth, kFrameHeight, kRepeatCount));
for (int i = 0; i < kRepeatCount; ++i)
CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0);

View File

@ -7,8 +7,10 @@
* 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/checks.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
#include "webrtc/modules/rtp_rtcp/source/producer_fec.h"
@ -30,14 +32,14 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
size_t payload_size = data[i++] % 10;
if (i + payload_size + rtp_header_length + 2 > size)
break;
rtc::scoped_ptr<uint8_t[]> packet(
std::unique_ptr<uint8_t[]> packet(
new uint8_t[payload_size + rtp_header_length]);
memcpy(packet.get(), &data[i], payload_size + rtp_header_length);
ByteWriter<uint16_t>::WriteBigEndian(&packet[2], seq_num++);
i += payload_size + rtp_header_length;
// Make sure sequence numbers are increasing.
const int kRedPayloadType = 98;
rtc::scoped_ptr<RedPacket> red_packet(producer.BuildRedPacket(
std::unique_ptr<RedPacket> red_packet(producer.BuildRedPacket(
packet.get(), payload_size, rtp_header_length, kRedPayloadType));
const bool protect = data[i++] % 2 == 1;
if (protect) {

View File

@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/base/checks.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h"
#include "webrtc/system_wrappers/include/clock.h"

View File

@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "webrtc/base/checks.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
@ -62,7 +64,7 @@ bool LayerFilteringTransport::SendRtp(const uint8_t* packet,
const size_t payload_data_length = payload_length - header.paddingLength;
const bool is_vp8 = header.payloadType == vp8_video_payload_type_;
rtc::scoped_ptr<RtpDepacketizer> depacketizer(
std::unique_ptr<RtpDepacketizer> depacketizer(
RtpDepacketizer::Create(is_vp8 ? kRtpVideoVp8 : kRtpVideoVp9));
RtpDepacketizer::ParsedPayload parsed_payload;
if (depacketizer->Parse(&parsed_payload, payload, payload_data_length)) {

View File

@ -19,7 +19,6 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/format_macros.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
namespace webrtc {

View File

@ -9,9 +9,9 @@
*/
#include <map>
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
#include "webrtc/test/rtp_file_reader.h"
#include "webrtc/test/testsupport/fileutils.h"
@ -43,7 +43,7 @@ class TestRtpFileReader : public ::testing::Test {
}
private:
rtc::scoped_ptr<test::RtpFileReader> rtp_packet_source_;
std::unique_ptr<test::RtpFileReader> rtp_packet_source_;
bool headers_only_file_;
};
@ -94,7 +94,7 @@ class TestPcapFileReader : public ::testing::Test {
}
private:
rtc::scoped_ptr<test::RtpFileReader> rtp_packet_source_;
std::unique_ptr<test::RtpFileReader> rtp_packet_source_;
};
TEST_F(TestPcapFileReader, TestEthernetIIFrame) {

View File

@ -10,8 +10,9 @@
#include <string.h>
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/test/rtp_file_reader.h"
#include "webrtc/test/rtp_file_writer.h"
#include "webrtc/test/testsupport/fileutils.h"
@ -43,7 +44,7 @@ class RtpFileWriterTest : public ::testing::Test {
void VerifyFileContents(int expected_packets) {
ASSERT_TRUE(rtp_writer_.get() == NULL)
<< "Must call CloseOutputFile before VerifyFileContents";
rtc::scoped_ptr<test::RtpFileReader> rtp_reader(
std::unique_ptr<test::RtpFileReader> rtp_reader(
test::RtpFileReader::Create(test::RtpFileReader::kRtpDump, filename_));
ASSERT_TRUE(rtp_reader.get() != NULL);
test::RtpPacket packet;
@ -61,7 +62,7 @@ class RtpFileWriterTest : public ::testing::Test {
}
private:
rtc::scoped_ptr<test::RtpFileWriter> rtp_writer_;
std::unique_ptr<test::RtpFileWriter> rtp_writer_;
std::string filename_;
};

View File

@ -11,6 +11,7 @@
#define WEBRTC_TEST_RTP_RTCP_OBSERVER_H_
#include <map>
#include <memory>
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
@ -69,7 +70,7 @@ class RtpRtcpObserver {
}
rtc::Event observation_complete_;
const rtc::scoped_ptr<RtpHeaderParser> parser_;
const std::unique_ptr<RtpHeaderParser> parser_;
private:
const int timeout_ms_;

View File

@ -17,6 +17,8 @@
// instantiate this class in your main function and call its Run method to run
// any gtest based tests that are linked into your executable.
#include <memory>
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ptr.h"
@ -41,7 +43,7 @@ class TestSuite {
RTC_DISALLOW_COPY_AND_ASSIGN(TestSuite);
private:
rtc::scoped_ptr<TraceToStderr> trace_to_stderr_;
std::unique_ptr<TraceToStderr> trace_to_stderr_;
};
} // namespace test

View File

@ -23,7 +23,6 @@
#else
#include <unistd.h>
#include "webrtc/base/scoped_ptr.h"
#define GET_CURRENT_DIR getcwd
#endif
@ -36,6 +35,8 @@
#include <stdlib.h>
#include <string.h>
#include <memory>
#include "webrtc/typedefs.h" // For architecture defines
namespace webrtc {
@ -183,7 +184,7 @@ std::string TempFilename(const std::string &dir, const std::string &prefix) {
return "";
#else
int len = dir.size() + prefix.size() + 2 + 6;
rtc::scoped_ptr<char[]> tempname(new char[len]);
std::unique_ptr<char[]> tempname(new char[len]);
snprintf(tempname.get(), len, "%s/%sXXXXXX", dir.c_str(),
prefix.c_str());

View File

@ -14,10 +14,10 @@
#include <stdlib.h>
#include <algorithm>
#include <memory>
#include "gflags/gflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_processing/agc/agc.h"
#include "webrtc/modules/audio_processing/agc/histogram.h"
#include "webrtc/modules/audio_processing/agc/utility.h"
@ -155,10 +155,10 @@ class AgcStat {
int video_index_;
double activity_threshold_;
double video_vad_[kMaxNumFrames];
rtc::scoped_ptr<Histogram> audio_content_;
rtc::scoped_ptr<VadAudioProc> audio_processing_;
rtc::scoped_ptr<PitchBasedVad> vad_;
rtc::scoped_ptr<StandaloneVad> standalone_vad_;
std::unique_ptr<Histogram> audio_content_;
std::unique_ptr<VadAudioProc> audio_processing_;
std::unique_ptr<PitchBasedVad> vad_;
std::unique_ptr<StandaloneVad> standalone_vad_;
FILE* audio_content_fid_;
};

View File

@ -10,10 +10,11 @@
// Refer to kUsage below for a description.
#include <memory>
#include "gflags/gflags.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/format_macros.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/system_wrappers/include/sleep.h"
#include "webrtc/system_wrappers/include/trace.h"
#include "webrtc/test/channel_transport/channel_transport.h"
@ -217,13 +218,13 @@ class AgcVoiceEngine {
int channel_;
int capture_idx_;
int render_idx_;
rtc::scoped_ptr<test::VoiceChannelTransport> channel_transport_;
std::unique_ptr<test::VoiceChannelTransport> channel_transport_;
};
void RunHarness() {
rtc::scoped_ptr<AgcVoiceEngine> voe1(new AgcVoiceEngine(
std::unique_ptr<AgcVoiceEngine> voe1(new AgcVoiceEngine(
FLAGS_legacy_agc, 2000, 2000, FLAGS_capture1, FLAGS_render1));
rtc::scoped_ptr<AgcVoiceEngine> voe2;
std::unique_ptr<AgcVoiceEngine> voe2;
if (FLAGS_parallel) {
voe2.reset(new AgcVoiceEngine(!FLAGS_legacy_agc, 3000, 3000, FLAGS_capture2,
FLAGS_render2));

View File

@ -12,10 +12,11 @@
// and runs forever. Some parameters can be configured through command-line
// flags.
#include <memory>
#include "gflags/gflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/test/channel_transport/channel_transport.h"
#include "webrtc/voice_engine/include/voe_audio_processing.h"
#include "webrtc/voice_engine/include/voe_base.h"
@ -48,7 +49,7 @@ void RunHarness() {
int channel = base->CreateChannel();
ASSERT_NE(-1, channel);
rtc::scoped_ptr<VoiceChannelTransport> voice_channel_transport(
std::unique_ptr<VoiceChannelTransport> voice_channel_transport(
new VoiceChannelTransport(network, channel));
ASSERT_EQ(0, voice_channel_transport->SetSendDestination("127.0.0.1", 1234));

View File

@ -12,7 +12,6 @@
#include <stdio.h>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/test/channel_transport/channel_transport.h"
#include "webrtc/voice_engine/include/voe_audio_processing.h"
#include "webrtc/voice_engine/include/voe_base.h"

View File

@ -11,9 +11,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <memory>
#include <string>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/tools/frame_editing/frame_editing_lib.h"
#include "webrtc/typedefs.h"
@ -39,7 +39,7 @@ int EditFrames(const string& in_path, int width, int height,
// Frame size of I420.
size_t frame_length = CalcBufferSize(kI420, width, height);
rtc::scoped_ptr<uint8_t[]> temp_buffer(new uint8_t[frame_length]);
std::unique_ptr<uint8_t[]> temp_buffer(new uint8_t[frame_length]);
FILE* out_fid = fopen(out_path.c_str(), "wb");

View File

@ -12,9 +12,9 @@
#include <stdlib.h>
#include <fstream>
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/test/testsupport/fileutils.h"
#include "webrtc/tools/frame_editing/frame_editing_lib.h"
@ -56,8 +56,8 @@ class FrameEditingTest : public ::testing::Test {
// Compares the frames in both streams to the end of one of the streams.
void CompareToTheEnd(FILE* test_video_fid,
FILE* ref_video_fid,
rtc::scoped_ptr<int[]>* ref_buffer,
rtc::scoped_ptr<int[]>* test_buffer) {
std::unique_ptr<int[]>* ref_buffer,
std::unique_ptr<int[]>* test_buffer) {
while (!feof(test_video_fid) && !feof(ref_video_fid)) {
num_bytes_read_ = fread(ref_buffer->get(), 1, kFrameSize, ref_video_fid);
if (!feof(ref_video_fid)) {
@ -81,8 +81,8 @@ class FrameEditingTest : public ::testing::Test {
FILE* original_fid_;
FILE* edited_fid_;
size_t num_bytes_read_;
rtc::scoped_ptr<int[]> original_buffer_;
rtc::scoped_ptr<int[]> edited_buffer_;
std::unique_ptr<int[]> original_buffer_;
std::unique_ptr<int[]> edited_buffer_;
int num_frames_read_;
};

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_
#define WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_
#include <memory>
#include <vector>
#include "webrtc/base/criticalsection.h"

View File

@ -12,6 +12,7 @@
#define WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_
#include <map>
#include <memory>
#include <vector>
#include "webrtc/call/bitrate_allocator.h"