Use absl::make_unique and absl::WrapUnique directly

Instead of going through our wrappers in ptr_util.h.

This CL was generated by the following script:

  git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
  git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
  git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
  git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
  git cl format

Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.

Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn
index 473281a..a2f5160 100644
--- a/p2p/BUILD.gn
+++ b/p2p/BUILD.gn
@@ -91,6 +91,7 @@
     "../rtc_base:safe_minmax",
     "../rtc_base:stringutils",
     "../system_wrappers:field_trial_api",
+    "//third_party/abseil-cpp/absl/memory",
     "//third_party/abseil-cpp/absl/types:optional",
   ]
 
@@ -138,6 +139,7 @@
       "../rtc_base:rtc_base_approved",
       "../rtc_base:rtc_base_tests_utils",
       "../test:test_support",
+      "//third_party/abseil-cpp/absl/memory",
     ]
   }
 
@@ -178,6 +180,7 @@
       "../rtc_base:stringutils",
       "../test:test_support",
       "//testing/gtest",
+      "//third_party/abseil-cpp/absl/memory",
     ]
     if (!build_with_chromium && is_clang) {
       # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
diff --git a/p2p/base/fakedtlstransport.h b/p2p/base/fakedtlstransport.h
index 2422ec9..cb944d3 100644
--- a/p2p/base/fakedtlstransport.h
+++ b/p2p/base/fakedtlstransport.h
@@ -16,10 +16,10 @@
 #include <utility>
 #include <vector>
 
+#include "absl/memory/memory.h"
 #include "p2p/base/dtlstransportinternal.h"
 #include "p2p/base/fakeicetransport.h"
 #include "rtc_base/fakesslidentity.h"
-#include "rtc_base/ptr_util.h"
 
 namespace cricket {
 
@@ -55,7 +55,8 @@
   // If this constructor is called, a new fake ICE transport will be created,
   // and this FakeDtlsTransport will take the ownership.
   explicit FakeDtlsTransport(const std::string& name, int component)
-      : FakeDtlsTransport(rtc::MakeUnique<FakeIceTransport>(name, component)) {}
+      : FakeDtlsTransport(
+            absl::make_unique<FakeIceTransport>(name, component)) {}
 
   ~FakeDtlsTransport() override {
     if (dest_ && dest_->dest_ == this) {
@@ -177,7 +178,7 @@
     return local_cert_;
   }
   std::unique_ptr<rtc::SSLCertChain> GetRemoteSSLCertChain() const override {
-    return remote_cert_ ? rtc::MakeUnique<rtc::SSLCertChain>(remote_cert_)
+    return remote_cert_ ? absl::make_unique<rtc::SSLCertChain>(remote_cert_)
                         : nullptr;
   }
   bool ExportKeyingMaterial(const std::string& label,
diff --git a/p2p/base/p2ptransportchannel_unittest.cc b/p2p/base/p2ptransportchannel_unittest.cc
index 4cf3c53..cbf8b25 100644
--- a/p2p/base/p2ptransportchannel_unittest.cc
+++ b/p2p/base/p2ptransportchannel_unittest.cc
@@ -12,6 +12,7 @@
 #include <list>
 #include <memory>
 
+#include "absl/memory/memory.h"
 #include "api/fakemetricsobserver.h"
 #include "p2p/base/fakeportallocator.h"
 #include "p2p/base/icetransportinternal.h"
@@ -32,7 +33,6 @@
 #include "rtc_base/natserver.h"
 #include "rtc_base/natsocketfactory.h"
 #include "rtc_base/proxyserver.h"
-#include "rtc_base/ptr_util.h"
 #include "rtc_base/socketaddress.h"
 #include "rtc_base/ssladapter.h"
 #include "rtc_base/thread.h"
@@ -3209,13 +3209,13 @@
                                uint32_t nomination = 0) {
     IceMessage msg;
     msg.SetType(STUN_BINDING_REQUEST);
-    msg.AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
+    msg.AddAttribute(absl::make_unique<StunByteStringAttribute>(
         STUN_ATTR_USERNAME,
         conn->local_candidate().username() + ":" + remote_ufrag));
     msg.AddAttribute(
-        rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_PRIORITY, priority));
+        absl::make_unique<StunUInt32Attribute>(STUN_ATTR_PRIORITY, priority));
     if (nomination != 0) {
-      msg.AddAttribute(rtc::MakeUnique<StunUInt32Attribute>(
+      msg.AddAttribute(absl::make_unique<StunUInt32Attribute>(
           STUN_ATTR_NOMINATION, nomination));
     }
     msg.SetTransactionID(rtc::CreateRandomString(kStunTransactionIdLength));
@@ -3421,11 +3421,11 @@
   // candidate pair while we still don't have remote ICE parameters.
   IceMessage request;
   request.SetType(STUN_BINDING_REQUEST);
-  request.AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
+  request.AddAttribute(absl::make_unique<StunByteStringAttribute>(
       STUN_ATTR_USERNAME, kIceUfrag[1]));
   uint32_t prflx_priority = ICE_TYPE_PREFERENCE_PRFLX << 24;
-  request.AddAttribute(
-      rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_PRIORITY, prflx_priority));
+  request.AddAttribute(absl::make_unique<StunUInt32Attribute>(
+      STUN_ATTR_PRIORITY, prflx_priority));
   Port* port = GetPort(&ch);
   ASSERT_NE(nullptr, port);
   port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), PROTO_UDP,
@@ -3590,11 +3590,11 @@
   // Create a minimal STUN message with prflx priority.
   IceMessage request;
   request.SetType(STUN_BINDING_REQUEST);
-  request.AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
+  request.AddAttribute(absl::make_unique<StunByteStringAttribute>(
       STUN_ATTR_USERNAME, kIceUfrag[1]));
   uint32_t prflx_priority = ICE_TYPE_PREFERENCE_PRFLX << 24;
-  request.AddAttribute(
-      rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_PRIORITY, prflx_priority));
+  request.AddAttribute(absl::make_unique<StunUInt32Attribute>(
+      STUN_ATTR_PRIORITY, prflx_priority));
   EXPECT_NE(prflx_priority, remote_priority);
 
   Port* port = GetPort(&ch);
@@ -3733,11 +3733,11 @@
   // A minimal STUN message with prflx priority.
   IceMessage request;
   request.SetType(STUN_BINDING_REQUEST);
-  request.AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
+  request.AddAttribute(absl::make_unique<StunByteStringAttribute>(
       STUN_ATTR_USERNAME, kIceUfrag[1]));
   uint32_t prflx_priority = ICE_TYPE_PREFERENCE_PRFLX << 24;
-  request.AddAttribute(
-      rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_PRIORITY, prflx_priority));
+  request.AddAttribute(absl::make_unique<StunUInt32Attribute>(
+      STUN_ATTR_PRIORITY, prflx_priority));
   TestUDPPort* port = static_cast<TestUDPPort*>(GetPort(&ch));
   port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), PROTO_UDP,
                              &request, kIceUfrag[1], false);
