From 0d210ee2f68e8ad5814c7cf7c7d1a45054617987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Wed, 7 Aug 2019 16:16:45 +0200 Subject: [PATCH] Change return type of of ReceiveStatistics::Create to unique_ptr. There are currently three overloads with different number of arguments, and one of those return a raw pointer. This cl changes that to unique_ptr. The transition plan is to update those downstream call sites that currently require a raw pointer to use one of the other overloads. Bug: webrtc:10679 Change-Id: I234605e99c04a59fbe6f478581ed8edd96a9b05a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/148447 Reviewed-by: Danil Chapovalov Reviewed-by: Karl Wiberg Commit-Queue: Niels Moller Cr-Commit-Position: refs/heads/master@{#28804} --- modules/rtp_rtcp/include/receive_statistics.h | 4 ++-- modules/rtp_rtcp/source/nack_rtx_unittest.cc | 2 +- video/rtp_video_stream_receiver_unittest.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/rtp_rtcp/include/receive_statistics.h b/modules/rtp_rtcp/include/receive_statistics.h index 9ed9cf8ed8..801d4c7d46 100644 --- a/modules/rtp_rtcp/include/receive_statistics.h +++ b/modules/rtp_rtcp/include/receive_statistics.h @@ -60,8 +60,8 @@ class ReceiveStatistics : public ReceiveStatisticsProvider, public: ~ReceiveStatistics() override = default; - static ReceiveStatistics* Create(Clock* clock) { - return Create(clock, nullptr).release(); + static std::unique_ptr Create(Clock* clock) { + return Create(clock, nullptr); } static std::unique_ptr Create( diff --git a/modules/rtp_rtcp/source/nack_rtx_unittest.cc b/modules/rtp_rtcp/source/nack_rtx_unittest.cc index 7ace5a38e6..5c87f67e2d 100644 --- a/modules/rtp_rtcp/source/nack_rtx_unittest.cc +++ b/modules/rtp_rtcp/source/nack_rtx_unittest.cc @@ -131,7 +131,7 @@ class RtpRtcpRtxNackTest : public ::testing::Test { RtpRtcp::Configuration configuration; configuration.audio = false; configuration.clock = &fake_clock; - receive_statistics_.reset(ReceiveStatistics::Create(&fake_clock)); + receive_statistics_ = ReceiveStatistics::Create(&fake_clock); configuration.receive_statistics = receive_statistics_.get(); configuration.outgoing_transport = &transport_; configuration.retransmission_rate_limiter = &retransmission_rate_limiter_; diff --git a/video/rtp_video_stream_receiver_unittest.cc b/video/rtp_video_stream_receiver_unittest.cc index cbf2efa35d..4cebc4e004 100644 --- a/video/rtp_video_stream_receiver_unittest.cc +++ b/video/rtp_video_stream_receiver_unittest.cc @@ -139,7 +139,7 @@ class RtpVideoStreamReceiverTest : public ::testing::Test { void SetUp() { rtp_receive_statistics_ = - absl::WrapUnique(ReceiveStatistics::Create(Clock::GetRealTimeClock())); + ReceiveStatistics::Create(Clock::GetRealTimeClock()); rtp_video_stream_receiver_ = absl::make_unique( Clock::GetRealTimeClock(), &mock_transport_, nullptr, nullptr, &config_, rtp_receive_statistics_.get(), nullptr, process_thread_.get(),