From bfefb03ec124105f49a19952fa73cf1861b0f262 Mon Sep 17 00:00:00 2001 From: kwiberg Date: Sun, 1 May 2016 14:53:46 -0700 Subject: [PATCH] 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} --- talk/app/webrtc/objc/RTCVideoCapturer.mm | 2 +- webrtc/api/quicdatachannel_unittest.cc | 14 ++++++------- webrtc/api/quicdatatransport_unittest.cc | 13 ++++++------ webrtc/audio_send_stream.h | 3 ++- webrtc/base/optional.h | 3 ++- webrtc/base/scoped_ptr.h | 2 +- webrtc/base/thread.h | 1 + webrtc/base/thread_unittest.cc | 2 ++ webrtc/common_audio/audio_ring_buffer.h | 2 ++ webrtc/common_audio/real_fourier.cc | 6 +++--- webrtc/common_audio/real_fourier.h | 7 ++++--- webrtc/common_audio/vad/vad.cc | 2 ++ .../peerconnection/client/conductor.cc | 3 ++- .../peerconnection/client/linux/main_wnd.h | 9 ++++---- .../examples/peerconnection/client/main_wnd.h | 7 ++++--- .../client/peer_connection_client.h | 5 +++-- .../examples/relayserver/relayserver_main.cc | 6 +++--- webrtc/media/base/videoadapter_unittest.cc | 1 + webrtc/media/base/videobroadcaster.h | 3 ++- webrtc/media/base/videocapturer_unittest.cc | 6 ++++-- webrtc/media/engine/webrtcvoe.h | 2 ++ .../codecs/audio_decoder_factory_unittest.cc | 2 ++ .../audio_coding/neteq/delay_peak_detector.h | 1 + webrtc/p2p/base/transport.cc | 2 +- webrtc/p2p/base/transport_unittest.cc | 4 ++-- webrtc/p2p/quic/quictransport.h | 3 ++- webrtc/p2p/quic/quictransport_unittest.cc | 13 ++++++------ webrtc/pc/yuvscaler_unittest.cc | 1 + .../objc/Framework/Classes/RTCDataChannel.mm | 6 +++--- .../objc/Framework/Classes/RTCFileLogger.mm | 9 ++++---- .../Classes/RTCIceCandidate+Private.h | 4 +++- .../objc/Framework/Classes/RTCIceCandidate.mm | 6 ++++-- .../Classes/RTCMediaConstraints+Private.h | 4 +++- .../Framework/Classes/RTCMediaConstraints.mm | 6 ++++-- .../Classes/RTCOpenGLVideoRenderer.mm | 4 ++-- .../Framework/Classes/RTCPeerConnection.mm | 12 ++++++----- .../Classes/RTCPeerConnectionFactory.mm | 6 ++++-- .../objc/Framework/Classes/RTCVideoFrame.mm | 4 ++-- .../Classes/RTCVideoRendererAdapter.mm | 4 +++- .../UnitTests/RTCIceCandidateTest.mm | 4 +++- .../UnitTests/RTCMediaConstraintsTest.mm | 4 +++- .../system_wrappers/include/aligned_malloc.h | 4 ++-- webrtc/system_wrappers/include/clock.h | 4 +++- .../system_wrappers/include/data_log_impl.h | 7 ++++--- webrtc/system_wrappers/include/utf_util_win.h | 6 ++++-- .../source/aligned_malloc_unittest.cc | 7 ++++--- .../source/condition_variable_unittest.cc | 1 - webrtc/system_wrappers/source/file_impl.h | 4 +++- .../source/logging_unittest.cc | 1 - webrtc/system_wrappers/source/trace_impl.h | 4 +++- webrtc/test/call_test.h | 14 ++++++------- webrtc/test/configurable_frame_size_encoder.h | 3 ++- webrtc/test/fake_audio_device.h | 7 ++++--- webrtc/test/fake_network_pipe.h | 3 ++- webrtc/test/fake_network_pipe_unittest.cc | 21 ++++++++++--------- webrtc/test/frame_generator.cc | 4 +++- webrtc/test/frame_generator_capturer.h | 5 +++-- webrtc/test/frame_generator_unittest.cc | 15 ++++++------- webrtc/test/fuzzers/producer_fec_fuzzer.cc | 8 ++++--- webrtc/test/fuzzers/rtcp_receiver_fuzzer.cc | 1 - webrtc/test/layer_filtering_transport.cc | 4 +++- webrtc/test/rtp_file_reader.cc | 1 - webrtc/test/rtp_file_reader_unittest.cc | 6 +++--- webrtc/test/rtp_file_writer_unittest.cc | 7 ++++--- webrtc/test/rtp_rtcp_observer.h | 3 ++- webrtc/test/test_suite.h | 4 +++- webrtc/test/testsupport/fileutils.cc | 5 +++-- webrtc/tools/agc/activity_metric.cc | 10 ++++----- webrtc/tools/agc/agc_harness.cc | 9 ++++---- .../e2e_quality/audio/audio_e2e_harness.cc | 5 +++-- .../force_mic_volume_max.cc | 1 - .../tools/frame_editing/frame_editing_lib.cc | 4 ++-- .../frame_editing/frame_editing_unittest.cc | 10 ++++----- webrtc/video/video_capture_input.h | 1 + webrtc/video/video_send_stream.h | 1 + 75 files changed, 230 insertions(+), 158 deletions(-) diff --git a/talk/app/webrtc/objc/RTCVideoCapturer.mm b/talk/app/webrtc/objc/RTCVideoCapturer.mm index 9dbc201a67..39f06934e7 100644 --- a/talk/app/webrtc/objc/RTCVideoCapturer.mm +++ b/talk/app/webrtc/objc/RTCVideoCapturer.mm @@ -43,7 +43,7 @@ + (RTCVideoCapturer*)capturerWithDeviceName:(NSString*)deviceName { cricket::WebRtcVideoDeviceCapturerFactory factory; cricket::Device device(std::string(deviceName.UTF8String), 0); - rtc::scoped_ptr capturer(factory.Create(device)); + std::unique_ptr capturer(factory.Create(device)); RTCVideoCapturer* rtcCapturer = [[RTCVideoCapturer alloc] initWithCapturer:capturer.release()]; return rtcCapturer; diff --git a/webrtc/api/quicdatachannel_unittest.cc b/webrtc/api/quicdatachannel_unittest.cc index 1c5fc02aa9..e701c29b4f 100644 --- a/webrtc/api/quicdatachannel_unittest.cc +++ b/webrtc/api/quicdatachannel_unittest.cc @@ -11,13 +11,13 @@ #include "webrtc/api/quicdatachannel.h" #include +#include #include #include #include #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 fingerprint( + std::unique_ptr fingerprint( rtc::SSLFingerprint::Create(digest_algorithm, cert->identity())); return fingerprint.release(); } @@ -176,7 +176,7 @@ class QuicDataChannelPeer { void GenerateCertificateAndFingerprint() { rtc::scoped_refptr local_cert = - rtc::RTCCertificate::Create(rtc::scoped_ptr( + rtc::RTCCertificate::Create(std::unique_ptr( 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& local_fingerprint() { + std::unique_ptr& local_fingerprint() { return local_fingerprint_; } @@ -222,7 +222,7 @@ class QuicDataChannelPeer { FakeTransportChannel* ice_transport_channel_; QuicTransportChannel quic_transport_channel_; - rtc::scoped_ptr local_fingerprint_; + std::unique_ptr 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& peer1_fingerprint = + std::unique_ptr& peer1_fingerprint = peer1_.local_fingerprint(); - rtc::scoped_ptr& peer2_fingerprint = + std::unique_ptr& peer2_fingerprint = peer2_.local_fingerprint(); peer1_.quic_transport_channel()->SetRemoteFingerprint( diff --git a/webrtc/api/quicdatatransport_unittest.cc b/webrtc/api/quicdatatransport_unittest.cc index ef9af36b85..d668c55b0b 100644 --- a/webrtc/api/quicdatatransport_unittest.cc +++ b/webrtc/api/quicdatatransport_unittest.cc @@ -10,6 +10,7 @@ #include "webrtc/api/quicdatatransport.h" +#include #include #include #include @@ -71,7 +72,7 @@ class QuicDataTransportPeer { void GenerateCertificateAndFingerprint() { rtc::scoped_refptr local_cert = - rtc::RTCCertificate::Create(rtc::scoped_ptr( + rtc::RTCCertificate::Create(std::unique_ptr( 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& local_fingerprint() { + std::unique_ptr& 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 fingerprint( + std::unique_ptr 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 local_fingerprint_; + std::unique_ptr 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& peer1_fingerprint = + std::unique_ptr& peer1_fingerprint = peer1_.local_fingerprint(); - rtc::scoped_ptr& peer2_fingerprint = + std::unique_ptr& peer2_fingerprint = peer2_.local_fingerprint(); peer1_.quic_transport_channel()->SetRemoteFingerprint( diff --git a/webrtc/audio_send_stream.h b/webrtc/audio_send_stream.h index 24c3d77ab2..18e71253f1 100644 --- a/webrtc/audio_send_stream.h +++ b/webrtc/audio_send_stream.h @@ -11,6 +11,7 @@ #ifndef WEBRTC_AUDIO_SEND_STREAM_H_ #define WEBRTC_AUDIO_SEND_STREAM_H_ +#include #include #include @@ -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 encoder; + // std::unique_ptr 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. }; diff --git a/webrtc/base/optional.h b/webrtc/base/optional.h index f25086569c..7320533c63 100644 --- a/webrtc/base/optional.h +++ b/webrtc/base/optional.h @@ -12,6 +12,7 @@ #define WEBRTC_BASE_OPTIONAL_H_ #include +#include #include #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 instead if that's too +// contain a value; use e.g. std::unique_ptr instead if that's too // expensive. // // A moved-from Optional may only be destroyed, and assigned to if T allows diff --git a/webrtc/base/scoped_ptr.h b/webrtc/base/scoped_ptr.h index db5ef9e696..af515f6801 100644 --- a/webrtc/base/scoped_ptr.h +++ b/webrtc/base/scoped_ptr.h @@ -33,7 +33,7 @@ namespace rtc { template > using scoped_ptr = std::unique_ptr; -// 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 std::unique_ptr ScopedToUnique(std::unique_ptr up) { diff --git a/webrtc/base/thread.h b/webrtc/base/thread.h index 7623424104..1a0c447264 100644 --- a/webrtc/base/thread.h +++ b/webrtc/base/thread.h @@ -13,6 +13,7 @@ #include #include +#include #include #include diff --git a/webrtc/base/thread_unittest.cc b/webrtc/base/thread_unittest.cc index d733058178..bf3cbd0896 100644 --- a/webrtc/base/thread_unittest.cc +++ b/webrtc/base/thread_unittest.cc @@ -8,6 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include + #include "webrtc/base/asyncinvoker.h" #include "webrtc/base/asyncudpsocket.h" #include "webrtc/base/event.h" diff --git a/webrtc/common_audio/audio_ring_buffer.h b/webrtc/common_audio/audio_ring_buffer.h index ae825a3cd0..6bf3a19531 100644 --- a/webrtc/common_audio/audio_ring_buffer.h +++ b/webrtc/common_audio/audio_ring_buffer.h @@ -11,6 +11,8 @@ #define WEBRTC_COMMON_AUDIO_AUDIO_RING_BUFFER_H_ #include + +#include #include struct RingBuffer; diff --git a/webrtc/common_audio/real_fourier.cc b/webrtc/common_audio/real_fourier.cc index 55ec49cba2..67f942d560 100644 --- a/webrtc/common_audio/real_fourier.cc +++ b/webrtc/common_audio/real_fourier.cc @@ -21,11 +21,11 @@ using std::complex; const size_t RealFourier::kFftBufferAlignment = 32; -rtc::scoped_ptr RealFourier::Create(int fft_order) { +std::unique_ptr RealFourier::Create(int fft_order) { #if defined(RTC_USE_OPENMAX_DL) - return rtc::scoped_ptr(new RealFourierOpenmax(fft_order)); + return std::unique_ptr(new RealFourierOpenmax(fft_order)); #else - return rtc::scoped_ptr(new RealFourierOoura(fft_order)); + return std::unique_ptr(new RealFourierOoura(fft_order)); #endif } diff --git a/webrtc/common_audio/real_fourier.h b/webrtc/common_audio/real_fourier.h index 0be56a58b0..8dbb98f776 100644 --- a/webrtc/common_audio/real_fourier.h +++ b/webrtc/common_audio/real_fourier.h @@ -12,6 +12,7 @@ #define WEBRTC_COMMON_AUDIO_REAL_FOURIER_H_ #include +#include #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 fft_real_scoper; - typedef rtc::scoped_ptr[], AlignedFreeDeleter> + typedef std::unique_ptr fft_real_scoper; + typedef std::unique_ptr[], 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 Create(int fft_order); + static std::unique_ptr Create(int fft_order); virtual ~RealFourier() {}; // Helper to compute the smallest FFT order (a power of 2) which will contain diff --git a/webrtc/common_audio/vad/vad.cc b/webrtc/common_audio/vad/vad.cc index 99d6ffeee6..77de5166db 100644 --- a/webrtc/common_audio/vad/vad.cc +++ b/webrtc/common_audio/vad/vad.cc @@ -10,6 +10,8 @@ #include "webrtc/common_audio/vad/include/vad.h" +#include + #include "webrtc/base/checks.h" namespace webrtc { diff --git a/webrtc/examples/peerconnection/client/conductor.cc b/webrtc/examples/peerconnection/client/conductor.cc index e26d403248..8ec6ed9c10 100644 --- a/webrtc/examples/peerconnection/client/conductor.cc +++ b/webrtc/examples/peerconnection/client/conductor.cc @@ -10,6 +10,7 @@ #include "webrtc/examples/peerconnection/client/conductor.h" +#include #include #include @@ -308,7 +309,7 @@ void Conductor::OnMessageFromPeer(int peer_id, const std::string& message) { return; } webrtc::SdpParseError error; - rtc::scoped_ptr candidate( + std::unique_ptr candidate( webrtc::CreateIceCandidate(sdp_mid, sdp_mlineindex, sdp, &error)); if (!candidate.get()) { LOG(WARNING) << "Can't parse received candidate message. " diff --git a/webrtc/examples/peerconnection/client/linux/main_wnd.h b/webrtc/examples/peerconnection/client/linux/main_wnd.h index e756fc98c4..3c718577d1 100644 --- a/webrtc/examples/peerconnection/client/linux/main_wnd.h +++ b/webrtc/examples/peerconnection/client/linux/main_wnd.h @@ -11,6 +11,7 @@ #ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_ #define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_ +#include #include #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 image_; + std::unique_ptr 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 local_renderer_; - rtc::scoped_ptr remote_renderer_; - rtc::scoped_ptr draw_buffer_; + std::unique_ptr local_renderer_; + std::unique_ptr remote_renderer_; + std::unique_ptr draw_buffer_; int draw_buffer_size_; }; diff --git a/webrtc/examples/peerconnection/client/main_wnd.h b/webrtc/examples/peerconnection/client/main_wnd.h index 80db2a5adc..03db80d0b6 100644 --- a/webrtc/examples/peerconnection/client/main_wnd.h +++ b/webrtc/examples/peerconnection/client/main_wnd.h @@ -13,6 +13,7 @@ #pragma once #include +#include #include #include "webrtc/api/mediastreaminterface.h" @@ -131,7 +132,7 @@ class MainWnd : public MainWindow { HWND wnd_; BITMAPINFO bmi_; - rtc::scoped_ptr image_; + std::unique_ptr image_; CRITICAL_SECTION buffer_lock_; rtc::scoped_refptr rendered_track_; }; @@ -176,8 +177,8 @@ class MainWnd : public MainWindow { void HandleTabbing(); private: - rtc::scoped_ptr local_renderer_; - rtc::scoped_ptr remote_renderer_; + std::unique_ptr local_renderer_; + std::unique_ptr remote_renderer_; UI ui_; HWND wnd_; DWORD ui_thread_id_; diff --git a/webrtc/examples/peerconnection/client/peer_connection_client.h b/webrtc/examples/peerconnection/client/peer_connection_client.h index b7abfdfe18..bc8b8cc9c9 100644 --- a/webrtc/examples/peerconnection/client/peer_connection_client.h +++ b/webrtc/examples/peerconnection/client/peer_connection_client.h @@ -13,6 +13,7 @@ #pragma once #include +#include #include #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 control_socket_; - rtc::scoped_ptr hanging_get_; + std::unique_ptr control_socket_; + std::unique_ptr hanging_get_; std::string onconnect_data_; std::string control_data_; std::string notification_data_; diff --git a/webrtc/examples/relayserver/relayserver_main.cc b/webrtc/examples/relayserver/relayserver_main.cc index 31f43c4d15..c14ea459c8 100644 --- a/webrtc/examples/relayserver/relayserver_main.cc +++ b/webrtc/examples/relayserver/relayserver_main.cc @@ -9,9 +9,9 @@ */ #include // NOLINT +#include #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 int_socket( + std::unique_ptr 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 ext_socket( + std::unique_ptr ext_socket( rtc::AsyncUDPSocket::Create(pthMain->socketserver(), ext_addr)); if (!ext_socket) { std::cerr << "Failed to create a UDP socket bound at" diff --git a/webrtc/media/base/videoadapter_unittest.cc b/webrtc/media/base/videoadapter_unittest.cc index 1ad58d165c..d793d566dd 100644 --- a/webrtc/media/base/videoadapter_unittest.cc +++ b/webrtc/media/base/videoadapter_unittest.cc @@ -10,6 +10,7 @@ #include // For INT_MAX +#include #include #include diff --git a/webrtc/media/base/videobroadcaster.h b/webrtc/media/base/videobroadcaster.h index c89c7eea97..764c749b0c 100644 --- a/webrtc/media/base/videobroadcaster.h +++ b/webrtc/media/base/videobroadcaster.h @@ -11,6 +11,7 @@ #ifndef WEBRTC_MEDIA_BASE_VIDEOBROADCASTER_H_ #define WEBRTC_MEDIA_BASE_VIDEOBROADCASTER_H_ +#include #include #include @@ -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 black_frame_; + std::unique_ptr black_frame_; }; } // namespace rtc diff --git a/webrtc/media/base/videocapturer_unittest.cc b/webrtc/media/base/videocapturer_unittest.cc index bd145e33ea..6a3ebb0ce8 100644 --- a/webrtc/media/base/videocapturer_unittest.cc +++ b/webrtc/media/base/videocapturer_unittest.cc @@ -9,6 +9,8 @@ */ #include + +#include #include #include "webrtc/base/gunit.h" @@ -40,7 +42,7 @@ class VideoCapturerTest protected: void InitCapturer(bool is_screencast) { - capturer_ = rtc::scoped_ptr( + capturer_ = std::unique_ptr( 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 capturer_; + std::unique_ptr capturer_; cricket::CaptureState capture_state_; int num_state_changes_; cricket::FakeVideoRenderer renderer_; diff --git a/webrtc/media/engine/webrtcvoe.h b/webrtc/media/engine/webrtcvoe.h index c6d1cafcb0..238b4ce781 100644 --- a/webrtc/media/engine/webrtcvoe.h +++ b/webrtc/media/engine/webrtcvoe.h @@ -11,6 +11,8 @@ #ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_ #define WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_ +#include + #include "webrtc/base/common.h" #include "webrtc/media/engine/webrtccommon.h" diff --git a/webrtc/modules/audio_coding/codecs/audio_decoder_factory_unittest.cc b/webrtc/modules/audio_coding/codecs/audio_decoder_factory_unittest.cc index a1ae05d82a..d278b8473e 100644 --- a/webrtc/modules/audio_coding/codecs/audio_decoder_factory_unittest.cc +++ b/webrtc/modules/audio_coding/codecs/audio_decoder_factory_unittest.cc @@ -8,6 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include + #include "testing/gtest/include/gtest/gtest.h" #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" diff --git a/webrtc/modules/audio_coding/neteq/delay_peak_detector.h b/webrtc/modules/audio_coding/neteq/delay_peak_detector.h index 060e2e13d3..f57d3bd71e 100644 --- a/webrtc/modules/audio_coding/neteq/delay_peak_detector.h +++ b/webrtc/modules/audio_coding/neteq/delay_peak_detector.h @@ -14,6 +14,7 @@ #include // size_t #include +#include #include "webrtc/base/constructormagic.h" #include "webrtc/modules/audio_coding/neteq/tick_timer.h" diff --git a/webrtc/p2p/base/transport.cc b/webrtc/p2p/base/transport.cc index 3e45d20737..9688e4aedc 100644 --- a/webrtc/p2p/base/transport.cc +++ b/webrtc/p2p/base/transport.cc @@ -412,7 +412,7 @@ bool Transport::VerifyCertificateFingerprint( return BadTransportDescription( "Fingerprint provided but no identity available.", error_desc); } - rtc::scoped_ptr fp_tmp(rtc::SSLFingerprint::Create( + std::unique_ptr fp_tmp(rtc::SSLFingerprint::Create( fingerprint->algorithm, certificate->identity())); ASSERT(fp_tmp.get() != NULL); if (*fp_tmp == *fingerprint) { diff --git a/webrtc/p2p/base/transport_unittest.cc b/webrtc/p2p/base/transport_unittest.cc index fba72b43de..cde60ce964 100644 --- a/webrtc/p2p/base/transport_unittest.cc +++ b/webrtc/p2p/base/transport_unittest.cc @@ -245,7 +245,7 @@ TEST_F(TransportTest, TestVerifyCertificateFingerprint) { for (auto& key_type : key_types) { rtc::scoped_refptr certificate = - rtc::RTCCertificate::Create(rtc::scoped_ptr( + rtc::RTCCertificate::Create(std::unique_ptr( 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 good_fingerprint( + std::unique_ptr good_fingerprint( rtc::SSLFingerprint::Create(digest_algorithm, certificate->identity())); ASSERT_NE(nullptr, good_fingerprint); diff --git a/webrtc/p2p/quic/quictransport.h b/webrtc/p2p/quic/quictransport.h index 053ba61335..14bd13f3b2 100644 --- a/webrtc/p2p/quic/quictransport.h +++ b/webrtc/p2p/quic/quictransport.h @@ -13,6 +13,7 @@ #include #include +#include #include "webrtc/p2p/base/transport.h" #include "webrtc/p2p/quic/quictransportchannel.h" @@ -55,7 +56,7 @@ class QuicTransport : public Transport { private: rtc::scoped_refptr local_certificate_; rtc::SSLRole local_role_ = rtc::SSL_CLIENT; - rtc::scoped_ptr remote_fingerprint_; + std::unique_ptr remote_fingerprint_; }; } // namespace cricket diff --git a/webrtc/p2p/quic/quictransport_unittest.cc b/webrtc/p2p/quic/quictransport_unittest.cc index bc99f6bd31..1fd48f7ec4 100644 --- a/webrtc/p2p/quic/quictransport_unittest.cc +++ b/webrtc/p2p/quic/quictransport_unittest.cc @@ -10,6 +10,7 @@ #include "webrtc/p2p/quic/quictransport.h" +#include #include #include @@ -30,15 +31,15 @@ static const char kIcePwd2[] = "TESTICEPWD00000000000002"; static rtc::scoped_refptr CreateCertificate( std::string name) { - return rtc::RTCCertificate::Create(rtc::scoped_ptr( + return rtc::RTCCertificate::Create(std::unique_ptr( rtc::SSLIdentity::Generate(name, rtc::KT_DEFAULT))); } -static rtc::scoped_ptr CreateFingerprint( +static std::unique_ptr CreateFingerprint( rtc::RTCCertificate* cert) { std::string digest_algorithm; cert->ssl_certificate().GetSignatureDigestAlgorithm(&digest_algorithm); - return rtc::scoped_ptr( + return std::unique_ptr( 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 local_fingerprint = + std::unique_ptr local_fingerprint = CreateFingerprint(local_certificate.get()); ASSERT_NE(nullptr, local_fingerprint); TransportDescription local_desc(std::vector(), 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 remote_fingerprint = + std::unique_ptr 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 role(new rtc::SSLRole()); + std::unique_ptr role(new rtc::SSLRole()); EXPECT_FALSE(channel->GetSslRole(role.get())); // Setting the remote description should set the SSL role. ASSERT_NE(nullptr, remote_fingerprint); diff --git a/webrtc/pc/yuvscaler_unittest.cc b/webrtc/pc/yuvscaler_unittest.cc index 9e0f8ed2c0..a33d49523d 100644 --- a/webrtc/pc/yuvscaler_unittest.cc +++ b/webrtc/pc/yuvscaler_unittest.cc @@ -8,6 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include #include #include "libyuv/cpu_id.h" diff --git a/webrtc/sdk/objc/Framework/Classes/RTCDataChannel.mm b/webrtc/sdk/objc/Framework/Classes/RTCDataChannel.mm index cdc7e98db5..9948615a6a 100644 --- a/webrtc/sdk/objc/Framework/Classes/RTCDataChannel.mm +++ b/webrtc/sdk/objc/Framework/Classes/RTCDataChannel.mm @@ -12,7 +12,7 @@ #import "NSString+StdString.h" -#include "webrtc/base/scoped_ptr.h" +#include namespace webrtc { @@ -46,7 +46,7 @@ class DataChannelDelegateAdapter : public DataChannelObserver { @implementation RTCDataBuffer { - rtc::scoped_ptr _dataBuffer; + std::unique_ptr _dataBuffer; } - (instancetype)initWithData:(NSData *)data isBinary:(BOOL)isBinary { @@ -86,7 +86,7 @@ class DataChannelDelegateAdapter : public DataChannelObserver { @implementation RTCDataChannel { rtc::scoped_refptr _nativeDataChannel; - rtc::scoped_ptr _observer; + std::unique_ptr _observer; BOOL _isObserverRegistered; } diff --git a/webrtc/sdk/objc/Framework/Classes/RTCFileLogger.mm b/webrtc/sdk/objc/Framework/Classes/RTCFileLogger.mm index 73335f39da..c1fbd747c3 100644 --- a/webrtc/sdk/objc/Framework/Classes/RTCFileLogger.mm +++ b/webrtc/sdk/objc/Framework/Classes/RTCFileLogger.mm @@ -10,11 +10,12 @@ #import "WebRTC/RTCFileLogger.h" +#include + #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 _logSink; + std::unique_ptr _logSink; } @synthesize severity = _severity; @@ -129,7 +130,7 @@ const char *kRTCFileLoggerRotatingLogPrefix = "rotating_log"; return nil; } NSMutableData* logData = [NSMutableData data]; - rtc::scoped_ptr stream; + std::unique_ptr 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 buffer(static_cast(malloc(bufferSize))); + std::unique_ptr buffer(static_cast(malloc(bufferSize))); stream->ReadAll(buffer.get(), bufferSize, &read, nullptr); logData = [[NSMutableData alloc] initWithBytesNoCopy:buffer.release() length:read]; diff --git a/webrtc/sdk/objc/Framework/Classes/RTCIceCandidate+Private.h b/webrtc/sdk/objc/Framework/Classes/RTCIceCandidate+Private.h index ba3ffb6e86..04858cfbc3 100644 --- a/webrtc/sdk/objc/Framework/Classes/RTCIceCandidate+Private.h +++ b/webrtc/sdk/objc/Framework/Classes/RTCIceCandidate+Private.h @@ -10,6 +10,8 @@ #import "WebRTC/RTCIceCandidate.h" +#include + #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 nativeCandidate; + std::unique_ptr nativeCandidate; /** * Initialize an RTCIceCandidate from a native IceCandidateInterface. No diff --git a/webrtc/sdk/objc/Framework/Classes/RTCIceCandidate.mm b/webrtc/sdk/objc/Framework/Classes/RTCIceCandidate.mm index 7b1e65568b..193403d11d 100644 --- a/webrtc/sdk/objc/Framework/Classes/RTCIceCandidate.mm +++ b/webrtc/sdk/objc/Framework/Classes/RTCIceCandidate.mm @@ -10,6 +10,8 @@ #import "RTCIceCandidate+Private.h" +#include + #import "NSString+StdString.h" #import "WebRTC/RTCLogging.h" @@ -51,7 +53,7 @@ sdpMid:[NSString stringForStdString:candidate->sdp_mid()]]; } -- (rtc::scoped_ptr)nativeCandidate { +- (std::unique_ptr)nativeCandidate { webrtc::SdpParseError error; webrtc::IceCandidateInterface *candidate = webrtc::CreateIceCandidate( @@ -63,7 +65,7 @@ error.line.c_str()); } - return rtc::scoped_ptr(candidate); + return std::unique_ptr(candidate); } @end diff --git a/webrtc/sdk/objc/Framework/Classes/RTCMediaConstraints+Private.h b/webrtc/sdk/objc/Framework/Classes/RTCMediaConstraints+Private.h index 3662c4486a..6ad3b6d899 100644 --- a/webrtc/sdk/objc/Framework/Classes/RTCMediaConstraints+Private.h +++ b/webrtc/sdk/objc/Framework/Classes/RTCMediaConstraints+Private.h @@ -10,6 +10,8 @@ #import "WebRTC/RTCMediaConstraints.h" +#include + #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)nativeConstraints; +- (std::unique_ptr)nativeConstraints; /** Return a native Constraints object representing these constraints */ + (webrtc::MediaConstraintsInterface::Constraints) diff --git a/webrtc/sdk/objc/Framework/Classes/RTCMediaConstraints.mm b/webrtc/sdk/objc/Framework/Classes/RTCMediaConstraints.mm index 7a7cdf15cf..11be2ec026 100644 --- a/webrtc/sdk/objc/Framework/Classes/RTCMediaConstraints.mm +++ b/webrtc/sdk/objc/Framework/Classes/RTCMediaConstraints.mm @@ -12,6 +12,8 @@ #import "NSString+StdString.h" +#include + namespace webrtc { MediaConstraints::~MediaConstraints() {} @@ -62,7 +64,7 @@ MediaConstraints::GetOptional() const { #pragma mark - Private -- (rtc::scoped_ptr)nativeConstraints { +- (std::unique_ptr)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(nativeConstraints); + return std::unique_ptr(nativeConstraints); } + (webrtc::MediaConstraintsInterface::Constraints) diff --git a/webrtc/sdk/objc/Framework/Classes/RTCOpenGLVideoRenderer.mm b/webrtc/sdk/objc/Framework/Classes/RTCOpenGLVideoRenderer.mm index ab45ca4821..7d7b416b88 100644 --- a/webrtc/sdk/objc/Framework/Classes/RTCOpenGLVideoRenderer.mm +++ b/webrtc/sdk/objc/Framework/Classes/RTCOpenGLVideoRenderer.mm @@ -16,10 +16,10 @@ #import #endif #include +#include #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 _planeBuffer; + std::unique_ptr _planeBuffer; } @synthesize lastDrawnFrame = _lastDrawnFrame; diff --git a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm index 46ea52a8f6..3b7632c2b9 100644 --- a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm +++ b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm @@ -22,6 +22,8 @@ #import "RTCStatsReport+Private.h" #import "WebRTC/RTCLogging.h" +#include + #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 description = - rtc::scoped_ptr(desc); + std::unique_ptr description = + std::unique_ptr(desc); RTCSessionDescription* session = [[RTCSessionDescription alloc] initWithNativeDescription: description.get()]; @@ -184,7 +186,7 @@ void PeerConnectionDelegateAdapter::OnIceCandidate( @implementation RTCPeerConnection { NSMutableArray *_localStreams; - rtc::scoped_ptr _observer; + std::unique_ptr _observer; rtc::scoped_refptr _peerConnection; } @@ -199,7 +201,7 @@ void PeerConnectionDelegateAdapter::OnIceCandidate( _observer.reset(new webrtc::PeerConnectionDelegateAdapter(self)); webrtc::PeerConnectionInterface::RTCConfiguration config = configuration.nativeConfiguration; - rtc::scoped_ptr nativeConstraints = + std::unique_ptr nativeConstraints = constraints.nativeConstraints; _peerConnection = factory.nativeFactory->CreatePeerConnection(config, @@ -257,7 +259,7 @@ void PeerConnectionDelegateAdapter::OnIceCandidate( } - (void)addIceCandidate:(RTCIceCandidate *)candidate { - rtc::scoped_ptr iceCandidate( + std::unique_ptr iceCandidate( candidate.nativeCandidate); _peerConnection->AddIceCandidate(iceCandidate.get()); } diff --git a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm index 04aa121a6d..82d77077d7 100644 --- a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm +++ b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm @@ -20,9 +20,11 @@ #import "RTCVideoSource+Private.h" #import "RTCVideoTrack+Private.h" +#include + @implementation RTCPeerConnectionFactory { - rtc::scoped_ptr _signalingThread; - rtc::scoped_ptr _workerThread; + std::unique_ptr _signalingThread; + std::unique_ptr _workerThread; } @synthesize nativeFactory = _nativeFactory; diff --git a/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm b/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm index 8a99d4e5ef..1fb26954a3 100644 --- a/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm +++ b/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm @@ -10,10 +10,10 @@ #import "RTCVideoFrame+Private.h" -#include "webrtc/base/scoped_ptr.h" +#include @implementation RTCVideoFrame { - rtc::scoped_ptr _videoFrame; + std::unique_ptr _videoFrame; rtc::scoped_refptr _i420Buffer; } diff --git a/webrtc/sdk/objc/Framework/Classes/RTCVideoRendererAdapter.mm b/webrtc/sdk/objc/Framework/Classes/RTCVideoRendererAdapter.mm index 1d64cd8d08..4976ba9f1f 100644 --- a/webrtc/sdk/objc/Framework/Classes/RTCVideoRendererAdapter.mm +++ b/webrtc/sdk/objc/Framework/Classes/RTCVideoRendererAdapter.mm @@ -12,6 +12,8 @@ #import "RTCVideoFrame+Private.h" +#include + #include "webrtc/media/engine/webrtcvideoframe.h" namespace webrtc { @@ -60,7 +62,7 @@ class VideoRendererAdapter } @implementation RTCVideoRendererAdapter { - rtc::scoped_ptr _adapter; + std::unique_ptr _adapter; } @synthesize videoRenderer = _videoRenderer; diff --git a/webrtc/sdk/objc/Framework/UnitTests/RTCIceCandidateTest.mm b/webrtc/sdk/objc/Framework/UnitTests/RTCIceCandidateTest.mm index 6d751ccdb8..20a9d739a9 100644 --- a/webrtc/sdk/objc/Framework/UnitTests/RTCIceCandidateTest.mm +++ b/webrtc/sdk/objc/Framework/UnitTests/RTCIceCandidateTest.mm @@ -10,6 +10,8 @@ #import +#include + #include "webrtc/base/gunit.h" #import "NSString+StdString.h" @@ -32,7 +34,7 @@ sdpMLineIndex:0 sdpMid:@"audio"]; - rtc::scoped_ptr nativeCandidate = + std::unique_ptr nativeCandidate = candidate.nativeCandidate; EXPECT_EQ("audio", nativeCandidate->sdp_mid()); EXPECT_EQ(0, nativeCandidate->sdp_mline_index()); diff --git a/webrtc/sdk/objc/Framework/UnitTests/RTCMediaConstraintsTest.mm b/webrtc/sdk/objc/Framework/UnitTests/RTCMediaConstraintsTest.mm index 2c99cfe61e..3413dfc039 100644 --- a/webrtc/sdk/objc/Framework/UnitTests/RTCMediaConstraintsTest.mm +++ b/webrtc/sdk/objc/Framework/UnitTests/RTCMediaConstraintsTest.mm @@ -10,6 +10,8 @@ #import +#include + #include "webrtc/base/gunit.h" #import "NSString+StdString.h" @@ -29,7 +31,7 @@ RTCMediaConstraints *constraints = [[RTCMediaConstraints alloc] initWithMandatoryConstraints:mandatory optionalConstraints:optional]; - rtc::scoped_ptr nativeConstraints = + std::unique_ptr nativeConstraints = [constraints nativeConstraints]; webrtc::MediaConstraintsInterface::Constraints nativeMandatory = diff --git a/webrtc/system_wrappers/include/aligned_malloc.h b/webrtc/system_wrappers/include/aligned_malloc.h index 277abec020..bdd82ccfd8 100644 --- a/webrtc/system_wrappers/include/aligned_malloc.h +++ b/webrtc/system_wrappers/include/aligned_malloc.h @@ -46,8 +46,8 @@ T* AlignedMalloc(size_t size, size_t alignment) { return reinterpret_cast(AlignedMalloc(size, alignment)); } -// Deleter for use with scoped_ptr. E.g., use as -// scoped_ptr foo; +// Deleter for use with unique_ptr. E.g., use as +// std::unique_ptr foo; struct AlignedFreeDeleter { inline void operator()(void* ptr) const { AlignedFree(ptr); diff --git a/webrtc/system_wrappers/include/clock.h b/webrtc/system_wrappers/include/clock.h index f443057bea..8245ecd9f4 100644 --- a/webrtc/system_wrappers/include/clock.h +++ b/webrtc/system_wrappers/include/clock.h @@ -11,6 +11,8 @@ #ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CLOCK_H_ #define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CLOCK_H_ +#include + #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 lock_; + std::unique_ptr lock_; }; }; // namespace webrtc diff --git a/webrtc/system_wrappers/include/data_log_impl.h b/webrtc/system_wrappers/include/data_log_impl.h index 35519609b9..c68c82985e 100644 --- a/webrtc/system_wrappers/include/data_log_impl.h +++ b/webrtc/system_wrappers/include/data_log_impl.h @@ -18,6 +18,7 @@ #define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_DATA_LOG_IMPL_H_ #include +#include #include #include #include @@ -139,16 +140,16 @@ class DataLogImpl { // Collection of tables indexed by the table name as std::string. typedef std::map TableMap; - typedef rtc::scoped_ptr CritSectScopedPtr; + typedef std::unique_ptr 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 file_writer_thread_; + std::unique_ptr file_writer_thread_; RWLockWrapper* tables_lock_; }; diff --git a/webrtc/system_wrappers/include/utf_util_win.h b/webrtc/system_wrappers/include/utf_util_win.h index 0e3f2d01c6..730aa4649e 100644 --- a/webrtc/system_wrappers/include/utf_util_win.h +++ b/webrtc/system_wrappers/include/utf_util_win.h @@ -15,6 +15,8 @@ #ifdef WIN32 #include + +#include #include #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(len), NULL, 0); - rtc::scoped_ptr ws(new wchar_t[len16]); + std::unique_ptr ws(new wchar_t[len16]); ::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast(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(len), NULL, 0, NULL, NULL); - rtc::scoped_ptr ns(new char[len8]); + std::unique_ptr ns(new char[len8]); ::WideCharToMultiByte(CP_UTF8, 0, wide, static_cast(len), ns.get(), len8, NULL, NULL); return std::string(ns.get(), len8); diff --git a/webrtc/system_wrappers/source/aligned_malloc_unittest.cc b/webrtc/system_wrappers/source/aligned_malloc_unittest.cc index 3933c2ac05..ed6cd424db 100644 --- a/webrtc/system_wrappers/source/aligned_malloc_unittest.cc +++ b/webrtc/system_wrappers/source/aligned_malloc_unittest.cc @@ -10,6 +10,8 @@ #include "webrtc/system_wrappers/include/aligned_malloc.h" +#include + #if _WIN32 #include #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 scoped( + std::unique_ptr scoped( static_cast(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 scoped( + std::unique_ptr scoped( static_cast(AlignedMalloc(size, alignment))); EXPECT_TRUE(scoped.get() != NULL); const uintptr_t aligned_address = reinterpret_cast (scoped.get()); diff --git a/webrtc/system_wrappers/source/condition_variable_unittest.cc b/webrtc/system_wrappers/source/condition_variable_unittest.cc index 4b1b6cc608..bf245e6b6b 100644 --- a/webrtc/system_wrappers/source/condition_variable_unittest.cc +++ b/webrtc/system_wrappers/source/condition_variable_unittest.cc @@ -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" diff --git a/webrtc/system_wrappers/source/file_impl.h b/webrtc/system_wrappers/source/file_impl.h index 06ba58200b..8764f720f3 100644 --- a/webrtc/system_wrappers/source/file_impl.h +++ b/webrtc/system_wrappers/source/file_impl.h @@ -13,6 +13,8 @@ #include +#include + #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 rw_lock_; + std::unique_ptr rw_lock_; FILE* id_; bool managed_file_handle_; diff --git a/webrtc/system_wrappers/source/logging_unittest.cc b/webrtc/system_wrappers/source/logging_unittest.cc index 695b03f93a..118c3425bf 100644 --- a/webrtc/system_wrappers/source/logging_unittest.cc +++ b/webrtc/system_wrappers/source/logging_unittest.cc @@ -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 { diff --git a/webrtc/system_wrappers/source/trace_impl.h b/webrtc/system_wrappers/source/trace_impl.h index c6d81d5b0b..5e459765cd 100644 --- a/webrtc/system_wrappers/source/trace_impl.h +++ b/webrtc/system_wrappers/source/trace_impl.h @@ -11,6 +11,8 @@ #ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_IMPL_H_ #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_IMPL_H_ +#include + #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 trace_file_ GUARDED_BY(crit_); + const std::unique_ptr trace_file_ GUARDED_BY(crit_); rtc::CriticalSection crit_; }; diff --git a/webrtc/test/call_test.h b/webrtc/test/call_test.h index 41a6b5a6c2..ebc2bb2a54 100644 --- a/webrtc/test/call_test.h +++ b/webrtc/test/call_test.h @@ -82,22 +82,22 @@ class CallTest : public ::testing::Test { Clock* const clock_; - rtc::scoped_ptr sender_call_; - rtc::scoped_ptr send_transport_; + std::unique_ptr sender_call_; + std::unique_ptr 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 receiver_call_; - rtc::scoped_ptr receive_transport_; + std::unique_ptr receiver_call_; + std::unique_ptr receive_transport_; std::vector video_receive_configs_; std::vector video_receive_streams_; std::vector audio_receive_configs_; std::vector audio_receive_streams_; - rtc::scoped_ptr frame_generator_capturer_; + std::unique_ptr frame_generator_capturer_; test::FakeEncoder fake_encoder_; std::vector> 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 fake_send_audio_device_; - rtc::scoped_ptr fake_recv_audio_device_; + std::unique_ptr fake_send_audio_device_; + std::unique_ptr fake_recv_audio_device_; }; class BaseTest : public RtpRtcpObserver { diff --git a/webrtc/test/configurable_frame_size_encoder.h b/webrtc/test/configurable_frame_size_encoder.h index 3794e8db08..0da5d20c15 100644 --- a/webrtc/test/configurable_frame_size_encoder.h +++ b/webrtc/test/configurable_frame_size_encoder.h @@ -11,6 +11,7 @@ #ifndef WEBRTC_TEST_CONFIGURABLE_FRAME_SIZE_ENCODER_H_ #define WEBRTC_TEST_CONFIGURABLE_FRAME_SIZE_ENCODER_H_ +#include #include #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 buffer_; + std::unique_ptr buffer_; }; } // namespace test diff --git a/webrtc/test/fake_audio_device.h b/webrtc/test/fake_audio_device.h index 180abf6c92..39f9310cd2 100644 --- a/webrtc/test/fake_audio_device.h +++ b/webrtc/test/fake_audio_device.h @@ -10,6 +10,7 @@ #ifndef WEBRTC_TEST_FAKE_AUDIO_DEVICE_H_ #define WEBRTC_TEST_FAKE_AUDIO_DEVICE_H_ +#include #include #include "webrtc/base/criticalsection.h" @@ -59,11 +60,11 @@ class FakeAudioDevice : public FakeAudioDeviceModule { int64_t last_playout_ms_; DriftingClock clock_; - rtc::scoped_ptr tick_; + std::unique_ptr tick_; rtc::CriticalSection lock_; rtc::PlatformThread thread_; - rtc::scoped_ptr file_utility_; - rtc::scoped_ptr input_stream_; + std::unique_ptr file_utility_; + std::unique_ptr input_stream_; }; } // namespace test } // namespace webrtc diff --git a/webrtc/test/fake_network_pipe.h b/webrtc/test/fake_network_pipe.h index d488d492c8..3c2db86214 100644 --- a/webrtc/test/fake_network_pipe.h +++ b/webrtc/test/fake_network_pipe.h @@ -11,6 +11,7 @@ #ifndef WEBRTC_TEST_FAKE_NETWORK_PIPE_H_ #define WEBRTC_TEST_FAKE_NETWORK_PIPE_H_ +#include #include #include #include @@ -50,7 +51,7 @@ class NetworkPacket { private: // The packet data. - rtc::scoped_ptr data_; + std::unique_ptr data_; // Length of data_. size_t data_length_; // The time the packet was sent out on the network. diff --git a/webrtc/test/fake_network_pipe_unittest.cc b/webrtc/test/fake_network_pipe_unittest.cc index 233c5972b3..0bd46df7fc 100644 --- a/webrtc/test/fake_network_pipe_unittest.cc +++ b/webrtc/test/fake_network_pipe_unittest.cc @@ -8,10 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include + #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(sizeof(int))); - rtc::scoped_ptr packet(new uint8_t[packet_size]); + std::unique_ptr 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 receiver_; + std::unique_ptr 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 pipe( + std::unique_ptr 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 pipe( + std::unique_ptr 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 pipe( + std::unique_ptr 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 pipe( + std::unique_ptr 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 pipe( + std::unique_ptr 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 pipe( + std::unique_ptr 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 pipe( + std::unique_ptr pipe( new FakeNetworkPipe(&fake_clock_, config)); ReorderTestReceiver* receiver = new ReorderTestReceiver(); receiver_.reset(receiver); diff --git a/webrtc/test/frame_generator.cc b/webrtc/test/frame_generator.cc index 3287abab81..4da909d669 100644 --- a/webrtc/test/frame_generator.cc +++ b/webrtc/test/frame_generator.cc @@ -13,6 +13,8 @@ #include #include +#include + #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 frame_buffer_; + const std::unique_ptr frame_buffer_; const int frame_display_count_; int current_display_count_; VideoFrame last_read_frame_; diff --git a/webrtc/test/frame_generator_capturer.h b/webrtc/test/frame_generator_capturer.h index 91ed843395..2b34dd2c59 100644 --- a/webrtc/test/frame_generator_capturer.h +++ b/webrtc/test/frame_generator_capturer.h @@ -10,6 +10,7 @@ #ifndef WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_ #define WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_ +#include #include #include "webrtc/base/criticalsection.h" @@ -64,10 +65,10 @@ class FrameGeneratorCapturer : public VideoCapturer { Clock* const clock_; bool sending_; - rtc::scoped_ptr tick_; + std::unique_ptr tick_; rtc::CriticalSection lock_; rtc::PlatformThread thread_; - rtc::scoped_ptr frame_generator_; + std::unique_ptr frame_generator_; int target_fps_; VideoRotation fake_rotation_ = kVideoRotation_0; diff --git a/webrtc/test/frame_generator_unittest.cc b/webrtc/test/frame_generator_unittest.cc index 6376e2c221..10acd46165 100644 --- a/webrtc/test/frame_generator_unittest.cc +++ b/webrtc/test/frame_generator_unittest.cc @@ -9,10 +9,11 @@ */ #include + +#include #include #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 plane_buffer(new uint8_t[y_size]); + std::unique_ptr 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 generator(FrameGenerator::CreateFromYuvFile( + std::unique_ptr generator(FrameGenerator::CreateFromYuvFile( std::vector(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 generator(FrameGenerator::CreateFromYuvFile( + std::unique_ptr generator(FrameGenerator::CreateFromYuvFile( std::vector(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 generator( + std::unique_ptr 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 generator(FrameGenerator::CreateFromYuvFile( + std::unique_ptr generator(FrameGenerator::CreateFromYuvFile( std::vector(1, two_frame_filename_), kFrameWidth, kFrameHeight, kRepeatCount)); for (int i = 0; i < kRepeatCount; ++i) @@ -134,7 +135,7 @@ TEST_F(FrameGeneratorTest, MultipleFrameFilesWithRepeat) { std::vector files; files.push_back(two_frame_filename_); files.push_back(one_frame_filename_); - rtc::scoped_ptr generator(FrameGenerator::CreateFromYuvFile( + std::unique_ptr generator(FrameGenerator::CreateFromYuvFile( files, kFrameWidth, kFrameHeight, kRepeatCount)); for (int i = 0; i < kRepeatCount; ++i) CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0); diff --git a/webrtc/test/fuzzers/producer_fec_fuzzer.cc b/webrtc/test/fuzzers/producer_fec_fuzzer.cc index abde879537..53f7493869 100644 --- a/webrtc/test/fuzzers/producer_fec_fuzzer.cc +++ b/webrtc/test/fuzzers/producer_fec_fuzzer.cc @@ -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 + #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 packet( + std::unique_ptr packet( new uint8_t[payload_size + rtp_header_length]); memcpy(packet.get(), &data[i], payload_size + rtp_header_length); ByteWriter::WriteBigEndian(&packet[2], seq_num++); i += payload_size + rtp_header_length; // Make sure sequence numbers are increasing. const int kRedPayloadType = 98; - rtc::scoped_ptr red_packet(producer.BuildRedPacket( + std::unique_ptr red_packet(producer.BuildRedPacket( packet.get(), payload_size, rtp_header_length, kRedPayloadType)); const bool protect = data[i++] % 2 == 1; if (protect) { diff --git a/webrtc/test/fuzzers/rtcp_receiver_fuzzer.cc b/webrtc/test/fuzzers/rtcp_receiver_fuzzer.cc index 944c79d7d3..b7a4fdfdf8 100644 --- a/webrtc/test/fuzzers/rtcp_receiver_fuzzer.cc +++ b/webrtc/test/fuzzers/rtcp_receiver_fuzzer.cc @@ -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" diff --git a/webrtc/test/layer_filtering_transport.cc b/webrtc/test/layer_filtering_transport.cc index 41d63ad6e7..cba1a57eb4 100644 --- a/webrtc/test/layer_filtering_transport.cc +++ b/webrtc/test/layer_filtering_transport.cc @@ -8,6 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include + #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 depacketizer( + std::unique_ptr depacketizer( RtpDepacketizer::Create(is_vp8 ? kRtpVideoVp8 : kRtpVideoVp9)); RtpDepacketizer::ParsedPayload parsed_payload; if (depacketizer->Parse(&parsed_payload, payload, payload_data_length)) { diff --git a/webrtc/test/rtp_file_reader.cc b/webrtc/test/rtp_file_reader.cc index 476767ad57..d437d41924 100644 --- a/webrtc/test/rtp_file_reader.cc +++ b/webrtc/test/rtp_file_reader.cc @@ -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 { diff --git a/webrtc/test/rtp_file_reader_unittest.cc b/webrtc/test/rtp_file_reader_unittest.cc index 15a456ccf6..fceac3836d 100644 --- a/webrtc/test/rtp_file_reader_unittest.cc +++ b/webrtc/test/rtp_file_reader_unittest.cc @@ -9,9 +9,9 @@ */ #include +#include #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 rtp_packet_source_; + std::unique_ptr rtp_packet_source_; bool headers_only_file_; }; @@ -94,7 +94,7 @@ class TestPcapFileReader : public ::testing::Test { } private: - rtc::scoped_ptr rtp_packet_source_; + std::unique_ptr rtp_packet_source_; }; TEST_F(TestPcapFileReader, TestEthernetIIFrame) { diff --git a/webrtc/test/rtp_file_writer_unittest.cc b/webrtc/test/rtp_file_writer_unittest.cc index 2c7c88cc3f..3287f976c6 100644 --- a/webrtc/test/rtp_file_writer_unittest.cc +++ b/webrtc/test/rtp_file_writer_unittest.cc @@ -10,8 +10,9 @@ #include +#include + #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 rtp_reader( + std::unique_ptr 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 rtp_writer_; + std::unique_ptr rtp_writer_; std::string filename_; }; diff --git a/webrtc/test/rtp_rtcp_observer.h b/webrtc/test/rtp_rtcp_observer.h index 5eb88d3f0d..ab86561167 100644 --- a/webrtc/test/rtp_rtcp_observer.h +++ b/webrtc/test/rtp_rtcp_observer.h @@ -11,6 +11,7 @@ #define WEBRTC_TEST_RTP_RTCP_OBSERVER_H_ #include +#include #include #include "testing/gtest/include/gtest/gtest.h" @@ -69,7 +70,7 @@ class RtpRtcpObserver { } rtc::Event observation_complete_; - const rtc::scoped_ptr parser_; + const std::unique_ptr parser_; private: const int timeout_ms_; diff --git a/webrtc/test/test_suite.h b/webrtc/test/test_suite.h index dab2acd388..94b11cfbeb 100644 --- a/webrtc/test/test_suite.h +++ b/webrtc/test/test_suite.h @@ -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 + #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 trace_to_stderr_; + std::unique_ptr trace_to_stderr_; }; } // namespace test diff --git a/webrtc/test/testsupport/fileutils.cc b/webrtc/test/testsupport/fileutils.cc index 2fab425a31..d99b990918 100644 --- a/webrtc/test/testsupport/fileutils.cc +++ b/webrtc/test/testsupport/fileutils.cc @@ -23,7 +23,6 @@ #else #include -#include "webrtc/base/scoped_ptr.h" #define GET_CURRENT_DIR getcwd #endif @@ -36,6 +35,8 @@ #include #include +#include + #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 tempname(new char[len]); + std::unique_ptr tempname(new char[len]); snprintf(tempname.get(), len, "%s/%sXXXXXX", dir.c_str(), prefix.c_str()); diff --git a/webrtc/tools/agc/activity_metric.cc b/webrtc/tools/agc/activity_metric.cc index 258d02377e..6c1f756ec5 100644 --- a/webrtc/tools/agc/activity_metric.cc +++ b/webrtc/tools/agc/activity_metric.cc @@ -14,10 +14,10 @@ #include #include +#include #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 audio_content_; - rtc::scoped_ptr audio_processing_; - rtc::scoped_ptr vad_; - rtc::scoped_ptr standalone_vad_; + std::unique_ptr audio_content_; + std::unique_ptr audio_processing_; + std::unique_ptr vad_; + std::unique_ptr standalone_vad_; FILE* audio_content_fid_; }; diff --git a/webrtc/tools/agc/agc_harness.cc b/webrtc/tools/agc/agc_harness.cc index 0d35d4b56a..17919629b9 100644 --- a/webrtc/tools/agc/agc_harness.cc +++ b/webrtc/tools/agc/agc_harness.cc @@ -10,10 +10,11 @@ // Refer to kUsage below for a description. +#include + #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 channel_transport_; + std::unique_ptr channel_transport_; }; void RunHarness() { - rtc::scoped_ptr voe1(new AgcVoiceEngine( + std::unique_ptr voe1(new AgcVoiceEngine( FLAGS_legacy_agc, 2000, 2000, FLAGS_capture1, FLAGS_render1)); - rtc::scoped_ptr voe2; + std::unique_ptr voe2; if (FLAGS_parallel) { voe2.reset(new AgcVoiceEngine(!FLAGS_legacy_agc, 3000, 3000, FLAGS_capture2, FLAGS_render2)); diff --git a/webrtc/tools/e2e_quality/audio/audio_e2e_harness.cc b/webrtc/tools/e2e_quality/audio/audio_e2e_harness.cc index 2594fd1317..fb07b569fa 100644 --- a/webrtc/tools/e2e_quality/audio/audio_e2e_harness.cc +++ b/webrtc/tools/e2e_quality/audio/audio_e2e_harness.cc @@ -12,10 +12,11 @@ // and runs forever. Some parameters can be configured through command-line // flags. +#include + #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 voice_channel_transport( + std::unique_ptr voice_channel_transport( new VoiceChannelTransport(network, channel)); ASSERT_EQ(0, voice_channel_transport->SetSendDestination("127.0.0.1", 1234)); diff --git a/webrtc/tools/force_mic_volume_max/force_mic_volume_max.cc b/webrtc/tools/force_mic_volume_max/force_mic_volume_max.cc index b6b1596866..2bab2881bb 100644 --- a/webrtc/tools/force_mic_volume_max/force_mic_volume_max.cc +++ b/webrtc/tools/force_mic_volume_max/force_mic_volume_max.cc @@ -12,7 +12,6 @@ #include -#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" diff --git a/webrtc/tools/frame_editing/frame_editing_lib.cc b/webrtc/tools/frame_editing/frame_editing_lib.cc index 90855a354c..bb6a75edaa 100644 --- a/webrtc/tools/frame_editing/frame_editing_lib.cc +++ b/webrtc/tools/frame_editing/frame_editing_lib.cc @@ -11,9 +11,9 @@ #include #include +#include #include -#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 temp_buffer(new uint8_t[frame_length]); + std::unique_ptr temp_buffer(new uint8_t[frame_length]); FILE* out_fid = fopen(out_path.c_str(), "wb"); diff --git a/webrtc/tools/frame_editing/frame_editing_unittest.cc b/webrtc/tools/frame_editing/frame_editing_unittest.cc index 31991b7175..e1ba1de0fc 100644 --- a/webrtc/tools/frame_editing/frame_editing_unittest.cc +++ b/webrtc/tools/frame_editing/frame_editing_unittest.cc @@ -12,9 +12,9 @@ #include #include +#include #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* ref_buffer, - rtc::scoped_ptr* test_buffer) { + std::unique_ptr* ref_buffer, + std::unique_ptr* 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 original_buffer_; - rtc::scoped_ptr edited_buffer_; + std::unique_ptr original_buffer_; + std::unique_ptr edited_buffer_; int num_frames_read_; }; diff --git a/webrtc/video/video_capture_input.h b/webrtc/video/video_capture_input.h index baf20820db..5877f6c94f 100644 --- a/webrtc/video/video_capture_input.h +++ b/webrtc/video/video_capture_input.h @@ -11,6 +11,7 @@ #ifndef WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_ #define WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_ +#include #include #include "webrtc/base/criticalsection.h" diff --git a/webrtc/video/video_send_stream.h b/webrtc/video/video_send_stream.h index ad438ae0cb..475b58e56a 100644 --- a/webrtc/video/video_send_stream.h +++ b/webrtc/video/video_send_stream.h @@ -12,6 +12,7 @@ #define WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ #include +#include #include #include "webrtc/call/bitrate_allocator.h"