@@ -3776,7 +3776,7 @@
   // However if the request contains use_candidate attribute, it will be
   // selected as the selected connection.
   request.AddAttribute(
-      rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_USE_CANDIDATE));
+      absl::make_unique<StunByteStringAttribute>(STUN_ATTR_USE_CANDIDATE));
   port->SignalUnknownAddress(port, rtc::SocketAddress("4.4.4.4", 4), PROTO_UDP,
                              &request, kIceUfrag[1], false);
   Connection* conn4 = WaitForConnectionTo(&ch, "4.4.4.4", 4);
@@ -3831,13 +3831,13 @@
   // nominate the selected connection.
   IceMessage request;
   request.SetType(STUN_BINDING_REQUEST);
-  request.AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
+  request.AddAttribute(absl::make_unique<StunByteStringAttribute>(
       STUN_ATTR_USERNAME, kIceUfrag[1]));
   uint32_t prflx_priority = ICE_TYPE_PREFERENCE_PRFLX << 24;
+  request.AddAttribute(absl::make_unique<StunUInt32Attribute>(
+      STUN_ATTR_PRIORITY, prflx_priority));
   request.AddAttribute(
-      rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_PRIORITY, prflx_priority));
-  request.AddAttribute(
-      rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_USE_CANDIDATE));
+      absl::make_unique<StunByteStringAttribute>(STUN_ATTR_USE_CANDIDATE));
   Port* port = GetPort(&ch);
   port->SignalUnknownAddress(port, rtc::SocketAddress("3.3.3.3", 3), PROTO_UDP,
                              &request, kIceUfrag[1], false);
diff --git a/p2p/base/port.cc b/p2p/base/port.cc
index fd4764d..5beb2bf 100644
--- a/p2p/base/port.cc
+++ b/p2p/base/port.cc
@@ -16,6 +16,7 @@
 #include <utility>
 #include <vector>
 
+#include "absl/memory/memory.h"
 #include "p2p/base/portallocator.h"
 #include "rtc_base/base64.h"
 #include "rtc_base/checks.h"
@@ -25,7 +26,6 @@
 #include "rtc_base/messagedigest.h"
 #include "rtc_base/network.h"
 #include "rtc_base/numerics/safe_minmax.h"
-#include "rtc_base/ptr_util.h"
 #include "rtc_base/stringencode.h"
 #include "rtc_base/stringutils.h"
 
