Remove QuicWrapUnique.

Use absl::WrapUnique directly instead.

Use make_unique instead of WrapUnique(new) in
quic/test_tools/quic_test_client.cc and quic/tools/quic_client.cc.

Add comment in quic/core/crypto/curve25519_key_exchange.cc about why make_unique
cannot be used, similar to the existing comment in
quic/masque/masque_epoll_client.cc.

PiperOrigin-RevId: 366474319
Change-Id: Ibfb5b8bc5ec8e93cba76f8de9b6ba9496a2636c6
diff --git a/quic/core/batch_writer/quic_batch_writer_base.cc b/quic/core/batch_writer/quic_batch_writer_base.cc
index aacb977..8b4a27f 100644
--- a/quic/core/batch_writer/quic_batch_writer_base.cc
+++ b/quic/core/batch_writer/quic_batch_writer_base.cc
@@ -7,7 +7,6 @@
 
 #include "quic/platform/api/quic_export.h"
 #include "quic/platform/api/quic_flags.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_server_stats.h"
 
 namespace quic {
diff --git a/quic/core/crypto/curve25519_key_exchange.cc b/quic/core/crypto/curve25519_key_exchange.cc
index 8894db1..bdf3a08 100644
--- a/quic/core/crypto/curve25519_key_exchange.cc
+++ b/quic/core/crypto/curve25519_key_exchange.cc
@@ -8,11 +8,11 @@
 #include <cstring>
 #include <string>
 
+#include "absl/memory/memory.h"
 #include "absl/strings/string_view.h"
 #include "third_party/boringssl/src/include/openssl/curve25519.h"
 #include "quic/core/crypto/quic_random.h"
 #include "quic/platform/api/quic_bug_tracker.h"
-#include "quic/platform/api/quic_ptr_util.h"
 
 namespace quic {
 
@@ -47,7 +47,9 @@
     return nullptr;
   }
 
-  auto ka = QuicWrapUnique(new Curve25519KeyExchange);
+  // Use absl::WrapUnique(new) instead of std::make_unique because
+  // Curve25519KeyExchange has a private constructor.
+  auto ka = absl::WrapUnique(new Curve25519KeyExchange);
   memcpy(ka->private_key_, private_key.data(), X25519_PRIVATE_KEY_LEN);
   X25519_public_from_private(ka->public_key_, ka->private_key_);
   return ka;
diff --git a/quic/core/crypto/p256_key_exchange.cc b/quic/core/crypto/p256_key_exchange.cc
index 0ce7a24..2a13c2e 100644
--- a/quic/core/crypto/p256_key_exchange.cc
+++ b/quic/core/crypto/p256_key_exchange.cc
@@ -10,13 +10,13 @@
 #include <string>
 #include <utility>
 
+#include "absl/memory/memory.h"
 #include "absl/strings/string_view.h"
 #include "third_party/boringssl/src/include/openssl/ec.h"
 #include "third_party/boringssl/src/include/openssl/ecdh.h"
 #include "third_party/boringssl/src/include/openssl/err.h"
 #include "third_party/boringssl/src/include/openssl/evp.h"
 #include "quic/platform/api/quic_logging.h"
-#include "quic/platform/api/quic_ptr_util.h"
 
 namespace quic {
 
@@ -57,7 +57,7 @@
     return nullptr;
   }
 
-  return QuicWrapUnique(
+  return absl::WrapUnique(
       new P256KeyExchange(std::move(private_key), public_key));
 }
 
diff --git a/quic/core/crypto/quic_crypto_client_config.cc b/quic/core/crypto/quic_crypto_client_config.cc
index 7a72c5a..c886cbe 100644
--- a/quic/core/crypto/quic_crypto_client_config.cc
+++ b/quic/core/crypto/quic_crypto_client_config.cc
@@ -9,6 +9,7 @@
 #include <string>
 
 #include "absl/base/macros.h"
+#include "absl/memory/memory.h"
 #include "absl/strings/match.h"
 #include "absl/strings/string_view.h"
 #include "third_party/boringssl/src/include/openssl/ssl.h"
@@ -33,7 +34,6 @@
 #include "quic/platform/api/quic_hostname_utils.h"
 #include "quic/platform/api/quic_logging.h"
 #include "quic/platform/api/quic_map_util.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "common/platform/api/quiche_text_utils.h"
 
 namespace quic {
@@ -375,7 +375,7 @@
   }
 
   CachedState* cached = new CachedState;
-  cached_states_.insert(std::make_pair(server_id, QuicWrapUnique(cached)));
+  cached_states_.insert(std::make_pair(server_id, absl::WrapUnique(cached)));
   bool cache_populated = PopulateFromCanonicalConfig(server_id, cached);
   QUIC_CLIENT_HISTOGRAM_BOOL(
       "QuicCryptoClientConfig.PopulatedFromCanonicalConfig", cache_populated,
diff --git a/quic/core/http/quic_receive_control_stream_test.cc b/quic/core/http/quic_receive_control_stream_test.cc
index cc54442..c913343 100644
--- a/quic/core/http/quic_receive_control_stream_test.cc
+++ b/quic/core/http/quic_receive_control_stream_test.cc
@@ -4,13 +4,13 @@
 
 #include "quic/core/http/quic_receive_control_stream.h"
 
+#include "absl/memory/memory.h"
 #include "absl/strings/escaping.h"
 #include "absl/strings/string_view.h"
 #include "quic/core/http/http_constants.h"
 #include "quic/core/qpack/qpack_header_table.h"
 #include "quic/core/quic_types.h"
 #include "quic/core/quic_utils.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/test_tools/qpack/qpack_encoder_peer.h"
 #include "quic/test_tools/quic_spdy_session_peer.h"
 #include "quic/test_tools/quic_stream_peer.h"
@@ -106,7 +106,7 @@
     stream_ = new TestStream(GetNthClientInitiatedBidirectionalStreamId(
                                  GetParam().version.transport_version, 0),
                              &session_);
-    session_.ActivateStream(QuicWrapUnique(stream_));
+    session_.ActivateStream(absl::WrapUnique(stream_));
   }
 
   Perspective perspective() const { return GetParam().perspective; }
diff --git a/quic/core/http/quic_server_session_base_test.cc b/quic/core/http/quic_server_session_base_test.cc
index f9483fe..29750f2 100644
--- a/quic/core/http/quic_server_session_base_test.cc
+++ b/quic/core/http/quic_server_session_base_test.cc
@@ -9,6 +9,7 @@
 #include <string>
 #include <utility>
 
+#include "absl/memory/memory.h"
 #include "absl/strings/string_view.h"
 #include "quic/core/crypto/null_encrypter.h"
 #include "quic/core/crypto/quic_crypto_server_config.h"
@@ -21,7 +22,6 @@
 #include "quic/core/tls_server_handshaker.h"
 #include "quic/platform/api/quic_expect_bug.h"
 #include "quic/platform/api/quic_flags.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_socket_address.h"
 #include "quic/platform/api/quic_test.h"
 #include "quic/test_tools/crypto_test_utils.h"
@@ -83,14 +83,14 @@
     }
     QuicSpdyStream* stream = new QuicSimpleServerStream(
         id, this, BIDIRECTIONAL, quic_simple_server_backend_);
