Replace scoped_ptr with unique_ptr in webrtc/call/
BUG=webrtc:5520
Review URL: https://codereview.webrtc.org/1789903003
Cr-Commit-Position: refs/heads/master@{#11970}
diff --git a/webrtc/call/bitrate_allocator.h b/webrtc/call/bitrate_allocator.h
index 25ca735..404a312 100644
--- a/webrtc/call/bitrate_allocator.h
+++ b/webrtc/call/bitrate_allocator.h
@@ -11,12 +11,13 @@
#ifndef WEBRTC_CALL_BITRATE_ALLOCATOR_H_
#define WEBRTC_CALL_BITRATE_ALLOCATOR_H_
+#include <stdint.h>
+
#include <list>
#include <map>
#include <utility>
#include "webrtc/base/criticalsection.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread_annotations.h"
namespace webrtc {
diff --git a/webrtc/call/bitrate_allocator_unittest.cc b/webrtc/call/bitrate_allocator_unittest.cc
index fc4f170..6e0cdd4 100644
--- a/webrtc/call/bitrate_allocator_unittest.cc
+++ b/webrtc/call/bitrate_allocator_unittest.cc
@@ -9,6 +9,7 @@
*/
#include <algorithm>
+#include <memory>
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
@@ -41,7 +42,7 @@
}
~BitrateAllocatorTest() {}
- rtc::scoped_ptr<BitrateAllocator> allocator_;
+ std::unique_ptr<BitrateAllocator> allocator_;
};
TEST_F(BitrateAllocatorTest, UpdatingBitrateObserver) {
@@ -105,7 +106,7 @@
}
~BitrateAllocatorTestNoEnforceMin() {}
- rtc::scoped_ptr<BitrateAllocator> allocator_;
+ std::unique_ptr<BitrateAllocator> allocator_;
};
// The following three tests verify that the EnforceMinBitrate() method works
diff --git a/webrtc/call/bitrate_estimator_tests.cc b/webrtc/call/bitrate_estimator_tests.cc
index f3bef73..c63d45d 100644
--- a/webrtc/call/bitrate_estimator_tests.cc
+++ b/webrtc/call/bitrate_estimator_tests.cc
@@ -9,6 +9,7 @@
*/
#include <functional>
#include <list>
+#include <memory>
#include <string>
#include "testing/gtest/include/gtest/gtest.h"
@@ -17,7 +18,6 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/event.h"
#include "webrtc/base/logging.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread_annotations.h"
#include "webrtc/call.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
@@ -243,17 +243,17 @@
VideoSendStream* send_stream_;
AudioReceiveStream* audio_receive_stream_;
VideoReceiveStream* video_receive_stream_;
- rtc::scoped_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_;
+ std::unique_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_;
test::FakeEncoder fake_encoder_;
test::FakeDecoder fake_decoder_;
};
testing::NiceMock<test::MockVoiceEngine> mock_voice_engine_;
LogObserver receiver_log_;
- rtc::scoped_ptr<test::DirectTransport> send_transport_;
- rtc::scoped_ptr<test::DirectTransport> receive_transport_;
- rtc::scoped_ptr<Call> sender_call_;
- rtc::scoped_ptr<Call> receiver_call_;
+ std::unique_ptr<test::DirectTransport> send_transport_;
+ std::unique_ptr<test::DirectTransport> receive_transport_;
+ std::unique_ptr<Call> sender_call_;
+ std::unique_ptr<Call> receiver_call_;
VideoReceiveStream::Config receive_config_;
std::vector<Stream*> streams_;
};
diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc
index 2dfb13a2..3fd7a93 100644
--- a/webrtc/call/call.cc
+++ b/webrtc/call/call.cc
@@ -11,6 +11,7 @@
#include <string.h>
#include <map>
+#include <memory>
#include <vector>
#include "webrtc/audio/audio_receive_stream.h"
@@ -19,7 +20,6 @@
#include "webrtc/audio/scoped_voe_interface.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread_annotations.h"
#include "webrtc/base/thread_checker.h"
#include "webrtc/base/trace_event.h"
@@ -120,16 +120,16 @@
Clock* const clock_;
const int num_cpu_cores_;
- const rtc::scoped_ptr<ProcessThread> module_process_thread_;
- const rtc::scoped_ptr<ProcessThread> pacer_thread_;
- const rtc::scoped_ptr<CallStats> call_stats_;
- const rtc::scoped_ptr<BitrateAllocator> bitrate_allocator_;
+ const std::unique_ptr<ProcessThread> module_process_thread_;
+ const std::unique_ptr<ProcessThread> pacer_thread_;
+ const std::unique_ptr<CallStats> call_stats_;
+ const std::unique_ptr<BitrateAllocator> bitrate_allocator_;
Call::Config config_;
rtc::ThreadChecker configuration_thread_checker_;
bool network_enabled_;
- rtc::scoped_ptr<RWLockWrapper> receive_crit_;
+ std::unique_ptr<RWLockWrapper> receive_crit_;
// Audio and Video receive streams are owned by the client that creates them.
std::map<uint32_t, AudioReceiveStream*> audio_receive_ssrcs_
GUARDED_BY(receive_crit_);
@@ -140,7 +140,7 @@
std::map<std::string, AudioReceiveStream*> sync_stream_mapping_
GUARDED_BY(receive_crit_);
- rtc::scoped_ptr<RWLockWrapper> send_crit_;
+ std::unique_ptr<RWLockWrapper> send_crit_;
// Audio and Video send streams are owned by the client that creates them.
std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_);
std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_);
@@ -168,7 +168,7 @@
int64_t num_bitrate_updates_ GUARDED_BY(&bitrate_crit_);
VieRemb remb_;
- const rtc::scoped_ptr<CongestionController> congestion_controller_;
+ const std::unique_ptr<CongestionController> congestion_controller_;
RTC_DISALLOW_COPY_AND_ASSIGN(Call);
};
@@ -183,8 +183,9 @@
Call::Call(const Call::Config& config)
: clock_(Clock::GetRealTimeClock()),
num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
- module_process_thread_(ProcessThread::Create("ModuleProcessThread")),
- pacer_thread_(ProcessThread::Create("PacerThread")),
+ module_process_thread_(
+ rtc::ScopedToUnique(ProcessThread::Create("ModuleProcessThread"))),
+ pacer_thread_(rtc::ScopedToUnique(ProcessThread::Create("PacerThread"))),
call_stats_(new CallStats(clock_)),
bitrate_allocator_(new BitrateAllocator()),
config_(config),
diff --git a/webrtc/call/call_perf_tests.cc b/webrtc/call/call_perf_tests.cc
index 98e7797..4361872 100644
--- a/webrtc/call/call_perf_tests.cc
+++ b/webrtc/call/call_perf_tests.cc
@@ -8,13 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <algorithm>
+#include <memory>
#include <sstream>
#include <string>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/checks.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread_annotations.h"
#include "webrtc/call.h"
#include "webrtc/call/transport_adapter.h"
@@ -235,7 +235,7 @@
private:
int channel_;
VoENetwork* voe_network_;
- rtc::scoped_ptr<RtpHeaderParser> parser_;
+ std::unique_ptr<RtpHeaderParser> parser_;
};
VoiceEngine* voice_engine = VoiceEngine::Create();
diff --git a/webrtc/call/call_unittest.cc b/webrtc/call/call_unittest.cc
index 75c8238..0da91a9 100644
--- a/webrtc/call/call_unittest.cc
+++ b/webrtc/call/call_unittest.cc
@@ -9,6 +9,7 @@
*/
#include <list>
+#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
@@ -31,7 +32,7 @@
private:
testing::NiceMock<webrtc::test::MockVoiceEngine> voice_engine_;
- rtc::scoped_ptr<webrtc::Call> call_;
+ std::unique_ptr<webrtc::Call> call_;
};
} // namespace
diff --git a/webrtc/call/packet_injection_tests.cc b/webrtc/call/packet_injection_tests.cc
index 277cd3e..1d52b88 100644
--- a/webrtc/call/packet_injection_tests.cc
+++ b/webrtc/call/packet_injection_tests.cc
@@ -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/test/call_test.h"
@@ -29,7 +31,7 @@
const uint8_t* packet,
size_t length);
- rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_;
+ std::unique_ptr<RtpHeaderParser> rtp_header_parser_;
};
void PacketInjectionTest::InjectIncorrectPacket(CodecType codec_type,
diff --git a/webrtc/call/rampup_tests.h b/webrtc/call/rampup_tests.h
index 31a0a02..fa73c63 100644
--- a/webrtc/call/rampup_tests.h
+++ b/webrtc/call/rampup_tests.h
@@ -16,7 +16,6 @@
#include <vector>
#include "webrtc/base/event.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/call.h"
#include "webrtc/test/call_test.h"
diff --git a/webrtc/call/rtc_event_log.cc b/webrtc/call/rtc_event_log.cc
index 361db81..ce4d6ef 100644
--- a/webrtc/call/rtc_event_log.cc
+++ b/webrtc/call/rtc_event_log.cc
@@ -105,8 +105,8 @@
EXCLUSIVE_LOCKS_REQUIRED(crit_);
rtc::CriticalSection crit_;
- rtc::scoped_ptr<FileWrapper> file_ GUARDED_BY(crit_) =
- rtc::scoped_ptr<FileWrapper>(FileWrapper::Create());
+ std::unique_ptr<FileWrapper> file_ GUARDED_BY(crit_) =
+ std::unique_ptr<FileWrapper>(FileWrapper::Create());
rtc::PlatformFile platform_file_ GUARDED_BY(crit_) =
rtc::kInvalidPlatformFileValue;
rtclog::EventStream stream_ GUARDED_BY(crit_);
@@ -501,7 +501,7 @@
rtclog::EventStream* result) {
char tmp_buffer[1024];
int bytes_read = 0;
- rtc::scoped_ptr<FileWrapper> dump_file(FileWrapper::Create());
+ std::unique_ptr<FileWrapper> dump_file(FileWrapper::Create());
if (dump_file->OpenFile(file_name.c_str(), true) != 0) {
return false;
}
@@ -516,8 +516,8 @@
#endif // ENABLE_RTC_EVENT_LOG
// RtcEventLog member functions.
-rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() {
- return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl());
+std::unique_ptr<RtcEventLog> RtcEventLog::Create() {
+ return std::unique_ptr<RtcEventLog>(new RtcEventLogImpl());
}
} // namespace webrtc
diff --git a/webrtc/call/rtc_event_log.h b/webrtc/call/rtc_event_log.h
index 027f686..518308b 100644
--- a/webrtc/call/rtc_event_log.h
+++ b/webrtc/call/rtc_event_log.h
@@ -11,10 +11,10 @@
#ifndef WEBRTC_CALL_RTC_EVENT_LOG_H_
#define WEBRTC_CALL_RTC_EVENT_LOG_H_
+#include <memory>
#include <string>
#include "webrtc/base/platform_file.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/video_receive_stream.h"
#include "webrtc/video_send_stream.h"
@@ -36,7 +36,7 @@
public:
virtual ~RtcEventLog() {}
- static rtc::scoped_ptr<RtcEventLog> Create();
+ static std::unique_ptr<RtcEventLog> Create();
// Sets the time that events are stored in the internal event buffer
// before the user calls StartLogging. The default is 10 000 000 us = 10 s
diff --git a/webrtc/call/rtc_event_log2rtp_dump.cc b/webrtc/call/rtc_event_log2rtp_dump.cc
index 8357d48..ef0be9a 100644
--- a/webrtc/call/rtc_event_log2rtp_dump.cc
+++ b/webrtc/call/rtc_event_log2rtp_dump.cc
@@ -9,12 +9,12 @@
*/
#include <iostream>
+#include <memory>
#include <sstream>
#include <string>
#include "gflags/gflags.h"
#include "webrtc/base/checks.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/call/rtc_event_log.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
#include "webrtc/test/rtp_file_writer.h"
@@ -100,7 +100,7 @@
return -1;
}
- rtc::scoped_ptr<webrtc::test::RtpFileWriter> rtp_writer(
+ std::unique_ptr<webrtc::test::RtpFileWriter> rtp_writer(
webrtc::test::RtpFileWriter::Create(
webrtc::test::RtpFileWriter::FileFormat::kRtpDump, output_file));
diff --git a/webrtc/call/rtc_event_log_unittest.cc b/webrtc/call/rtc_event_log_unittest.cc
index b86a688..3039c8b 100644
--- a/webrtc/call/rtc_event_log_unittest.cc
+++ b/webrtc/call/rtc_event_log_unittest.cc
@@ -10,6 +10,7 @@
#ifdef ENABLE_RTC_EVENT_LOG
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -18,7 +19,6 @@
#include "webrtc/base/buffer.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/random.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread.h"
#include "webrtc/call.h"
#include "webrtc/call/rtc_event_log.h"
@@ -473,7 +473,7 @@
// When log_dumper goes out of scope, it causes the log file to be flushed
// to disk.
{
- rtc::scoped_ptr<RtcEventLog> log_dumper(RtcEventLog::Create());
+ std::unique_ptr<RtcEventLog> log_dumper(RtcEventLog::Create());
log_dumper->LogVideoReceiveStreamConfig(receiver_config);
log_dumper->LogVideoSendStreamConfig(sender_config);
size_t rtcp_index = 1;
@@ -639,7 +639,7 @@
// The log file will be flushed to disk when the log_dumper goes out of scope.
{
- rtc::scoped_ptr<RtcEventLog> log_dumper(RtcEventLog::Create());
+ std::unique_ptr<RtcEventLog> log_dumper(RtcEventLog::Create());
// Reduce the time old events are stored to 50 ms.
log_dumper->SetBufferDuration(50000);
log_dumper->LogVideoReceiveStreamConfig(receiver_config);
diff --git a/webrtc/voice_engine/channel_manager.cc b/webrtc/voice_engine/channel_manager.cc
index 96f6d2b..eac2e50 100644
--- a/webrtc/voice_engine/channel_manager.cc
+++ b/webrtc/voice_engine/channel_manager.cc
@@ -49,7 +49,7 @@
: instance_id_(instance_id),
last_channel_id_(-1),
config_(config),
- event_log_(rtc::ScopedToUnique(RtcEventLog::Create())) {}
+ event_log_(RtcEventLog::Create()) {}
ChannelOwner ChannelManager::CreateChannel() {
return CreateChannelInternal(config_);