Use std::make_unique instead of absl::make_unique.

WebRTC is now using C++14 so there is no need to use the Abseil version
of std::make_unique.

This CL has been created with the following steps:

git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt
git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt
git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt

diff --new-line-format="" --unchanged-line-format="" \
  /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \
  uniq > /tmp/only_make_unique.txt
diff --new-line-format="" --unchanged-line-format="" \
  /tmp/only_make_unique.txt /tmp/memory.txt | \
  xargs grep -l "absl/memory" > /tmp/add-memory.txt

git grep -l "\babsl::make_unique\b" | \
  xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g"

git checkout PRESUBMIT.py abseil-in-webrtc.md

cat /tmp/add-memory.txt | \
  xargs sed -i \
  's/#include "absl\/memory\/memory.h"/#include <memory>/g'
git cl format
# Manual fix order of the new inserted #include <memory>

cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \
  xargs sed -i '/#include "absl\/memory\/memory.h"/d'

git ls-files | grep BUILD.gn | \
  xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d'

python tools_webrtc/gn_check_autofix.py \
  -m tryserver.webrtc -b linux_rel

# Repead the gn_check_autofix step for other platforms

git ls-files | grep BUILD.gn | \
  xargs sed -i 's/absl\/memory:memory/absl\/memory/g'
git cl format

Bug: webrtc:10945
Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29209}
This commit is contained in:
Mirko Bonadei
2019-09-17 17:06:18 +02:00
committed by Commit Bot
parent 809198edff
commit 317a1f09ed
477 changed files with 1796 additions and 2074 deletions

View File