-    ActivateStream(QuicWrapUnique(stream));
+    ActivateStream(absl::WrapUnique(stream));
     return stream;
   }
 
   QuicSpdyStream* CreateIncomingStream(PendingStream* pending) override {
     QuicSpdyStream* stream = new QuicSimpleServerStream(
         pending, this, BIDIRECTIONAL, quic_simple_server_backend_);
-    ActivateStream(QuicWrapUnique(stream));
+    ActivateStream(absl::WrapUnique(stream));
     return stream;
   }
 
@@ -107,7 +107,7 @@
     QuicSpdyStream* stream = new QuicSimpleServerStream(
         GetNextOutgoingUnidirectionalStreamId(), this, WRITE_UNIDIRECTIONAL,
         quic_simple_server_backend_);
-    ActivateStream(QuicWrapUnique(stream));
+    ActivateStream(absl::WrapUnique(stream));
     return stream;
   }
 
diff --git a/quic/core/http/quic_spdy_client_session.cc b/quic/core/http/quic_spdy_client_session.cc
index 1094f4d..32d43f3 100644
--- a/quic/core/http/quic_spdy_client_session.cc
+++ b/quic/core/http/quic_spdy_client_session.cc
@@ -7,6 +7,7 @@
 #include <string>
 #include <utility>
 
+#include "absl/memory/memory.h"
 #include "quic/core/crypto/crypto_protocol.h"
 #include "quic/core/http/quic_spdy_client_stream.h"
 #include "quic/core/http/spdy_utils.h"
@@ -16,7 +17,6 @@
 #include "quic/platform/api/quic_flag_utils.h"
 #include "quic/platform/api/quic_flags.h"
 #include "quic/platform/api/quic_logging.h"
-#include "quic/platform/api/quic_ptr_util.h"
 
 namespace quic {
 
@@ -181,7 +181,7 @@
     PendingStream* pending) {
   QuicSpdyStream* stream =
       new QuicSpdyClientStream(pending, this, READ_UNIDIRECTIONAL);
-  ActivateStream(QuicWrapUnique(stream));
+  ActivateStream(absl::WrapUnique(stream));
   return stream;
 }
 
@@ -191,7 +191,7 @@
   }
   QuicSpdyStream* stream =
       new QuicSpdyClientStream(id, this, READ_UNIDIRECTIONAL);
-  ActivateStream(QuicWrapUnique(stream));
+  ActivateStream(absl::WrapUnique(stream));
   return stream;
 }
 
diff --git a/quic/core/http/quic_spdy_client_session_test.cc b/quic/core/http/quic_spdy_client_session_test.cc
index a1c36e2..7197c8a 100644
--- a/quic/core/http/quic_spdy_client_session_test.cc
+++ b/quic/core/http/quic_spdy_client_session_test.cc
@@ -10,6 +10,7 @@
 #include <vector>
 
 #include "absl/base/macros.h"
+#include "absl/memory/memory.h"
 #include "absl/strings/str_cat.h"
 #include "absl/strings/string_view.h"
 #include "quic/core/crypto/null_decrypter.h"
@@ -25,7 +26,6 @@
 #include "quic/core/tls_client_handshaker.h"
 #include "quic/platform/api/quic_expect_bug.h"
 #include "quic/platform/api/quic_flags.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_socket_address.h"
 #include "quic/platform/api/quic_test.h"
 #include "quic/test_tools/crypto_test_utils.h"
@@ -83,7 +83,7 @@
     }
     MockQuicSpdyClientStream* stream =
         new MockQuicSpdyClientStream(id, this, READ_UNIDIRECTIONAL);
-    ActivateStream(QuicWrapUnique(stream));
+    ActivateStream(absl::WrapUnique(stream));
     return stream;
   }
 };