@@ -762,7 +762,7 @@
   if (retransmit_attr) {
     // Inherit the incoming retransmit value in the response so the other side
     // can see our view of lost pings.
-    response.AddAttribute(rtc::MakeUnique<StunUInt32Attribute>(
+    response.AddAttribute(absl::make_unique<StunUInt32Attribute>(
         STUN_ATTR_RETRANSMIT_COUNT, retransmit_attr->value()));
 
     if (retransmit_attr->value() > CONNECTION_WRITE_CONNECT_FAILURES) {
@@ -773,7 +773,7 @@
     }
   }
 
-  response.AddAttribute(rtc::MakeUnique<StunXorAddressAttribute>(
+  response.AddAttribute(absl::make_unique<StunXorAddressAttribute>(
       STUN_ATTR_XOR_MAPPED_ADDRESS, addr));
   response.AddMessageIntegrity(password_);
   response.AddFingerprint();
@@ -954,38 +954,38 @@
     std::string username;
     connection_->port()->CreateStunUsername(
         connection_->remote_candidate().username(), &username);
-    request->AddAttribute(
-        rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_USERNAME, username));
+    request->AddAttribute(absl::make_unique<StunByteStringAttribute>(
+        STUN_ATTR_USERNAME, username));
 
     // connection_ already holds this ping, so subtract one from count.
     if (connection_->port()->send_retransmit_count_attribute()) {
-      request->AddAttribute(rtc::MakeUnique<StunUInt32Attribute>(
+      request->AddAttribute(absl::make_unique<StunUInt32Attribute>(
           STUN_ATTR_RETRANSMIT_COUNT,
           static_cast<uint32_t>(connection_->pings_since_last_response_.size() -
                                 1)));
     }
     uint32_t network_info = connection_->port()->Network()->id();
     network_info = (network_info << 16) | connection_->port()->network_cost();
-    request->AddAttribute(rtc::MakeUnique<StunUInt32Attribute>(
+    request->AddAttribute(absl::make_unique<StunUInt32Attribute>(
         STUN_ATTR_NETWORK_INFO, network_info));
 
     // Adding ICE_CONTROLLED or ICE_CONTROLLING attribute based on the role.
     if (connection_->port()->GetIceRole() == ICEROLE_CONTROLLING) {
-      request->AddAttribute(rtc::MakeUnique<StunUInt64Attribute>(
+      request->AddAttribute(absl::make_unique<StunUInt64Attribute>(
           STUN_ATTR_ICE_CONTROLLING, connection_->port()->IceTiebreaker()));
       // We should have either USE_CANDIDATE attribute or ICE_NOMINATION
       // attribute but not both. That was enforced in p2ptransportchannel.
       if (connection_->use_candidate_attr()) {
-        request->AddAttribute(
-            rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_USE_CANDIDATE));
+        request->AddAttribute(absl::make_unique<StunByteStringAttribute>(
+            STUN_ATTR_USE_CANDIDATE));
       }
       if (connection_->nomination() &&
           connection_->nomination() != connection_->acked_nomination()) {
-        request->AddAttribute(rtc::MakeUnique<StunUInt32Attribute>(
+        request->AddAttribute(absl::make_unique<StunUInt32Attribute>(
             STUN_ATTR_NOMINATION, connection_->nomination()));
       }
     } else if (connection_->port()->GetIceRole() == ICEROLE_CONTROLLED) {
-      request->AddAttribute(rtc::MakeUnique<StunUInt64Attribute>(
+      request->AddAttribute(absl::make_unique<StunUInt64Attribute>(
           STUN_ATTR_ICE_CONTROLLED, connection_->port()->IceTiebreaker()));
     } else {
       RTC_NOTREACHED();
@@ -1004,7 +1004,7 @@
     uint32_t prflx_priority =
         type_preference << 24 |
         (connection_->local_candidate().priority() & 0x00FFFFFF);
-    request->AddAttribute(rtc::MakeUnique<StunUInt32Attribute>(
+    request->AddAttribute(absl::make_unique<StunUInt32Attribute>(
         STUN_ATTR_PRIORITY, prflx_priority));
 
     // Adding Message Integrity attribute.
diff --git a/p2p/base/port_unittest.cc b/p2p/base/port_unittest.cc
index 423db3e..5aaf315 100644
--- a/p2p/base/port_unittest.cc
+++ b/p2p/base/port_unittest.cc
@@ -11,6 +11,7 @@
 #include <list>
 #include <memory>
 
+#include "absl/memory/memory.h"
 #include "p2p/base/basicpacketsocketfactory.h"
 #include "p2p/base/p2pconstants.h"
 #include "p2p/base/relayport.h"
@@ -28,7 +29,6 @@
 #include "rtc_base/logging.h"
 #include "rtc_base/natserver.h"
 #include "rtc_base/natsocketfactory.h"
-#include "rtc_base/ptr_util.h"
 #include "rtc_base/socketaddress.h"
 #include "rtc_base/ssladapter.h"
 #include "rtc_base/stringutils.h"
@@ -762,8 +762,8 @@
   IceMessage* CreateStunMessageWithUsername(int type,
                                             const std::string& username) {
     IceMessage* msg = CreateStunMessage(type);
-    msg->AddAttribute(
-        rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_USERNAME, username));
+    msg->AddAttribute(absl::make_unique<StunByteStringAttribute>(
+        STUN_ATTR_USERNAME, username));
     return msg;
   }
   TestPort* CreateTestPort(const rtc::SocketAddress& addr,
@@ -1412,11 +1412,11 @@
       CreateStunMessage(STUN_BINDING_REQUEST));
   const StunByteStringAttribute* username_attr =
       msg->GetByteString(STUN_ATTR_USERNAME);
-  modified_req->AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
+  modified_req->AddAttribute(absl::make_unique<StunByteStringAttribute>(
       STUN_ATTR_USERNAME, username_attr->GetString()));
   // To make sure we receive error response, adding tiebreaker less than
   // what's present in request.
-  modified_req->AddAttribute(rtc::MakeUnique<StunUInt64Attribute>(
+  modified_req->AddAttribute(absl::make_unique<StunUInt64Attribute>(
       STUN_ATTR_ICE_CONTROLLING, kTiebreaker1 - 1));
   modified_req->AddMessageIntegrity("lpass");
   modified_req->AddFingerprint();
@@ -2058,7 +2058,7 @@
 
   // BINDING-RESPONSE without username, with MESSAGE-INTEGRITY and FINGERPRINT.
   in_msg.reset(CreateStunMessage(STUN_BINDING_RESPONSE));
-  in_msg->AddAttribute(rtc::MakeUnique<StunXorAddressAttribute>(
+  in_msg->AddAttribute(absl::make_unique<StunXorAddressAttribute>(
       STUN_ATTR_XOR_MAPPED_ADDRESS, kLocalAddr2));
   in_msg->AddMessageIntegrity("rpass");
   in_msg->AddFingerprint();
@@ -2070,7 +2070,7 @@
 
   // BINDING-ERROR-RESPONSE without username, with error, M-I, and FINGERPRINT.
   in_msg.reset(CreateStunMessage(STUN_BINDING_ERROR_RESPONSE));
-  in_msg->AddAttribute(rtc::MakeUnique<StunErrorCodeAttribute>(
+  in_msg->AddAttribute(absl::make_unique<StunErrorCodeAttribute>(
       STUN_ATTR_ERROR_CODE, STUN_ERROR_SERVER_ERROR,
       STUN_ERROR_REASON_SERVER_ERROR));
   in_msg->AddFingerprint();
@@ -2222,7 +2222,7 @@
 
   // Valid BINDING-RESPONSE, except no FINGERPRINT.
   in_msg.reset(CreateStunMessage(STUN_BINDING_RESPONSE));
-  in_msg->AddAttribute(rtc::MakeUnique<StunXorAddressAttribute>(
+  in_msg->AddAttribute(absl::make_unique<StunXorAddressAttribute>(
       STUN_ATTR_XOR_MAPPED_ADDRESS, kLocalAddr2));
   in_msg->AddMessageIntegrity("rpass");
   WriteStunMessage(in_msg.get(), buf.get());
@@ -2240,7 +2240,7 @@
 
   // Valid BINDING-ERROR-RESPONSE, except no FINGERPRINT.
   in_msg.reset(CreateStunMessage(STUN_BINDING_ERROR_RESPONSE));
-  in_msg->AddAttribute(rtc::MakeUnique<StunErrorCodeAttribute>(
+  in_msg->AddAttribute(absl::make_unique<StunErrorCodeAttribute>(
       STUN_ATTR_ERROR_CODE, STUN_ERROR_SERVER_ERROR,
       STUN_ERROR_REASON_SERVER_ERROR));
   in_msg->AddMessageIntegrity("rpass");
diff --git a/p2p/base/relayserver_unittest.cc b/p2p/base/relayserver_unittest.cc
index 36b51f1..c4c026a 100644
--- a/p2p/base/relayserver_unittest.cc
+++ b/p2p/base/relayserver_unittest.cc
@@ -12,11 +12,11 @@
 #include <string>
 #include <utility>
 
+#include "absl/memory/memory.h"
 #include "p2p/base/relayserver.h"
 #include "rtc_base/gunit.h"
 #include "rtc_base/helpers.h"
 #include "rtc_base/logging.h"
-#include "rtc_base/ptr_util.h"
 #include "rtc_base/socketaddress.h"
 #include "rtc_base/ssladapter.h"
 #include "rtc_base/testclient.h"
@@ -59,10 +59,10 @@
     server_->AddExternalSocket(
         rtc::AsyncUDPSocket::Create(ss_.get(), server_ext_addr));
 
-    client1_.reset(new rtc::TestClient(
-        WrapUnique(rtc::AsyncUDPSocket::Create(ss_.get(), client1_addr))));
-    client2_.reset(new rtc::TestClient(
-        WrapUnique(rtc::AsyncUDPSocket::Create(ss_.get(), client2_addr))));
+    client1_.reset(new rtc::TestClient(absl::WrapUnique(
+        rtc::AsyncUDPSocket::Create(ss_.get(), client1_addr))));
+    client2_.reset(new rtc::TestClient(absl::WrapUnique(
+        rtc::AsyncUDPSocket::Create(ss_.get(), client2_addr))));
   }
 
   void Allocate() {
diff --git a/p2p/base/stun.cc b/p2p/base/stun.cc
index 38990f9..cc9fb4e 100644
--- a/p2p/base/stun.cc
+++ b/p2p/base/stun.cc
@@ -16,12 +16,12 @@
 #include <memory>
 #include <utility>
 
+#include "absl/memory/memory.h"
 #include "rtc_base/byteorder.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/crc32.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/messagedigest.h"
-#include "rtc_base/ptr_util.h"
 #include "rtc_base/stringencode.h"
 
 using rtc::ByteBufferReader;
@@ -246,7 +246,7 @@
 bool StunMessage::AddMessageIntegrity(const char* key, size_t keylen) {
   // Add the attribute with a dummy value. Since this is a known attribute, it
   // can't fail.
-  auto msg_integrity_attr_ptr = rtc::MakeUnique<StunByteStringAttribute>(
+  auto msg_integrity_attr_ptr = absl::make_unique<StunByteStringAttribute>(
       STUN_ATTR_MESSAGE_INTEGRITY, std::string(kStunMessageIntegritySize, '0'));
   auto* msg_integrity_attr = msg_integrity_attr_ptr.get();
   AddAttribute(std::move(msg_integrity_attr_ptr));
@@ -307,7 +307,7 @@
   // Add the attribute with a dummy value. Since this is a known attribute,
   // it can't fail.
   auto fingerprint_attr_ptr =
-      rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_FINGERPRINT, 0);
+      absl::make_unique<StunUInt32Attribute>(STUN_ATTR_FINGERPRINT, 0);
   auto* fingerprint_attr = fingerprint_attr_ptr.get();
   AddAttribute(std::move(fingerprint_attr_ptr));
 
@@ -522,38 +522,38 @@
 
 std::unique_ptr<StunAddressAttribute> StunAttribute::CreateAddress(
     uint16_t type) {
-  return rtc::MakeUnique<StunAddressAttribute>(type, 0);
+  return absl::make_unique<StunAddressAttribute>(type, 0);
 }
 
 std::unique_ptr<StunXorAddressAttribute> StunAttribute::CreateXorAddress(
     uint16_t type) {
-  return rtc::MakeUnique<StunXorAddressAttribute>(type, 0, nullptr);
+  return absl::make_unique<StunXorAddressAttribute>(type, 0, nullptr);
 }
 
 std::unique_ptr<StunUInt64Attribute> StunAttribute::CreateUInt64(
     uint16_t type) {
-  return rtc::MakeUnique<StunUInt64Attribute>(type);
+  return absl::make_unique<StunUInt64Attribute>(type);
 }
 
 std::unique_ptr<StunUInt32Attribute> StunAttribute::CreateUInt32(
     uint16_t type) {
-  return rtc::MakeUnique<StunUInt32Attribute>(type);
+  return absl::make_unique<StunUInt32Attribute>(type);
 }
 
 std::unique_ptr<StunByteStringAttribute> StunAttribute::CreateByteString(
     uint16_t type) {
-  return rtc::MakeUnique<StunByteStringAttribute>(type, 0);
+  return absl::make_unique<StunByteStringAttribute>(type, 0);
 }
 
 std::unique_ptr<StunErrorCodeAttribute> StunAttribute::CreateErrorCode() {
-  return rtc::MakeUnique<StunErrorCodeAttribute>(
+  return absl::make_unique<StunErrorCodeAttribute>(
       STUN_ATTR_ERROR_CODE, StunErrorCodeAttribute::MIN_SIZE);
 }
 
 std::unique_ptr<StunUInt16ListAttribute>
 StunAttribute::CreateUnknownAttributes() {
-  return rtc::MakeUnique<StunUInt16ListAttribute>(STUN_ATTR_UNKNOWN_ATTRIBUTES,
-                                                  0);
+  return absl::make_unique<StunUInt16ListAttribute>(
+      STUN_ATTR_UNKNOWN_ATTRIBUTES, 0);
 }
 
 StunAddressAttribute::StunAddressAttribute(uint16_t type,
diff --git a/p2p/base/stun_unittest.cc b/p2p/base/stun_unittest.cc
index 65b976e..6d95108 100644
--- a/p2p/base/stun_unittest.cc
+++ b/p2p/base/stun_unittest.cc
@@ -11,13 +11,13 @@
 #include <string>
 #include <utility>
 
+#include "absl/memory/memory.h"
 #include "p2p/base/stun.h"
 #include "rtc_base/arraysize.h"
 #include "rtc_base/bytebuffer.h"
 #include "rtc_base/gunit.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/messagedigest.h"
-#include "rtc_base/ptr_util.h"
 #include "rtc_base/socketaddress.h"
 
 namespace cricket {
@@ -1116,7 +1116,7 @@
       std::string(reinterpret_cast<const char*>(kTestTransactionId1),
                   kStunTransactionIdLength));
   auto origin =
-      rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_ORIGIN, kTestOrigin);
+      absl::make_unique<StunByteStringAttribute>(STUN_ATTR_ORIGIN, kTestOrigin);
   msg.AddAttribute(std::move(origin));
 
   rtc::ByteBufferWriter out;
diff --git a/p2p/base/stunrequest.cc b/p2p/base/stunrequest.cc
index a639ee3..56410be 100644
--- a/p2p/base/stunrequest.cc
+++ b/p2p/base/stunrequest.cc
@@ -14,10 +14,10 @@
 #include <memory>
 #include <vector>
 
+#include "absl/memory/memory.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/helpers.h"
 #include "rtc_base/logging.h"
-#include "rtc_base/ptr_util.h"
 #include "rtc_base/stringencode.h"
 
 namespace cricket {
@@ -190,8 +190,8 @@
 void StunRequest::Construct() {
   if (msg_->type() == 0) {
     if (!origin_.empty()) {
-      msg_->AddAttribute(
-          rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_ORIGIN, origin_));
+      msg_->AddAttribute(absl::make_unique<StunByteStringAttribute>(
+          STUN_ATTR_ORIGIN, origin_));
     }
     Prepare(msg_);
     RTC_DCHECK(msg_->type() != 0);
diff --git a/p2p/base/stunserver_unittest.cc b/p2p/base/stunserver_unittest.cc
index f9c7ad7..eb94e72 100644
--- a/p2p/base/stunserver_unittest.cc
+++ b/p2p/base/stunserver_unittest.cc
@@ -11,10 +11,10 @@
 #include <memory>
 #include <string>
 
+#include "absl/memory/memory.h"
 #include "p2p/base/stunserver.h"
 #include "rtc_base/gunit.h"
 #include "rtc_base/logging.h"
-#include "rtc_base/ptr_util.h"
 #include "rtc_base/testclient.h"
 #include "rtc_base/thread.h"
 #include "rtc_base/virtualsocketserver.h"
@@ -33,7 +33,7 @@
     server_.reset(
         new StunServer(rtc::AsyncUDPSocket::Create(ss_.get(), server_addr)));
     client_.reset(new rtc::TestClient(
-        WrapUnique(rtc::AsyncUDPSocket::Create(ss_.get(), client_addr))));
+        absl::WrapUnique(rtc::AsyncUDPSocket::Create(ss_.get(), client_addr))));
 
     network_.Start();
   }
diff --git a/p2p/base/testturncustomizer.h b/p2p/base/testturncustomizer.h
index 265b536..7ca4579 100644
--- a/p2p/base/testturncustomizer.h
+++ b/p2p/base/testturncustomizer.h
@@ -11,9 +11,9 @@
 #ifndef P2P_BASE_TESTTURNCUSTOMIZER_H_
 #define P2P_BASE_TESTTURNCUSTOMIZER_H_
 
+#include "absl/memory/memory.h"
 #include "api/turncustomizer.h"
 #include "rtc_base/gunit.h"
-#include "rtc_base/ptr_util.h"
 
 namespace cricket {
 
@@ -33,7 +33,7 @@
 
     ASSERT_NE(0, message->type());
     if (add_counter_) {
-      message->AddAttribute(rtc::MakeUnique<cricket::StunUInt32Attribute>(
+      message->AddAttribute(absl::make_unique<cricket::StunUInt32Attribute>(
           STUN_ATTR_COUNTER, modify_cnt_));
     }
     return;
diff --git a/p2p/base/turnport.cc b/p2p/base/turnport.cc
index cb7cfa8..13c9a46 100644
--- a/p2p/base/turnport.cc
+++ b/p2p/base/turnport.cc
@@ -15,6 +15,7 @@
 #include <utility>
 #include <vector>
 
+#include "absl/memory/memory.h"
 #include "absl/types/optional.h"
 #include "p2p/base/stun.h"
 #include "rtc_base/asyncpacketsocket.h"
@@ -22,7 +23,6 @@
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/nethelpers.h"
-#include "rtc_base/ptr_util.h"
 #include "rtc_base/socketaddress.h"
 #include "rtc_base/stringencode.h"
 
@@ -1058,12 +1058,12 @@
 void TurnPort::AddRequestAuthInfo(StunMessage* msg) {
   // If we've gotten the necessary data from the server, add it to our request.
   RTC_DCHECK(!hash_.empty());
-  msg->AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
+  msg->AddAttribute(absl::make_unique<StunByteStringAttribute>(
       STUN_ATTR_USERNAME, credentials_.username));
   msg->AddAttribute(
-      rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_REALM, realm_));
+      absl::make_unique<StunByteStringAttribute>(STUN_ATTR_REALM, realm_));
   msg->AddAttribute(
-      rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_NONCE, nonce_));
+      absl::make_unique<StunByteStringAttribute>(STUN_ATTR_NONCE, nonce_));
   const bool success = msg->AddMessageIntegrity(hash());
   RTC_DCHECK(success);
 }
@@ -1453,7 +1453,7 @@
   request->SetType(TURN_REFRESH_REQUEST);
   if (lifetime_ > -1) {
     request->AddAttribute(
-        rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_LIFETIME, lifetime_));
+        absl::make_unique<StunUInt32Attribute>(STUN_ATTR_LIFETIME, lifetime_));
   }
 
   port_->AddRequestAuthInfo(request);
@@ -1536,7 +1536,7 @@
 void TurnCreatePermissionRequest::Prepare(StunMessage* request) {
   // Create the request as indicated in RFC5766, Section 9.1.
   request->SetType(TURN_CREATE_PERMISSION_REQUEST);
-  request->AddAttribute(rtc::MakeUnique<StunXorAddressAttribute>(
+  request->AddAttribute(absl::make_unique<StunXorAddressAttribute>(
       STUN_ATTR_XOR_PEER_ADDRESS, ext_addr_));
   port_->AddRequestAuthInfo(request);
   port_->TurnCustomizerMaybeModifyOutgoingStunMessage(request);
@@ -1604,9 +1604,9 @@
 void TurnChannelBindRequest::Prepare(StunMessage* request) {
   // Create the request as indicated in RFC5766, Section 11.1.
   request->SetType(TURN_CHANNEL_BIND_REQUEST);
-  request->AddAttribute(rtc::MakeUnique<StunUInt32Attribute>(
+  request->AddAttribute(absl::make_unique<StunUInt32Attribute>(
       STUN_ATTR_CHANNEL_NUMBER, channel_id_ << 16));
-  request->AddAttribute(rtc::MakeUnique<StunXorAddressAttribute>(
+  request->AddAttribute(absl::make_unique<StunXorAddressAttribute>(
       STUN_ATTR_XOR_PEER_ADDRESS, ext_addr_));
   port_->AddRequestAuthInfo(request);
   port_->TurnCustomizerMaybeModifyOutgoingStunMessage(request);
@@ -1697,10 +1697,10 @@
     TurnMessage msg;
     msg.SetType(TURN_SEND_INDICATION);
     msg.SetTransactionID(rtc::CreateRandomString(kStunTransactionIdLength));
-    msg.AddAttribute(rtc::MakeUnique<StunXorAddressAttribute>(
+    msg.AddAttribute(absl::make_unique<StunXorAddressAttribute>(
         STUN_ATTR_XOR_PEER_ADDRESS, ext_addr_));
     msg.AddAttribute(
-        rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_DATA, data, size));
+        absl::make_unique<StunByteStringAttribute>(STUN_ATTR_DATA, data, size));
 
     port_->TurnCustomizerMaybeModifyOutgoingStunMessage(&msg);
 
diff --git a/p2p/base/turnport_unittest.cc b/p2p/base/turnport_unittest.cc
index 5917a7f..bac35e8 100644
--- a/p2p/base/turnport_unittest.cc
+++ b/p2p/base/turnport_unittest.cc
@@ -16,6 +16,7 @@
 #include <utility>
 #include <vector>
 
+#include "absl/memory/memory.h"
 #include "p2p/base/basicpacketsocketfactory.h"
 #include "p2p/base/p2pconstants.h"
 #include "p2p/base/portallocator.h"
@@ -33,7 +34,6 @@
 #include "rtc_base/gunit.h"
 #include "rtc_base/helpers.h"
 #include "rtc_base/logging.h"
-#include "rtc_base/ptr_util.h"
 #include "rtc_base/socketadapters.h"
 #include "rtc_base/socketaddress.h"
 #include "rtc_base/ssladapter.h"
diff --git a/p2p/base/turnserver.cc b/p2p/base/turnserver.cc
index b7ab2e3..a7a8c57 100644
--- a/p2p/base/turnserver.cc
+++ b/p2p/base/turnserver.cc
@@ -13,6 +13,7 @@
 #include <tuple>  // for std::tie
 #include <utility>
 
+#include "absl/memory/memory.h"
 #include "p2p/base/asyncstuntcpsocket.h"
 #include "p2p/base/packetsocketfactory.h"
 #include "p2p/base/stun.h"
@@ -22,7 +23,6 @@
 #include "rtc_base/helpers.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/messagedigest.h"
-#include "rtc_base/ptr_util.h"
 #include "rtc_base/socketadapters.h"
 #include "rtc_base/stringencode.h"
 #include "rtc_base/thread.h"
@@ -114,7 +114,7 @@
     return false;
   resp->SetType(resp_type);
   resp->SetTransactionID(req->transaction_id());
-  resp->AddAttribute(rtc::MakeUnique<cricket::StunErrorCodeAttribute>(
+  resp->AddAttribute(absl::make_unique<cricket::StunErrorCodeAttribute>(
       STUN_ATTR_ERROR_CODE, code, reason));
   return true;
 }
@@ -373,7 +373,7 @@
   InitResponse(req, &response);
 
   // Tell the user the address that we received their request from.
-  auto mapped_addr_attr = rtc::MakeUnique<StunXorAddressAttribute>(
+  auto mapped_addr_attr = absl::make_unique<StunXorAddressAttribute>(
       STUN_ATTR_XOR_MAPPED_ADDRESS, conn->src());
   response.AddAttribute(std::move(mapped_addr_attr));
 
@@ -496,10 +496,10 @@
     timestamp = ts_for_next_nonce_;
     ts_for_next_nonce_ = 0;
   }
-  resp.AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
+  resp.AddAttribute(absl::make_unique<StunByteStringAttribute>(
       STUN_ATTR_NONCE, GenerateNonce(timestamp)));
   resp.AddAttribute(
-      rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_REALM, realm_));
+      absl::make_unique<StunByteStringAttribute>(STUN_ATTR_REALM, realm_));
   SendStun(conn, &resp);
 }
 
@@ -510,8 +510,8 @@
   TurnMessage resp;
   InitErrorResponse(msg, STUN_ERROR_TRY_ALTERNATE,
                     STUN_ERROR_REASON_TRY_ALTERNATE_SERVER, &resp);
-  resp.AddAttribute(
-      rtc::MakeUnique<StunAddressAttribute>(STUN_ATTR_ALTERNATE_SERVER, addr));
+  resp.AddAttribute(absl::make_unique<StunAddressAttribute>(
+      STUN_ATTR_ALTERNATE_SERVER, addr));
   SendStun(conn, &resp);
 }
 
@@ -520,7 +520,7 @@
   rtc::ByteBufferWriter buf;
   // Add a SOFTWARE attribute if one is set.
   if (!software_.empty()) {
-    msg->AddAttribute(rtc::MakeUnique<StunByteStringAttribute>(
+    msg->AddAttribute(absl::make_unique<StunByteStringAttribute>(
         STUN_ATTR_SOFTWARE, software_));
   }
   msg->Write(&buf);
@@ -686,12 +686,12 @@
   TurnMessage response;
   InitResponse(msg, &response);
 
-  auto mapped_addr_attr = rtc::MakeUnique<StunXorAddressAttribute>(
+  auto mapped_addr_attr = absl::make_unique<StunXorAddressAttribute>(
       STUN_ATTR_XOR_MAPPED_ADDRESS, conn_.src());
-  auto relayed_addr_attr = rtc::MakeUnique<StunXorAddressAttribute>(
+  auto relayed_addr_attr = absl::make_unique<StunXorAddressAttribute>(
       STUN_ATTR_XOR_RELAYED_ADDRESS, external_socket_->GetLocalAddress());
   auto lifetime_attr =
-      rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_LIFETIME, lifetime_secs);
+      absl::make_unique<StunUInt32Attribute>(STUN_ATTR_LIFETIME, lifetime_secs);
   response.AddAttribute(std::move(mapped_addr_attr));
   response.AddAttribute(std::move(relayed_addr_attr));
   response.AddAttribute(std::move(lifetime_attr));
@@ -716,7 +716,7 @@
   InitResponse(msg, &response);
 
   auto lifetime_attr =
-      rtc::MakeUnique<StunUInt32Attribute>(STUN_ATTR_LIFETIME, lifetime_secs);
+      absl::make_unique<StunUInt32Attribute>(STUN_ATTR_LIFETIME, lifetime_secs);
   response.AddAttribute(std::move(lifetime_attr));
 
   SendResponse(&response);
@@ -860,10 +860,10 @@
     msg.SetType(TURN_DATA_INDICATION);
     msg.SetTransactionID(
         rtc::CreateRandomString(kStunTransactionIdLength));
-    msg.AddAttribute(rtc::MakeUnique<StunXorAddressAttribute>(
+    msg.AddAttribute(absl::make_unique<StunXorAddressAttribute>(
         STUN_ATTR_XOR_PEER_ADDRESS, addr));
     msg.AddAttribute(
-        rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_DATA, data, size));
+        absl::make_unique<StunByteStringAttribute>(STUN_ATTR_DATA, data, size));
     server_->SendStun(&conn_, &msg);
   } else {
     RTC_LOG(LS_WARNING)