@ -231,7 +231,7 @@ class WebRtcVideoEngineTest : public ::testing::Test {
: override_field_trials_(
field_trials.empty()
? nullptr
: absl::make_unique<webrtc::test::ScopedFieldTrials>(
: std::make_unique<webrtc::test::ScopedFieldTrials>(
field_trials)),
task_queue_factory_(webrtc::CreateDefaultTaskQueueFactory()),
call_(webrtc::Call::Create([&] {
@ -891,7 +891,7 @@ TEST_F(WebRtcVideoEngineTest,
TEST_F(WebRtcVideoEngineTest, SimulcastEnabledForH264BehindFieldTrial) {
RTC_DCHECK(!override_field_trials_);
override_field_trials_ = absl::make_unique<webrtc::test::ScopedFieldTrials>(
override_field_trials_ = std::make_unique<webrtc::test::ScopedFieldTrials>(
"WebRTC-H264Simulcast/Enabled/");
encoder_factory_->AddSupportedVideoCodecType("H264");
@ -937,7 +937,7 @@ TEST_F(WebRtcVideoEngineTest,
// FlexFEC is active with field trial.
RTC_DCHECK(!override_field_trials_);
override_field_trials_ = absl::make_unique<webrtc::test::ScopedFieldTrials>(
override_field_trials_ = std::make_unique<webrtc::test::ScopedFieldTrials>(
"WebRTC-FlexFEC-03-Advertised/Enabled/");
EXPECT_THAT(engine_.codecs(), Contains(flexfec));
}
@ -1083,7 +1083,7 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, Vp8) {
new webrtc::MockVideoDecoderFactory();
std::unique_ptr<webrtc::MockVideoBitrateAllocatorFactory>
rate_allocator_factory =
absl::make_unique<webrtc::MockVideoBitrateAllocatorFactory>();
std::make_unique<webrtc::MockVideoBitrateAllocatorFactory>();
EXPECT_CALL(*rate_allocator_factory,
CreateVideoBitrateAllocatorProxy(Field(
&webrtc::VideoCodec::codecType, webrtc::kVideoCodecVP8)))
@ -1205,7 +1205,7 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, NullDecoder) {
new webrtc::MockVideoDecoderFactory();
std::unique_ptr<webrtc::MockVideoBitrateAllocatorFactory>
rate_allocator_factory =
absl::make_unique<webrtc::MockVideoBitrateAllocatorFactory>();
std::make_unique<webrtc::MockVideoBitrateAllocatorFactory>();
WebRtcVideoEngine engine(
(std::unique_ptr<webrtc::VideoEncoderFactory>(encoder_factory)),
(std::unique_ptr<webrtc::VideoDecoderFactory>(decoder_factory)));
@ -1334,8 +1334,8 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
parameters.codecs = engine_.codecs();
channel_->SetRecvParameters(parameters);
EXPECT_TRUE(channel_->AddSendStream(DefaultSendStreamParams()));
frame_forwarder_ = absl::make_unique<webrtc::test::FrameForwarder>();
frame_source_ = absl::make_unique<cricket::FakeFrameSource>(
frame_forwarder_ = std::make_unique<webrtc::test::FrameForwarder>();
frame_source_ = std::make_unique<cricket::FakeFrameSource>(
640, 480, rtc::kNumMicrosecsPerSec / kFramerate);
EXPECT_TRUE(channel_->SetVideoSend(kSsrc, nullptr, frame_forwarder_.get()));
}
@ -1364,7 +1364,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
// We dont add recv for the second stream.
// Setup the receive and renderer for second stream after send.
frame_forwarder_2_ = absl::make_unique<webrtc::test::FrameForwarder>();
frame_forwarder_2_ = std::make_unique<webrtc::test::FrameForwarder>();
EXPECT_TRUE(
channel_->SetVideoSend(kSsrc + 2, nullptr, frame_forwarder_2_.get()));
}
@ -1372,7 +1372,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
bool SetDefaultCodec() { return SetOneCodec(DefaultCodec()); }
bool SetOneCodec(const cricket::VideoCodec& codec) {
frame_source_ = absl::make_unique<cricket::FakeFrameSource>(
frame_source_ = std::make_unique<cricket::FakeFrameSource>(
kVideoWidth, kVideoHeight, rtc::kNumMicrosecsPerSec / kFramerate);
bool sending = channel_->sending();
@ -2875,7 +2875,7 @@ TEST_F(WebRtcVideoChannelTest, LossNotificationIsDisabledByDefault) {
TEST_F(WebRtcVideoChannelTest, LossNotificationIsEnabledByFieldTrial) {
RTC_DCHECK(!override_field_trials_);
override_field_trials_ = absl::make_unique<webrtc::test::ScopedFieldTrials>(
override_field_trials_ = std::make_unique<webrtc::test::ScopedFieldTrials>(
"WebRTC-RtcpLossNotification/Enabled/");
SetUp();
TestLossNotificationState(true);
@ -2883,7 +2883,7 @@ TEST_F(WebRtcVideoChannelTest, LossNotificationIsEnabledByFieldTrial) {
TEST_F(WebRtcVideoChannelTest, LossNotificationCanBeEnabledAndDisabled) {
RTC_DCHECK(!override_field_trials_);
override_field_trials_ = absl::make_unique<webrtc::test::ScopedFieldTrials>(
override_field_trials_ = std::make_unique<webrtc::test::ScopedFieldTrials>(
"WebRTC-RtcpLossNotification/Enabled/");
SetUp();
@ -3494,7 +3494,7 @@ TEST_F(WebRtcVideoChannelTest, VerifyMinBitrate) {
TEST_F(WebRtcVideoChannelTest, VerifyMinBitrateWithForcedFallbackFieldTrial) {
RTC_DCHECK(!override_field_trials_);
override_field_trials_ = absl::make_unique<webrtc::test::ScopedFieldTrials>(
override_field_trials_ = std::make_unique<webrtc::test::ScopedFieldTrials>(
"WebRTC-VP8-Forced-Fallback-Encoder-v2/Enabled-1,2,34567/");
std::vector<webrtc::VideoStream> streams = AddSendStream()->GetVideoStreams();
ASSERT_EQ(1u, streams.size());
@ -3504,7 +3504,7 @@ TEST_F(WebRtcVideoChannelTest, VerifyMinBitrateWithForcedFallbackFieldTrial) {
TEST_F(WebRtcVideoChannelTest,
BalancedDegradationPreferenceNotSupportedWithoutFieldtrial) {
RTC_DCHECK(!override_field_trials_);
override_field_trials_ = absl::make_unique<webrtc::test::ScopedFieldTrials>(
override_field_trials_ = std::make_unique<webrtc::test::ScopedFieldTrials>(
"WebRTC-Video-BalancedDegradation/Disabled/");
const bool kResolutionScalingEnabled = true;
const bool kFpsScalingEnabled = false;
@ -3514,7 +3514,7 @@ TEST_F(WebRtcVideoChannelTest,
TEST_F(WebRtcVideoChannelTest,
BalancedDegradationPreferenceSupportedBehindFieldtrial) {
RTC_DCHECK(!override_field_trials_);
override_field_trials_ = absl::make_unique<webrtc::test::ScopedFieldTrials>(
override_field_trials_ = std::make_unique<webrtc::test::ScopedFieldTrials>(
"WebRTC-Video-BalancedDegradation/Enabled/");
const bool kResolutionScalingEnabled = true;
const bool kFpsScalingEnabled = true;
@ -7489,7 +7489,7 @@ class WebRtcVideoChannelSimulcastTest : public ::testing::Test {
encoder_factory_(new cricket::FakeWebRtcVideoEncoderFactory),
decoder_factory_(new cricket::FakeWebRtcVideoDecoderFactory),
mock_rate_allocator_factory_(
absl::make_unique<webrtc::MockVideoBitrateAllocatorFactory>()),
std::make_unique<webrtc::MockVideoBitrateAllocatorFactory>()),
engine_(std::unique_ptr<cricket::FakeWebRtcVideoEncoderFactory>(
encoder_factory_),
std::unique_ptr<cricket::FakeWebRtcVideoDecoderFactory>(