diff --git a/quic/core/http/quic_spdy_server_stream_base_test.cc b/quic/core/http/quic_spdy_server_stream_base_test.cc
index bada263..fe630de 100644
--- a/quic/core/http/quic_spdy_server_stream_base_test.cc
+++ b/quic/core/http/quic_spdy_server_stream_base_test.cc
@@ -4,8 +4,8 @@
 
 #include "quic/core/http/quic_spdy_server_stream_base.h"
 
+#include "absl/memory/memory.h"
 #include "quic/core/crypto/null_encrypter.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_test.h"
 #include "quic/test_tools/quic_spdy_session_peer.h"
 #include "quic/test_tools/quic_stream_peer.h"
@@ -41,7 +41,7 @@
         new TestQuicSpdyServerStream(GetNthClientInitiatedBidirectionalStreamId(
                                          session_.transport_version(), 0),
                                      &session_, BIDIRECTIONAL);
-    session_.ActivateStream(QuicWrapUnique(stream_));
+    session_.ActivateStream(absl::WrapUnique(stream_));
     helper_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
   }
 
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index 1f27146..fcb70e8 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -11,6 +11,7 @@
 #include <utility>
 
 #include "absl/base/macros.h"
+#include "absl/memory/memory.h"
 #include "absl/strings/escaping.h"
 #include "absl/strings/str_cat.h"
 #include "absl/strings/string_view.h"
@@ -35,7 +36,6 @@
 #include "quic/platform/api/quic_expect_bug.h"
 #include "quic/platform/api/quic_flags.h"
 #include "quic/platform/api/quic_map_util.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_test.h"
 #include "quic/test_tools/qpack/qpack_encoder_peer.h"
 #include "quic/test_tools/qpack/qpack_header_table_peer.h"
@@ -258,14 +258,14 @@
   TestStream* CreateOutgoingBidirectionalStream() override {
     TestStream* stream = new TestStream(GetNextOutgoingBidirectionalStreamId(),
                                         this, BIDIRECTIONAL);
-    ActivateStream(QuicWrapUnique(stream));
+    ActivateStream(absl::WrapUnique(stream));
     return stream;
   }
 
   TestStream* CreateOutgoingUnidirectionalStream() override {
     TestStream* stream = new TestStream(GetNextOutgoingUnidirectionalStreamId(),
                                         this, WRITE_UNIDIRECTIONAL);
-    ActivateStream(QuicWrapUnique(stream));
+    ActivateStream(absl::WrapUnique(stream));
     return stream;
   }
 
@@ -283,7 +283,7 @@
           id, this,
           DetermineStreamType(id, connection()->version(), perspective(),
                               /*is_incoming=*/true, BIDIRECTIONAL));
-      ActivateStream(QuicWrapUnique(stream));
+      ActivateStream(absl::WrapUnique(stream));
       return stream;
     }
   }
@@ -294,7 +294,7 @@
         pending, this,
         DetermineStreamType(id, connection()->version(), perspective(),
                             /*is_incoming=*/true, BIDIRECTIONAL));
-    ActivateStream(QuicWrapUnique(stream));
+    ActivateStream(absl::WrapUnique(stream));
     return stream;
   }
 
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc
index 6530618..00ea0a3 100644
--- a/quic/core/http/quic_spdy_stream_test.cc
+++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -10,6 +10,7 @@
 #include <utility>
 
 #include "absl/base/macros.h"
+#include "absl/memory/memory.h"
 #include "absl/strings/escaping.h"
 #include "absl/strings/str_cat.h"
 #include "absl/strings/string_view.h"
@@ -24,7 +25,6 @@
 #include "quic/core/quic_write_blocked_list.h"
 #include "quic/platform/api/quic_expect_bug.h"
 #include "quic/platform/api/quic_map_util.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_test.h"
 #include "quic/test_tools/qpack/qpack_test_utils.h"
 #include "quic/test_tools/quic_config_peer.h"
@@ -371,11 +371,11 @@
     stream_ =
         new StrictMock<TestStream>(GetNthClientInitiatedBidirectionalId(0),
                                    session_.get(), stream_should_process_data);
-    session_->ActivateStream(QuicWrapUnique(stream_));
+    session_->ActivateStream(absl::WrapUnique(stream_));
     stream2_ =
         new StrictMock<TestStream>(GetNthClientInitiatedBidirectionalId(1),
                                    session_.get(), stream_should_process_data);
-    session_->ActivateStream(QuicWrapUnique(stream2_));
+    session_->ActivateStream(absl::WrapUnique(stream2_));
     QuicConfigPeer::SetReceivedInitialSessionFlowControlWindow(
         session_->config(), kMinimumFlowControlSendWindow);
     QuicConfigPeer::SetReceivedInitialMaxStreamDataBytesUnidirectional(
@@ -1796,7 +1796,7 @@
                                      session->transport_version(), 0),
                                  session.get(),
                                  /*should_process_data=*/true);
-  session->ActivateStream(QuicWrapUnique(stream));
+  session->ActivateStream(absl::WrapUnique(stream));
 
   // QuicSpdyStream::SetPriority() should eventually call UpdateStreamPriority()
   // on the session. Make sure stream->priority() returns the updated priority
diff --git a/quic/core/quic_coalesced_packet.cc b/quic/core/quic_coalesced_packet.cc
index 1183b1c..52673b6 100644
--- a/quic/core/quic_coalesced_packet.cc
+++ b/quic/core/quic_coalesced_packet.cc
@@ -4,9 +4,9 @@
 
 #include "quic/core/quic_coalesced_packet.h"
 
+#include "absl/memory/memory.h"
 #include "absl/strings/str_cat.h"
 #include "quic/platform/api/quic_bug_tracker.h"
