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}
diff --git a/pc/jsep_transport_controller_unittest.cc b/pc/jsep_transport_controller_unittest.cc
index 35ebb87..70cbe96 100644
--- a/pc/jsep_transport_controller_unittest.cc
+++ b/pc/jsep_transport_controller_unittest.cc
@@ -13,7 +13,6 @@
#include <map>
#include <memory>
-#include "absl/memory/memory.h"
#include "api/test/fake_media_transport.h"
#include "api/test/loopback_media_transport.h"
#include "api/transport/media/media_transport_interface.h"
@@ -65,14 +64,14 @@
std::unique_ptr<cricket::IceTransportInternal> CreateIceTransport(
const std::string& transport_name,
int component) override {
- return absl::make_unique<cricket::FakeIceTransport>(transport_name,
- component);
+ return std::make_unique<cricket::FakeIceTransport>(transport_name,
+ component);
}
std::unique_ptr<cricket::DtlsTransportInternal> CreateDtlsTransport(
cricket::IceTransportInternal* ice,
const webrtc::CryptoOptions& crypto_options) override {
- return absl::make_unique<FakeDtlsTransport>(
+ return std::make_unique<FakeDtlsTransport>(
static_cast<cricket::FakeIceTransport*>(ice));
}
};
@@ -82,7 +81,7 @@
public sigslot::has_slots<> {
public:
JsepTransportControllerTest() : signaling_thread_(rtc::Thread::Current()) {
- fake_transport_factory_ = absl::make_unique<FakeTransportFactory>();
+ fake_transport_factory_ = std::make_unique<FakeTransportFactory>();
}
void CreateJsepTransportController(
@@ -94,7 +93,7 @@
// The tests only works with |fake_transport_factory|;
config.external_transport_factory = fake_transport_factory_.get();
// TODO(zstein): Provide an AsyncResolverFactory once it is required.
- transport_controller_ = absl::make_unique<JsepTransportController>(
+ transport_controller_ = std::make_unique<JsepTransportController>(
signaling_thread, network_thread, port_allocator, nullptr, config);
ConnectTransportControllerSignals();
}
@@ -114,7 +113,7 @@
std::unique_ptr<cricket::SessionDescription>
CreateSessionDescriptionWithoutBundle() {
- auto description = absl::make_unique<cricket::SessionDescription>();
+ auto description = std::make_unique<cricket::SessionDescription>();
AddAudioSection(description.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
@@ -957,7 +956,7 @@
rtc::SSLIdentity::Generate("session1", rtc::KT_DEFAULT)));
rtc::scoped_refptr<rtc::RTCCertificate> returned_certificate;
- auto description = absl::make_unique<cricket::SessionDescription>();
+ auto description = std::make_unique<cricket::SessionDescription>();
AddAudioSection(description.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
certificate1);
@@ -1015,11 +1014,11 @@
rtc::SSLIdentity::Generate("answer", rtc::KT_DEFAULT)));
transport_controller_->SetLocalCertificate(offer_certificate);
- auto offer_desc = absl::make_unique<cricket::SessionDescription>();
+ auto offer_desc = std::make_unique<cricket::SessionDescription>();
AddAudioSection(offer_desc.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
offer_certificate);
- auto answer_desc = absl::make_unique<cricket::SessionDescription>();
+ auto answer_desc = std::make_unique<cricket::SessionDescription>();
AddAudioSection(answer_desc.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_PASSIVE,
answer_certificate);
@@ -1485,11 +1484,11 @@
TEST_F(JsepTransportControllerTest, IceRoleRedeterminedOnIceRestartByDefault) {
CreateJsepTransportController(JsepTransportController::Config());
// Let the |transport_controller_| be the controlled side initially.
- auto remote_offer = absl::make_unique<cricket::SessionDescription>();
+ auto remote_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(remote_offer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
- auto local_answer = absl::make_unique<cricket::SessionDescription>();
+ auto local_answer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(local_answer.get(), kAudioMid1, kIceUfrag2, kIcePwd2,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_PASSIVE,
nullptr);
@@ -1507,7 +1506,7 @@
fake_dtls->fake_ice_transport()->GetIceRole());
// New offer will trigger the ICE restart.
- auto restart_local_offer = absl::make_unique<cricket::SessionDescription>();
+ auto restart_local_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(restart_local_offer.get(), kAudioMid1, kIceUfrag3, kIcePwd3,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
@@ -1528,11 +1527,11 @@
CreateJsepTransportController(config);
// Let the |transport_controller_| be the controlled side initially.
- auto remote_offer = absl::make_unique<cricket::SessionDescription>();
+ auto remote_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(remote_offer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
- auto local_answer = absl::make_unique<cricket::SessionDescription>();
+ auto local_answer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(local_answer.get(), kAudioMid1, kIceUfrag2, kIcePwd2,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_PASSIVE,
nullptr);
@@ -1550,7 +1549,7 @@
fake_dtls->fake_ice_transport()->GetIceRole());
// New offer will trigger the ICE restart.
- auto restart_local_offer = absl::make_unique<cricket::SessionDescription>();
+ auto restart_local_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(restart_local_offer.get(), kAudioMid1, kIceUfrag3, kIcePwd3,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
@@ -1565,7 +1564,7 @@
// Tests ICE-Lite mode in remote answer.
TEST_F(JsepTransportControllerTest, SetIceRoleWhenIceLiteInRemoteAnswer) {
CreateJsepTransportController(JsepTransportController::Config());
- auto local_offer = absl::make_unique<cricket::SessionDescription>();
+ auto local_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(local_offer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
@@ -1579,7 +1578,7 @@
EXPECT_EQ(cricket::ICEMODE_FULL,
fake_dtls->fake_ice_transport()->remote_ice_mode());
- auto remote_answer = absl::make_unique<cricket::SessionDescription>();
+ auto remote_answer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(remote_answer.get(), kAudioMid1, kIceUfrag2, kIcePwd2,
cricket::ICEMODE_LITE, cricket::CONNECTIONROLE_PASSIVE,
nullptr);
@@ -1598,11 +1597,11 @@
TEST_F(JsepTransportControllerTest,
IceRoleIsControllingAfterIceRestartFromIceLiteEndpoint) {
CreateJsepTransportController(JsepTransportController::Config());
- auto remote_offer = absl::make_unique<cricket::SessionDescription>();
+ auto remote_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(remote_offer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_LITE, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
- auto local_answer = absl::make_unique<cricket::SessionDescription>();
+ auto local_answer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(local_answer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_PASSIVE,
nullptr);
@@ -1620,11 +1619,11 @@
fake_dtls->fake_ice_transport()->GetIceRole());
// In the subsequence remote offer triggers an ICE restart.
- auto remote_offer2 = absl::make_unique<cricket::SessionDescription>();
+ auto remote_offer2 = std::make_unique<cricket::SessionDescription>();
AddAudioSection(remote_offer2.get(), kAudioMid1, kIceUfrag2, kIcePwd2,
cricket::ICEMODE_LITE, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
- auto local_answer2 = absl::make_unique<cricket::SessionDescription>();
+ auto local_answer2 = std::make_unique<cricket::SessionDescription>();
AddAudioSection(local_answer2.get(), kAudioMid1, kIceUfrag2, kIcePwd2,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_PASSIVE,
nullptr);
@@ -1651,7 +1650,7 @@
bundle_group.AddContentName(kVideoMid1);
bundle_group.AddContentName(kDataMid1);
- auto local_offer = absl::make_unique<cricket::SessionDescription>();
+ auto local_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(local_offer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
@@ -1666,7 +1665,7 @@
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
- auto remote_answer = absl::make_unique<cricket::SessionDescription>();
+ auto remote_answer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(remote_answer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_PASSIVE,
nullptr);
@@ -1724,7 +1723,7 @@
bundle_group.AddContentName(kAudioMid1);
bundle_group.AddContentName(kVideoMid1);
- auto local_offer = absl::make_unique<cricket::SessionDescription>();
+ auto local_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(local_offer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
@@ -1735,7 +1734,7 @@
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
- auto remote_answer = absl::make_unique<cricket::SessionDescription>();
+ auto remote_answer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(remote_answer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_PASSIVE,
nullptr);
@@ -1776,12 +1775,12 @@
cricket::ContentGroup bundle_group(cricket::GROUP_TYPE_BUNDLE);
bundle_group.AddContentName(kDataMid1);
- auto local_offer = absl::make_unique<cricket::SessionDescription>();
+ auto local_offer = std::make_unique<cricket::SessionDescription>();
AddDataSection(local_offer.get(), kDataMid1,
cricket::MediaProtocolType::kSctp, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
- auto remote_answer = absl::make_unique<cricket::SessionDescription>();
+ auto remote_answer = std::make_unique<cricket::SessionDescription>();
AddDataSection(remote_answer.get(), kDataMid1,
cricket::MediaProtocolType::kSctp, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_PASSIVE,
@@ -1839,7 +1838,7 @@
bundle_group.AddContentName(kVideoMid1);
bundle_group.AddContentName(kDataMid1);
- auto local_offer = absl::make_unique<cricket::SessionDescription>();
+ auto local_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(local_offer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
@@ -1851,7 +1850,7 @@
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
- auto remote_answer = absl::make_unique<cricket::SessionDescription>();
+ auto remote_answer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(remote_answer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_PASSIVE,
nullptr);
@@ -1898,7 +1897,7 @@
bundle_group.AddContentName(kAudioMid1);
bundle_group.AddContentName(kVideoMid1);
- auto local_offer = absl::make_unique<cricket::SessionDescription>();
+ auto local_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(local_offer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
@@ -1906,7 +1905,7 @@
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
- auto remote_answer = absl::make_unique<cricket::SessionDescription>();
+ auto remote_answer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(remote_answer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_PASSIVE,
nullptr);
@@ -1948,7 +1947,7 @@
bundle_group.AddContentName(kVideoMid1);
bundle_group.AddContentName(kDataMid1);
- auto local_offer = absl::make_unique<cricket::SessionDescription>();
+ auto local_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(local_offer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
@@ -1960,7 +1959,7 @@
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
- auto remote_answer = absl::make_unique<cricket::SessionDescription>();
+ auto remote_answer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(remote_answer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_PASSIVE,
nullptr);
@@ -2001,7 +2000,7 @@
JsepTransportController::Config config;
config.rtcp_mux_policy = PeerConnectionInterface::kRtcpMuxPolicyRequire;
CreateJsepTransportController(config);
- auto local_offer = absl::make_unique<cricket::SessionDescription>();
+ auto local_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(local_offer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
@@ -2019,7 +2018,7 @@
JsepTransportController::Config config;
config.rtcp_mux_policy = PeerConnectionInterface::kRtcpMuxPolicyRequire;
CreateJsepTransportController(config);
- auto local_offer = absl::make_unique<cricket::SessionDescription>();
+ auto local_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(local_offer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);
@@ -2027,7 +2026,7 @@
->SetLocalDescription(SdpType::kOffer, local_offer.get())
.ok());
- auto remote_answer = absl::make_unique<cricket::SessionDescription>();
+ auto remote_answer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(remote_answer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_PASSIVE,
nullptr);
@@ -2129,7 +2128,7 @@
TEST_F(JsepTransportControllerTest, ChangeTaggedMediaSectionMaxBundle) {
CreateJsepTransportController(JsepTransportController::Config());
- auto local_offer = absl::make_unique<cricket::SessionDescription>();
+ auto local_offer = std::make_unique<cricket::SessionDescription>();
AddAudioSection(local_offer.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS,
nullptr);