-#include "quic/platform/api/quic_ptr_util.h"
 
 namespace quic {
 
@@ -74,7 +74,7 @@
   if (packet.encryption_level == ENCRYPTION_INITIAL) {
     // Save a copy of ENCRYPTION_INITIAL packet (excluding encrypted buffer, as
     // the packet will be re-serialized later).
-    initial_packet_ = QuicWrapUnique<SerializedPacket>(
+    initial_packet_ = absl::WrapUnique<SerializedPacket>(
         CopySerializedPacket(packet, allocator, /*copy_buffer=*/false));
     return true;
   }
diff --git a/quic/core/quic_dispatcher.cc b/quic/core/quic_dispatcher.cc
index 0c50d29..171246d 100644
--- a/quic/core/quic_dispatcher.cc
+++ b/quic/core/quic_dispatcher.cc
@@ -25,7 +25,6 @@
 #include "quic/platform/api/quic_flag_utils.h"
 #include "quic/platform/api/quic_flags.h"
 #include "quic/platform/api/quic_logging.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_stack_trace.h"
 #include "common/platform/api/quiche_text_utils.h"
 
diff --git a/quic/core/quic_framer_test.cc b/quic/core/quic_framer_test.cc
index 5217f87..6e04f67 100644
--- a/quic/core/quic_framer_test.cc
+++ b/quic/core/quic_framer_test.cc
@@ -13,6 +13,7 @@
 #include <vector>
 
 #include "absl/base/macros.h"
+#include "absl/memory/memory.h"
 #include "absl/strings/escaping.h"
 #include "absl/strings/match.h"
 #include "absl/strings/string_view.h"
@@ -29,7 +30,6 @@
 #include "quic/platform/api/quic_expect_bug.h"
 #include "quic/platform/api/quic_flags.h"
 #include "quic/platform/api/quic_logging.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_test.h"
 #include "quic/test_tools/quic_framer_peer.h"
 #include "quic/test_tools/quic_test_utils.h"
@@ -319,7 +319,7 @@
     // Save a copy of the data so it is valid after the packet is processed.
     std::string* string_data =
         new std::string(frame.data_buffer, frame.data_length);
-    stream_data_.push_back(QuicWrapUnique(string_data));
+    stream_data_.push_back(absl::WrapUnique(string_data));
     stream_frames_.push_back(std::make_unique<QuicStreamFrame>(
         frame.stream_id, frame.fin, frame.offset, *string_data));
     if (VersionHasIetfQuicFrames(transport_version_)) {
@@ -336,7 +336,7 @@
     // Save a copy of the data so it is valid after the packet is processed.
     std::string* string_data =
         new std::string(frame.data_buffer, frame.data_length);
-    crypto_data_.push_back(QuicWrapUnique(string_data));
+    crypto_data_.push_back(absl::WrapUnique(string_data));
     crypto_frames_.push_back(std::make_unique<QuicCryptoFrame>(
         frame.level, frame.offset, *string_data));
     if (VersionHasIetfQuicFrames(transport_version_)) {
diff --git a/quic/core/quic_packet_creator_test.cc b/quic/core/quic_packet_creator_test.cc
index 11c9800..5986bd2 100644
--- a/quic/core/quic_packet_creator_test.cc
+++ b/quic/core/quic_packet_creator_test.cc
@@ -25,7 +25,6 @@
 #include "quic/core/quic_utils.h"
 #include "quic/platform/api/quic_expect_bug.h"
 #include "quic/platform/api/quic_flags.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_socket_address.h"
 #include "quic/platform/api/quic_test.h"
 #include "quic/test_tools/quic_framer_peer.h"
diff --git a/quic/core/quic_packets_test.cc b/quic/core/quic_packets_test.cc
index 5e206f4..a07e289 100644
--- a/quic/core/quic_packets_test.cc
+++ b/quic/core/quic_packets_test.cc
@@ -4,7 +4,7 @@
 
 #include "quic/core/quic_packets.h"
 
-#include "quic/platform/api/quic_ptr_util.h"
+#include "absl/memory/memory.h"
 #include "quic/platform/api/quic_test.h"
 #include "quic/test_tools/quic_test_utils.h"
 #include "common/test_tools/quiche_test_utils.h"
@@ -86,7 +86,7 @@
   packet.nonretransmittable_frames.push_back(QuicFrame(&ack_frame));
   packet.nonretransmittable_frames.push_back(QuicFrame(QuicPaddingFrame(-1)));
 
-  std::unique_ptr<SerializedPacket> copy = QuicWrapUnique<SerializedPacket>(
+  std::unique_ptr<SerializedPacket> copy = absl::WrapUnique<SerializedPacket>(
       CopySerializedPacket(packet, &allocator, /*copy_buffer=*/true));
   EXPECT_EQ(quic::QuicPacketNumber(1), copy->packet_number);
   EXPECT_EQ(PACKET_1BYTE_PACKET_NUMBER, copy->packet_number_length);
@@ -102,7 +102,7 @@
       "encrypted_buffer", copy->encrypted_buffer, copy->encrypted_length,
       packet.encrypted_buffer, packet.encrypted_length);
 
-  std::unique_ptr<SerializedPacket> copy2 = QuicWrapUnique<SerializedPacket>(
+  std::unique_ptr<SerializedPacket> copy2 = absl::WrapUnique<SerializedPacket>(
       CopySerializedPacket(packet, &allocator, /*copy_buffer=*/false));
   EXPECT_EQ(packet.encrypted_buffer, copy2->encrypted_buffer);
   EXPECT_EQ(1000u, copy2->encrypted_length);
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index b4667b1..3531648 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -8,6 +8,7 @@
 #include <string>
 #include <utility>
 
+#include "absl/memory/memory.h"
 #include "absl/strings/str_cat.h"
 #include "absl/strings/string_view.h"
 #include "quic/core/frames/quic_ack_frequency_frame.h"
@@ -22,7 +23,6 @@
 #include "quic/platform/api/quic_flags.h"
 #include "quic/platform/api/quic_logging.h"
 #include "quic/platform/api/quic_map_util.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_server_stats.h"
 #include "quic/platform/api/quic_stack_trace.h"
 #include "common/platform/api/quiche_text_utils.h"
@@ -116,7 +116,7 @@
       was_zero_rtt_rejected_(false),
       liveness_testing_in_progress_(false) {
   closed_streams_clean_up_alarm_ =
-      QuicWrapUnique<QuicAlarm>(connection_->alarm_factory()->CreateAlarm(
+      absl::WrapUnique<QuicAlarm>(connection_->alarm_factory()->CreateAlarm(
           new ClosedStreamsCleanUpDelegate(this)));
   if (perspective() == Perspective::IS_SERVER &&
       connection_->version().handshake_protocol == PROTOCOL_TLS1_3) {
diff --git a/quic/core/quic_session_test.cc b/quic/core/quic_session_test.cc
index 5f4d097..81282fe 100644
--- a/quic/core/quic_session_test.cc
+++ b/quic/core/quic_session_test.cc
@@ -10,6 +10,7 @@
 #include <utility>
 
 #include "absl/base/macros.h"
+#include "absl/memory/memory.h"
 #include "absl/strings/str_cat.h"
 #include "absl/strings/string_view.h"
 #include "absl/types/optional.h"
@@ -28,7 +29,6 @@
 #include "quic/platform/api/quic_flags.h"
 #include "quic/platform/api/quic_map_util.h"
 #include "quic/platform/api/quic_mem_slice_storage.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_test.h"
 #include "quic/platform/api/quic_test_mem_slice_vector.h"
 #include "quic/test_tools/mock_quic_session_visitor.h"
@@ -246,14 +246,14 @@
       return nullptr;
     }
     TestStream* stream = new TestStream(id, this, BIDIRECTIONAL);
-    ActivateStream(QuicWrapUnique(stream));
+    ActivateStream(absl::WrapUnique(stream));
     return stream;
   }
 
   TestStream* CreateOutgoingUnidirectionalStream() {
     TestStream* stream = new TestStream(GetNextOutgoingUnidirectionalStreamId(),
                                         this, WRITE_UNIDIRECTIONAL);
-    ActivateStream(QuicWrapUnique(stream));
+    ActivateStream(absl::WrapUnique(stream));
     return stream;
   }
 
@@ -274,7 +274,7 @@
         id, this,
         DetermineStreamType(id, connection()->version(), perspective(),
                             /*is_incoming=*/true, BIDIRECTIONAL));
-    ActivateStream(QuicWrapUnique(stream));
+    ActivateStream(absl::WrapUnique(stream));
     ++num_incoming_streams_created_;
     return stream;
   }
@@ -285,7 +285,7 @@
         pending, this,
         DetermineStreamType(id, connection()->version(), perspective(),
                             /*is_incoming=*/true, BIDIRECTIONAL));
-    ActivateStream(QuicWrapUnique(stream));
+    ActivateStream(absl::WrapUnique(stream));
     ++num_incoming_streams_created_;
     return stream;
   }
@@ -2551,7 +2551,7 @@
   session_.set_writev_consumes_all_data(true);
   TestStream* stream4 = new TestStream(GetNthServerInitiatedUnidirectionalId(1),
                                        &session_, WRITE_UNIDIRECTIONAL);
-  session_.ActivateStream(QuicWrapUnique(stream4));
+  session_.ActivateStream(absl::WrapUnique(stream4));
   std::string body(100, '.');
   stream4->WriteOrBufferData(body, false, nullptr);
   stream4->WriteOrBufferData(body, true, nullptr);
@@ -2564,7 +2564,7 @@
 TEST_P(QuicSessionTestServer, ReceivedDataOnWriteUnidirectionalStream) {
   TestStream* stream4 = new TestStream(GetNthServerInitiatedUnidirectionalId(1),
                                        &session_, WRITE_UNIDIRECTIONAL);
-  session_.ActivateStream(QuicWrapUnique(stream4));
+  session_.ActivateStream(absl::WrapUnique(stream4));
 
   EXPECT_CALL(
       *connection_,
@@ -2578,7 +2578,7 @@
 TEST_P(QuicSessionTestServer, ReadUnidirectionalStream) {
   TestStream* stream4 = new TestStream(GetNthClientInitiatedUnidirectionalId(1),
                                        &session_, READ_UNIDIRECTIONAL);
-  session_.ActivateStream(QuicWrapUnique(stream4));
+  session_.ActivateStream(absl::WrapUnique(stream4));
   EXPECT_FALSE(stream4->IsWaitingForAcks());
   // Discard all incoming data.
   stream4->StopReading();
@@ -2598,7 +2598,7 @@
 TEST_P(QuicSessionTestServer, WriteOrBufferDataOnReadUnidirectionalStream) {
   TestStream* stream4 = new TestStream(GetNthClientInitiatedUnidirectionalId(1),
                                        &session_, READ_UNIDIRECTIONAL);
-  session_.ActivateStream(QuicWrapUnique(stream4));
+  session_.ActivateStream(absl::WrapUnique(stream4));
 
   EXPECT_CALL(*connection_,
               CloseConnection(
@@ -2611,7 +2611,7 @@
 TEST_P(QuicSessionTestServer, WritevDataOnReadUnidirectionalStream) {
   TestStream* stream4 = new TestStream(GetNthClientInitiatedUnidirectionalId(1),
                                        &session_, READ_UNIDIRECTIONAL);
-  session_.ActivateStream(QuicWrapUnique(stream4));
+  session_.ActivateStream(absl::WrapUnique(stream4));
 
   EXPECT_CALL(*connection_,
               CloseConnection(
@@ -2628,7 +2628,7 @@
 TEST_P(QuicSessionTestServer, WriteMemSlicesOnReadUnidirectionalStream) {
   TestStream* stream4 = new TestStream(GetNthClientInitiatedUnidirectionalId(1),
                                        &session_, READ_UNIDIRECTIONAL);
-  session_.ActivateStream(QuicWrapUnique(stream4));
+  session_.ActivateStream(absl::WrapUnique(stream4));
 
   EXPECT_CALL(*connection_,
               CloseConnection(
diff --git a/quic/core/quic_stream_test.cc b/quic/core/quic_stream_test.cc
index 46c4b4a..739113a 100644
--- a/quic/core/quic_stream_test.cc
+++ b/quic/core/quic_stream_test.cc
@@ -9,6 +9,7 @@
 #include <utility>
 
 #include "absl/base/macros.h"
+#include "absl/memory/memory.h"
 #include "absl/strings/string_view.h"
 #include "absl/types/optional.h"
 #include "quic/core/crypto/null_encrypter.h"
@@ -24,7 +25,6 @@
 #include "quic/platform/api/quic_flags.h"
 #include "quic/platform/api/quic_logging.h"
 #include "quic/platform/api/quic_mem_slice_storage.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_test.h"
 #include "quic/platform/api/quic_test_mem_slice_vector.h"
 #include "quic/test_tools/quic_config_peer.h"
@@ -114,7 +114,7 @@
                                          BIDIRECTIONAL);
     EXPECT_NE(nullptr, stream_);
     // session_ now owns stream_.
-    session_->ActivateStream(QuicWrapUnique(stream_));
+    session_->ActivateStream(absl::WrapUnique(stream_));
     // Ignore resetting when session_ is terminated.
     EXPECT_CALL(*session_, MaybeSendStopSendingFrame(kTestStreamId, _))
         .Times(AnyNumber());
@@ -264,7 +264,7 @@
 
   auto stream = new TestStream(&pending, session_.get(),
                                StreamType::READ_UNIDIRECTIONAL, false);
-  session_->ActivateStream(QuicWrapUnique(stream));
+  session_->ActivateStream(absl::WrapUnique(stream));
 
   QuicStreamFrame frame2(kTestStreamId + 2, true, 3, ".");
   stream->OnStreamFrame(frame2);
@@ -1437,7 +1437,7 @@
   auto stream = new TestStream(GetNthClientInitiatedBidirectionalStreamId(
                                    GetParam().transport_version, 2),
                                session_.get(), BIDIRECTIONAL);
-  session_->ActivateStream(QuicWrapUnique(stream));
+  session_->ActivateStream(absl::WrapUnique(stream));
 
   EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
       .WillRepeatedly(Invoke(session_.get(), &MockQuicSession::ConsumeData));
@@ -1470,7 +1470,7 @@
   auto stream = new TestStream(GetNthClientInitiatedBidirectionalStreamId(
                                    GetParam().transport_version, 2),
                                session_.get(), BIDIRECTIONAL);
-  session_->ActivateStream(QuicWrapUnique(stream));
+  session_->ActivateStream(absl::WrapUnique(stream));
 
   std::string data(100, '.');
   EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
diff --git a/quic/masque/masque_epoll_client.cc b/quic/masque/masque_epoll_client.cc
index bf09da4..5ad91cf 100644
--- a/quic/masque/masque_epoll_client.cc
+++ b/quic/masque/masque_epoll_client.cc
@@ -3,9 +3,9 @@
 // found in the LICENSE file.
 
 #include "quic/masque/masque_epoll_client.h"
+#include "absl/memory/memory.h"
 #include "quic/masque/masque_client_session.h"
 #include "quic/masque/masque_utils.h"
-#include "quic/platform/api/quic_ptr_util.h"
 
 namespace quic {
 
@@ -56,10 +56,10 @@
     return nullptr;
   }
   QuicServerId server_id(host, port);
-  // Use QuicWrapUnique(new MasqueEpollClient(...)) instead of
+  // Use absl::WrapUnique(new MasqueEpollClient(...)) instead of
   // std::make_unique<MasqueEpollClient>(...) because the constructor for
   // MasqueEpollClient is private and therefore not accessible from make_unique.
-  auto masque_client = QuicWrapUnique(new MasqueEpollClient(
+  auto masque_client = absl::WrapUnique(new MasqueEpollClient(
       addr, server_id, masque_mode, epoll_server, std::move(proof_verifier),
       absl::StrCat(host, ":", port)));
 
diff --git a/quic/platform/api/quic_ptr_util.h b/quic/platform/api/quic_ptr_util.h
deleted file mode 100644
index 71045e1..0000000
--- a/quic/platform/api/quic_ptr_util.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef QUICHE_QUIC_PLATFORM_API_QUIC_PTR_UTIL_H_
-#define QUICHE_QUIC_PLATFORM_API_QUIC_PTR_UTIL_H_
-
-#include <memory>
-#include <utility>
-
-#include "net/quic/platform/impl/quic_ptr_util_impl.h"
-
-namespace quic {
-
-template <typename T>
-std::unique_ptr<T> QuicWrapUnique(T* ptr) {
-  return QuicWrapUniqueImpl<T>(ptr);
-}
-
-}  // namespace quic
-
-#endif  // QUICHE_QUIC_PLATFORM_API_QUIC_PTR_UTIL_H_
diff --git a/quic/quic_transport/quic_transport_stream_test.cc b/quic/quic_transport/quic_transport_stream_test.cc
index 364780c..1d2afdb 100644
--- a/quic/quic_transport/quic_transport_stream_test.cc
+++ b/quic/quic_transport/quic_transport_stream_test.cc
@@ -6,11 +6,11 @@
 
 #include <memory>
 
+#include "absl/memory/memory.h"
 #include "absl/strings/string_view.h"
 #include "quic/core/crypto/null_encrypter.h"
 #include "quic/core/frames/quic_window_update_frame.h"
 #include "quic/platform/api/quic_expect_bug.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_test.h"
 #include "quic/quic_transport/quic_transport_session_interface.h"
 #include "quic/test_tools/quic_config_peer.h"
@@ -47,7 +47,7 @@
         ENCRYPTION_FORWARD_SECURE,
         std::make_unique<NullEncrypter>(connection_->perspective()));
     stream_ = new QuicTransportStream(0, &session_, &interface_);
-    session_.ActivateStream(QuicWrapUnique(stream_));
+    session_.ActivateStream(absl::WrapUnique(stream_));
 
     auto visitor = std::make_unique<MockStreamVisitor>();
     visitor_ = visitor.get();
diff --git a/quic/test_tools/quic_test_client.cc b/quic/test_tools/quic_test_client.cc
index f0d6a0d..ed823b1 100644
--- a/quic/test_tools/quic_test_client.cc
+++ b/quic/test_tools/quic_test_client.cc
@@ -20,7 +20,6 @@
 #include "quic/core/quic_utils.h"
 #include "quic/platform/api/quic_flags.h"
 #include "quic/platform/api/quic_logging.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_stack_trace.h"
 #include "quic/test_tools/crypto_test_utils.h"
 #include "quic/test_tools/quic_client_peer.h"
@@ -236,7 +235,7 @@
           epoll_server,
           std::make_unique<MockableQuicClientEpollNetworkHelper>(epoll_server,
                                                                  this),
-          QuicWrapUnique(new RecordingProofVerifier(std::move(proof_verifier))),
+          std::make_unique<RecordingProofVerifier>(std::move(proof_verifier)),
           std::move(session_cache)),
       override_server_connection_id_(EmptyQuicConnectionId()),
       server_connection_id_overridden_(false),
diff --git a/quic/test_tools/quic_test_server.cc b/quic/test_tools/quic_test_server.cc
index 55170b2..5f4738b 100644
--- a/quic/test_tools/quic_test_server.cc
+++ b/quic/test_tools/quic_test_server.cc
@@ -6,10 +6,10 @@
 
 #include <utility>
 
+#include "absl/memory/memory.h"
 #include "absl/strings/string_view.h"
 #include "quic/core/quic_epoll_alarm_factory.h"
 #include "quic/core/quic_epoll_connection_helper.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/tools/quic_simple_crypto_server_stream_helper.h"
 #include "quic/tools/quic_simple_dispatcher.h"
 #include "quic/tools/quic_simple_server_session.h"
@@ -49,7 +49,7 @@
     if (stream_factory_) {
       QuicSpdyStream* stream =
           stream_factory_->CreateStream(id, this, server_backend());
-      ActivateStream(QuicWrapUnique(stream));
+      ActivateStream(absl::WrapUnique(stream));
       return stream;
     }
     return QuicSimpleServerSession::CreateIncomingStream(id);
diff --git a/quic/test_tools/simple_quic_framer.cc b/quic/test_tools/simple_quic_framer.cc
index 96b1318..35d7edc 100644
--- a/quic/test_tools/simple_quic_framer.cc
+++ b/quic/test_tools/simple_quic_framer.cc
@@ -7,10 +7,10 @@
 #include <memory>
 #include <utility>
 
+#include "absl/memory/memory.h"
 #include "absl/strings/string_view.h"
 #include "quic/core/crypto/quic_decrypter.h"
 #include "quic/core/crypto/quic_encrypter.h"
-#include "quic/platform/api/quic_ptr_util.h"
 
 namespace quic {
 namespace test {
@@ -73,7 +73,7 @@
     // Save a copy of the data so it is valid after the packet is processed.
     std::string* string_data =
         new std::string(frame.data_buffer, frame.data_length);
-    stream_data_.push_back(QuicWrapUnique(string_data));
+    stream_data_.push_back(absl::WrapUnique(string_data));
     // TODO(ianswett): A pointer isn't necessary with emplace_back.
     stream_frames_.push_back(std::make_unique<QuicStreamFrame>(
         frame.stream_id, frame.fin, frame.offset,
@@ -85,7 +85,7 @@
     // Save a copy of the data so it is valid after the packet is processed.
     std::string* string_data =
         new std::string(frame.data_buffer, frame.data_length);
-    crypto_data_.push_back(QuicWrapUnique(string_data));
+    crypto_data_.push_back(absl::WrapUnique(string_data));
     crypto_frames_.push_back(std::make_unique<QuicCryptoFrame>(
         frame.level, frame.offset, absl::string_view(*string_data)));
     return true;
diff --git a/quic/tools/quic_client.cc b/quic/tools/quic_client.cc
index 448291b..e659b4a 100644
--- a/quic/tools/quic_client.cc
+++ b/quic/tools/quic_client.cc
@@ -24,7 +24,6 @@
 #include "quic/core/quic_server_id.h"
 #include "quic/platform/api/quic_bug_tracker.h"
 #include "quic/platform/api/quic_logging.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_socket_address.h"
 #include "quic/tools/quic_simple_client_session.h"
 
@@ -67,7 +66,7 @@
           supported_versions,
           QuicConfig(),
           epoll_server,
-          QuicWrapUnique(new QuicClientEpollNetworkHelper(epoll_server, this)),
+          std::make_unique<QuicClientEpollNetworkHelper>(epoll_server, this),
           std::move(proof_verifier),
           nullptr) {}
 
@@ -83,7 +82,7 @@
           supported_versions,
           QuicConfig(),
           epoll_server,
-          QuicWrapUnique(new QuicClientEpollNetworkHelper(epoll_server, this)),
+          std::make_unique<QuicClientEpollNetworkHelper>(epoll_server, this),
           std::move(proof_verifier),
           std::move(session_cache)) {}
 
@@ -100,7 +99,7 @@
           supported_versions,
           config,
           epoll_server,
-          QuicWrapUnique(new QuicClientEpollNetworkHelper(epoll_server, this)),
+          std::make_unique<QuicClientEpollNetworkHelper>(epoll_server, this),
           std::move(proof_verifier),
           std::move(session_cache)) {}
 
diff --git a/quic/tools/quic_simple_server_session.cc b/quic/tools/quic_simple_server_session.cc
index 044998c..7176b6f 100644
--- a/quic/tools/quic_simple_server_session.cc
+++ b/quic/tools/quic_simple_server_session.cc
@@ -6,12 +6,12 @@
 
 #include <utility>
 
+#include "absl/memory/memory.h"
 #include "quic/core/http/quic_spdy_session.h"
 #include "quic/core/quic_connection.h"
 #include "quic/core/quic_utils.h"
 #include "quic/platform/api/quic_flags.h"
 #include "quic/platform/api/quic_logging.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/tools/quic_simple_server_stream.h"
 
 namespace quic {
@@ -101,7 +101,7 @@
 
   QuicSpdyStream* stream = new QuicSimpleServerStream(
       id, this, BIDIRECTIONAL, quic_simple_server_backend_);
-  ActivateStream(QuicWrapUnique(stream));
+  ActivateStream(absl::WrapUnique(stream));
   return stream;
 }
 
@@ -109,7 +109,7 @@
     PendingStream* pending) {
   QuicSpdyStream* stream = new QuicSimpleServerStream(
       pending, this, BIDIRECTIONAL, quic_simple_server_backend_);
-  ActivateStream(QuicWrapUnique(stream));
+  ActivateStream(absl::WrapUnique(stream));
   return stream;
 }
 
@@ -128,7 +128,7 @@
   QuicSimpleServerStream* stream = new QuicSimpleServerStream(
       GetNextOutgoingUnidirectionalStreamId(), this, WRITE_UNIDIRECTIONAL,
       quic_simple_server_backend_);
-  ActivateStream(QuicWrapUnique(stream));
+  ActivateStream(absl::WrapUnique(stream));
   return stream;
 }
 
diff --git a/quic/tools/quic_simple_server_stream_test.cc b/quic/tools/quic_simple_server_stream_test.cc
index dd3b8cd..bf80d47 100644
--- a/quic/tools/quic_simple_server_stream_test.cc
+++ b/quic/tools/quic_simple_server_stream_test.cc
@@ -9,6 +9,7 @@
 #include <utility>
 
 #include "absl/base/macros.h"
+#include "absl/memory/memory.h"
 #include "absl/strings/string_view.h"
 #include "absl/types/optional.h"
 #include "quic/core/crypto/null_encrypter.h"
@@ -18,7 +19,6 @@
 #include "quic/core/quic_types.h"
 #include "quic/core/quic_utils.h"
 #include "quic/platform/api/quic_expect_bug.h"
-#include "quic/platform/api/quic_ptr_util.h"
 #include "quic/platform/api/quic_socket_address.h"
 #include "quic/platform/api/quic_test.h"
 #include "quic/test_tools/crypto_test_utils.h"
@@ -280,7 +280,7 @@
             connection_->transport_version(), 0),
         &session_, BIDIRECTIONAL, &memory_cache_backend_);
     // Register stream_ in dynamic_stream_map_ and pass ownership to session_.
-    session_.ActivateStream(QuicWrapUnique(stream_));
+    session_.ActivateStream(absl::WrapUnique(stream_));
     QuicConfigPeer::SetReceivedInitialSessionFlowControlWindow(
         session_.config(), kMinimumFlowControlSendWindow);
     QuicConfigPeer::SetReceivedInitialMaxStreamDataBytesUnidirectional(
@@ -488,7 +488,7 @@
       GetNthServerInitiatedUnidirectionalStreamId(
           connection_->transport_version(), 3),
       &session_, WRITE_UNIDIRECTIONAL, &memory_cache_backend_);
-  session_.ActivateStream(QuicWrapUnique(promised_stream));
+  session_.ActivateStream(absl::WrapUnique(promised_stream));
 
   // Send a push response with response status 404, which will be regarded as
   // invalid server push response.
@@ -655,7 +655,7 @@
   auto server_initiated_stream =
       new StrictMock<TestStream>(kServerInitiatedStreamId, &session_,
                                  WRITE_UNIDIRECTIONAL, &memory_cache_backend_);
-  session_.ActivateStream(QuicWrapUnique(server_initiated_stream));
+  session_.ActivateStream(absl::WrapUnique(server_initiated_stream));
 
   const std::string kHost = "www.foo.com";
   const std::string kPath = "/bar";