Switch QuicMakeUnique to std::make_unique, part 1: //third_party/quic

gfe-relnote: n/a (no functional change)
PiperOrigin-RevId: 267662077
Change-Id: Ic63023042eafb77aa80d88749845f841b3078c57
diff --git a/quic/test_tools/crypto_test_utils.cc b/quic/test_tools/crypto_test_utils.cc
index e2a8b8b..ce0cb6e 100644
--- a/quic/test_tools/crypto_test_utils.cc
+++ b/quic/test_tools/crypto_test_utils.cc
@@ -130,7 +130,7 @@
 
   std::unique_ptr<ValidateClientHelloCallback>
   GetValidateClientHelloCallback() {
-    return QuicMakeUnique<ValidateClientHelloCallback>(this);
+    return std::make_unique<ValidateClientHelloCallback>(this);
   }
 
  private:
@@ -164,7 +164,7 @@
   };
 
   std::unique_ptr<ProcessClientHelloCallback> GetProcessClientHelloCallback() {
-    return QuicMakeUnique<ProcessClientHelloCallback>(this);
+    return std::make_unique<ProcessClientHelloCallback>(this);
   }
 
   void ProcessClientHelloDone(std::unique_ptr<CryptoHandshakeMessage> rej) {
diff --git a/quic/test_tools/crypto_test_utils_test.cc b/quic/test_tools/crypto_test_utils_test.cc
index 62eafb9..3c9f18f 100644
--- a/quic/test_tools/crypto_test_utils_test.cc
+++ b/quic/test_tools/crypto_test_utils_test.cc
@@ -47,7 +47,7 @@
 
   std::unique_ptr<ValidateClientHelloCallback>
   GetValidateClientHelloCallback() {
-    return QuicMakeUnique<ValidateClientHelloCallback>(this);
+    return std::make_unique<ValidateClientHelloCallback>(this);
   }
 
  private:
@@ -82,7 +82,7 @@
   };
 
   std::unique_ptr<ProcessClientHelloCallback> GetProcessClientHelloCallback() {
-    return QuicMakeUnique<ProcessClientHelloCallback>(this);
+    return std::make_unique<ProcessClientHelloCallback>(this);
   }
 
   void ProcessClientHelloDone(std::unique_ptr<CryptoHandshakeMessage> message) {
diff --git a/quic/test_tools/fake_proof_source.cc b/quic/test_tools/fake_proof_source.cc
index 8f1cd37..c47208f 100644
--- a/quic/test_tools/fake_proof_source.cc
+++ b/quic/test_tools/fake_proof_source.cc
@@ -80,7 +80,7 @@
     return;
   }
 
-  pending_ops_.push_back(QuicMakeUnique<GetProofOp>(
+  pending_ops_.push_back(std::make_unique<GetProofOp>(
       server_address, hostname, server_config, transport_version,
       std::string(chlo_hash), std::move(callback), delegate_.get()));
 }
@@ -106,7 +106,7 @@
   }
 
   QUIC_LOG(INFO) << "Adding pending op";
-  pending_ops_.push_back(QuicMakeUnique<ComputeSignatureOp>(
+  pending_ops_.push_back(std::make_unique<ComputeSignatureOp>(
       server_address, hostname, signature_algorithm, in, std::move(callback),
       delegate_.get()));
 }
diff --git a/quic/test_tools/quic_test_client.cc b/quic/test_tools/quic_test_client.cc
index 9d4cb03..3531318 100644
--- a/quic/test_tools/quic_test_client.cc
+++ b/quic/test_tools/quic_test_client.cc
@@ -205,8 +205,8 @@
           supported_versions,
           config,
           epoll_server,
-          QuicMakeUnique<MockableQuicClientEpollNetworkHelper>(epoll_server,
-                                                               this),
+          std::make_unique<MockableQuicClientEpollNetworkHelper>(epoll_server,
+                                                                 this),
           QuicWrapUnique(
               new RecordingProofVerifier(std::move(proof_verifier)))),
       override_server_connection_id_(EmptyQuicConnectionId()),
@@ -406,7 +406,7 @@
       // May need to retry request if asynchronous rendezvous fails.
       std::unique_ptr<spdy::SpdyHeaderBlock> new_headers(
           new spdy::SpdyHeaderBlock(headers->Clone()));
-      push_promise_data_to_resend_ = QuicMakeUnique<TestClientDataToResend>(
+      push_promise_data_to_resend_ = std::make_unique<TestClientDataToResend>(
           std::move(new_headers), body, fin, this, std::move(ack_listener));
       return 1;
     }
diff --git a/quic/test_tools/quic_test_server.cc b/quic/test_tools/quic_test_server.cc
index 19b986e..9eee97a 100644
--- a/quic/test_tools/quic_test_server.cc
+++ b/quic/test_tools/quic_test_server.cc
@@ -181,11 +181,11 @@
 QuicDispatcher* QuicTestServer::CreateQuicDispatcher() {
   return new QuicTestDispatcher(
       &config(), &crypto_config(), version_manager(),
-      QuicMakeUnique<QuicEpollConnectionHelper>(epoll_server(),
-                                                QuicAllocator::BUFFER_POOL),
+      std::make_unique<QuicEpollConnectionHelper>(epoll_server(),
+                                                  QuicAllocator::BUFFER_POOL),
       std::unique_ptr<QuicCryptoServerStream::Helper>(
           new QuicSimpleCryptoServerStreamHelper()),
-      QuicMakeUnique<QuicEpollAlarmFactory>(epoll_server()), server_backend(),
+      std::make_unique<QuicEpollAlarmFactory>(epoll_server()), server_backend(),
       expected_server_connection_id_length());
 }
 
diff --git a/quic/test_tools/quic_test_utils.cc b/quic/test_tools/quic_test_utils.cc
index 5ff5e05..9afbf98 100644
--- a/quic/test_tools/quic_test_utils.cc
+++ b/quic/test_tools/quic_test_utils.cc
@@ -137,7 +137,7 @@
                                           ENCRYPTION_INITIAL);
   DCHECK_NE(0u, length);
   // Re-construct the data packet with data ownership.
-  return QuicMakeUnique<QuicPacket>(
+  return std::make_unique<QuicPacket>(
       buffer, length, /* owns_buffer */ true,
       GetIncludedDestinationConnectionIdLength(header),
       GetIncludedSourceConnectionIdLength(header), header.version_flag,
@@ -511,7 +511,7 @@
 PacketSavingConnection::~PacketSavingConnection() {}
 
 void PacketSavingConnection::SendOrQueuePacket(SerializedPacket* packet) {
-  encrypted_packets_.push_back(QuicMakeUnique<QuicEncryptedPacket>(
+  encrypted_packets_.push_back(std::make_unique<QuicEncryptedPacket>(
       CopyBuffer(*packet), packet->encrypted_length, true));
   clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(10));
   // Transfer ownership of the packet to the SentPacketManager and the
@@ -532,7 +532,7 @@
                   connection->supported_versions(),
                   /*num_expected_unidirectional_static_streams = */ 0) {
   if (create_mock_crypto_stream) {
-    crypto_stream_ = QuicMakeUnique<MockQuicCryptoStream>(this);
+    crypto_stream_ = std::make_unique<MockQuicCryptoStream>(this);
   }
   ON_CALL(*this, WritevData(_, _, _, _, _))
       .WillByDefault(testing::Return(QuicConsumedData(0, false)));
@@ -561,7 +561,7 @@
                                               QuicStreamOffset offset,
                                               StreamSendingState state) {
   if (write_length > 0) {
-    auto buf = QuicMakeUnique<char[]>(write_length);
+    auto buf = std::make_unique<char[]>(write_length);
     QuicDataWriter writer(write_length, buf.get(), HOST_BYTE_ORDER);
     stream->WriteStreamData(offset, write_length, &writer);
   } else {
@@ -602,7 +602,7 @@
                       DefaultQuicConfig(),
                       connection->supported_versions()) {
   if (create_mock_crypto_stream) {
-    crypto_stream_ = QuicMakeUnique<MockQuicCryptoStream>(this);
+    crypto_stream_ = std::make_unique<MockQuicCryptoStream>(this);
   }
 
   ON_CALL(*this, WritevData(_, _, _, _, _))
@@ -681,7 +681,7 @@
                                 &push_promise_index_,
                                 config,
                                 supported_versions) {
-  crypto_stream_ = QuicMakeUnique<QuicCryptoClientStream>(
+  crypto_stream_ = std::make_unique<QuicCryptoClientStream>(
       server_id, this, crypto_test_utils::ProofVerifyContextForTesting(),
       crypto_config, this);
   Initialize();
diff --git a/quic/test_tools/simple_data_producer.cc b/quic/test_tools/simple_data_producer.cc
index 89bf5b9..e9dab7b 100644
--- a/quic/test_tools/simple_data_producer.cc
+++ b/quic/test_tools/simple_data_producer.cc
@@ -27,7 +27,7 @@
     return;
   }
   if (!QuicContainsKey(send_buffer_map_, id)) {
-    send_buffer_map_[id] = QuicMakeUnique<QuicStreamSendBuffer>(&allocator_);
+    send_buffer_map_[id] = std::make_unique<QuicStreamSendBuffer>(&allocator_);
   }
   send_buffer_map_[id]->SaveStreamData(iov, iov_count, iov_offset, data_length);
 }
diff --git a/quic/test_tools/simple_quic_framer.cc b/quic/test_tools/simple_quic_framer.cc
index ad7e7bb..68e4878 100644
--- a/quic/test_tools/simple_quic_framer.cc
+++ b/quic/test_tools/simple_quic_framer.cc
@@ -30,12 +30,12 @@
 
   void OnPacket() override {}
   void OnPublicResetPacket(const QuicPublicResetPacket& packet) override {
-    public_reset_packet_ = QuicMakeUnique<QuicPublicResetPacket>((packet));
+    public_reset_packet_ = std::make_unique<QuicPublicResetPacket>((packet));
   }
   void OnVersionNegotiationPacket(
       const QuicVersionNegotiationPacket& packet) override {
     version_negotiation_packet_ =
-        QuicMakeUnique<QuicVersionNegotiationPacket>((packet));
+        std::make_unique<QuicVersionNegotiationPacket>((packet));
   }
 
   void OnRetryPacket(QuicConnectionId /*original_connection_id*/,
@@ -70,7 +70,7 @@
         new std::string(frame.data_buffer, frame.data_length);
     stream_data_.push_back(QuicWrapUnique(string_data));
     // TODO(ianswett): A pointer isn't necessary with emplace_back.
-    stream_frames_.push_back(QuicMakeUnique<QuicStreamFrame>(
+    stream_frames_.push_back(std::make_unique<QuicStreamFrame>(
         frame.stream_id, frame.fin, frame.offset,
         QuicStringPiece(*string_data)));
     return true;
@@ -81,7 +81,7 @@
     std::string* string_data =
         new std::string(frame.data_buffer, frame.data_length);
     crypto_data_.push_back(QuicWrapUnique(string_data));
-    crypto_frames_.push_back(QuicMakeUnique<QuicCryptoFrame>(
+    crypto_frames_.push_back(std::make_unique<QuicCryptoFrame>(
         frame.level, frame.offset, QuicStringPiece(*string_data)));
     return true;
   }
@@ -202,7 +202,7 @@
   void OnAuthenticatedIetfStatelessResetPacket(
       const QuicIetfStatelessResetPacket& packet) override {
     stateless_reset_packet_ =
-        QuicMakeUnique<QuicIetfStatelessResetPacket>(packet);
+        std::make_unique<QuicIetfStatelessResetPacket>(packet);
   }
 
   const QuicPacketHeader& header() const { return header_; }
@@ -309,13 +309,13 @@
 SimpleQuicFramer::~SimpleQuicFramer() {}
 
 bool SimpleQuicFramer::ProcessPacket(const QuicEncryptedPacket& packet) {
-  visitor_ = QuicMakeUnique<SimpleFramerVisitor>();
+  visitor_ = std::make_unique<SimpleFramerVisitor>();
   framer_.set_visitor(visitor_.get());
   return framer_.ProcessPacket(packet);
 }
 
 void SimpleQuicFramer::Reset() {
-  visitor_ = QuicMakeUnique<SimpleFramerVisitor>();
+  visitor_ = std::make_unique<SimpleFramerVisitor>();
 }
 
 const QuicPacketHeader& SimpleQuicFramer::header() const {
diff --git a/quic/test_tools/simple_session_notifier_test.cc b/quic/test_tools/simple_session_notifier_test.cc
index 63da639..eea1608 100644
--- a/quic/test_tools/simple_session_notifier_test.cc
+++ b/quic/test_tools/simple_session_notifier_test.cc
@@ -258,7 +258,7 @@
   notifier_.WriteCryptoData(ENCRYPTION_INITIAL, 1024, 0);
   // Send crypto data [1024, 2048) in ENCRYPTION_ZERO_RTT.
   connection_.SetDefaultEncryptionLevel(ENCRYPTION_ZERO_RTT);
-  connection_.SetEncrypter(ENCRYPTION_ZERO_RTT, QuicMakeUnique<NullEncrypter>(
+  connection_.SetEncrypter(ENCRYPTION_ZERO_RTT, std::make_unique<NullEncrypter>(
                                                     Perspective::IS_CLIENT));
   EXPECT_CALL(connection_, SendCryptoData(ENCRYPTION_ZERO_RTT, 1024, 0))
       .WillOnce(Invoke(&connection_,
diff --git a/quic/test_tools/simulator/quic_endpoint.cc b/quic/test_tools/simulator/quic_endpoint.cc
index 28df15f..3048534 100644
--- a/quic/test_tools/simulator/quic_endpoint.cc
+++ b/quic/test_tools/simulator/quic_endpoint.cc
@@ -85,14 +85,14 @@
   connection_.SetSelfAddress(GetAddressFromName(name));
   connection_.set_visitor(this);
   connection_.SetEncrypter(ENCRYPTION_FORWARD_SECURE,
-                           QuicMakeUnique<NullEncrypter>(perspective));
+                           std::make_unique<NullEncrypter>(perspective));
   if (connection_.version().KnowsWhichDecrypterToUse()) {
     connection_.InstallDecrypter(ENCRYPTION_FORWARD_SECURE,
-                                 QuicMakeUnique<NullDecrypter>(perspective));
+                                 std::make_unique<NullDecrypter>(perspective));
     connection_.RemoveDecrypter(ENCRYPTION_INITIAL);
   } else {
     connection_.SetDecrypter(ENCRYPTION_FORWARD_SECURE,
-                             QuicMakeUnique<NullDecrypter>(perspective));
+                             std::make_unique<NullDecrypter>(perspective));
   }
   connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
   if (perspective == Perspective::IS_SERVER) {
@@ -102,7 +102,7 @@
   connection_.SetDataProducer(&producer_);
   connection_.SetSessionNotifier(this);
   if (connection_.session_decides_what_to_write()) {
-    notifier_ = QuicMakeUnique<test::SimpleSessionNotifier>(&connection_);
+    notifier_ = std::make_unique<test::SimpleSessionNotifier>(&connection_);
   }
 
   // Configure the connection as if it received a handshake.  This is important
@@ -179,7 +179,7 @@
 }
 
 void QuicEndpoint::RecordTrace() {
-  trace_visitor_ = QuicMakeUnique<QuicTraceVisitor>(&connection_);
+  trace_visitor_ = std::make_unique<QuicTraceVisitor>(&connection_);
   connection_.set_debug_visitor(trace_visitor_.get());
 }
 
@@ -323,7 +323,7 @@
     return WriteResult(WRITE_STATUS_BLOCKED, 0);
   }
 
-  auto packet = QuicMakeUnique<Packet>();
+  auto packet = std::make_unique<Packet>();
   packet->source = endpoint_->name();
   packet->destination = endpoint_->peer_name_;
   packet->tx_timestamp = endpoint_->clock_->Now();
diff --git a/quic/test_tools/simulator/quic_endpoint_test.cc b/quic/test_tools/simulator/quic_endpoint_test.cc
index 74b48ba..11a00fa 100644
--- a/quic/test_tools/simulator/quic_endpoint_test.cc
+++ b/quic/test_tools/simulator/quic_endpoint_test.cc
@@ -37,14 +37,14 @@
   Switch switch_;
 
   std::unique_ptr<SymmetricLink> Link(Endpoint* a, Endpoint* b) {
-    return QuicMakeUnique<SymmetricLink>(a, b, kDefaultBandwidth,
-                                         kDefaultPropagationDelay);
+    return std::make_unique<SymmetricLink>(a, b, kDefaultBandwidth,
+                                           kDefaultPropagationDelay);
   }
 
   std::unique_ptr<SymmetricLink> CustomLink(Endpoint* a,
                                             Endpoint* b,
                                             uint64_t extra_rtt_ms) {
-    return QuicMakeUnique<SymmetricLink>(
+    return std::make_unique<SymmetricLink>(
         a, b, kDefaultBandwidth,
         kDefaultPropagationDelay +
             QuicTime::Delta::FromMilliseconds(extra_rtt_ms));
@@ -156,22 +156,22 @@
 TEST_F(QuicEndpointTest, Competition) {
   // TODO(63765788): Turn back on this flag when the issue if fixed.
   SetQuicReloadableFlag(quic_bbr_one_mss_conservation, false);
-  auto endpoint_a = QuicMakeUnique<QuicEndpoint>(
+  auto endpoint_a = std::make_unique<QuicEndpoint>(
       &simulator_, "Endpoint A", "Endpoint D (A)", Perspective::IS_CLIENT,
       test::TestConnectionId(42));
-  auto endpoint_b = QuicMakeUnique<QuicEndpoint>(
+  auto endpoint_b = std::make_unique<QuicEndpoint>(
       &simulator_, "Endpoint B", "Endpoint D (B)", Perspective::IS_CLIENT,
       test::TestConnectionId(43));
-  auto endpoint_c = QuicMakeUnique<QuicEndpoint>(
+  auto endpoint_c = std::make_unique<QuicEndpoint>(
       &simulator_, "Endpoint C", "Endpoint D (C)", Perspective::IS_CLIENT,
       test::TestConnectionId(44));
-  auto endpoint_d_a = QuicMakeUnique<QuicEndpoint>(
+  auto endpoint_d_a = std::make_unique<QuicEndpoint>(
       &simulator_, "Endpoint D (A)", "Endpoint A", Perspective::IS_SERVER,
       test::TestConnectionId(42));
-  auto endpoint_d_b = QuicMakeUnique<QuicEndpoint>(
+  auto endpoint_d_b = std::make_unique<QuicEndpoint>(
       &simulator_, "Endpoint D (B)", "Endpoint B", Perspective::IS_SERVER,
       test::TestConnectionId(43));
-  auto endpoint_d_c = QuicMakeUnique<QuicEndpoint>(
+  auto endpoint_d_c = std::make_unique<QuicEndpoint>(
       &simulator_, "Endpoint D (C)", "Endpoint C", Perspective::IS_SERVER,
       test::TestConnectionId(44));
   QuicEndpointMultiplexer endpoint_d(
diff --git a/quic/test_tools/simulator/simulator_test.cc b/quic/test_tools/simulator/simulator_test.cc
index 1e7a8ce..369825d 100644
--- a/quic/test_tools/simulator/simulator_test.cc
+++ b/quic/test_tools/simulator/simulator_test.cc
@@ -123,7 +123,7 @@
 
   void Act() override {
     if (tx_port_->TimeUntilAvailable().IsZero()) {
-      auto packet = QuicMakeUnique<Packet>();
+      auto packet = std::make_unique<Packet>();
       packet->source = name_;
       packet->destination = destination_;
       packet->tx_timestamp = clock_->Now();
@@ -255,7 +255,7 @@
   EXPECT_EQ(0u, queue.packets_queued());
   EXPECT_EQ(0u, acceptor.packets()->size());
 
-  auto first_packet = QuicMakeUnique<Packet>();
+  auto first_packet = std::make_unique<Packet>();
   first_packet->size = 600;
   queue.AcceptPacket(std::move(first_packet));
   EXPECT_EQ(600u, queue.bytes_queued());
@@ -263,14 +263,14 @@
   EXPECT_EQ(0u, acceptor.packets()->size());
 
   // The second packet does not fit and is dropped.
-  auto second_packet = QuicMakeUnique<Packet>();
+  auto second_packet = std::make_unique<Packet>();
   second_packet->size = 500;
   queue.AcceptPacket(std::move(second_packet));
   EXPECT_EQ(600u, queue.bytes_queued());
   EXPECT_EQ(1u, queue.packets_queued());
   EXPECT_EQ(0u, acceptor.packets()->size());
 
-  auto third_packet = QuicMakeUnique<Packet>();
+  auto third_packet = std::make_unique<Packet>();
   third_packet->size = 400;
   queue.AcceptPacket(std::move(third_packet));
   EXPECT_EQ(1000u, queue.bytes_queued());
diff --git a/quic/test_tools/simulator/switch.cc b/quic/test_tools/simulator/switch.cc
index 809c7f8..9247490 100644
--- a/quic/test_tools/simulator/switch.cc
+++ b/quic/test_tools/simulator/switch.cc
@@ -77,7 +77,7 @@
     if (!egress_port.connected()) {
       continue;
     }
-    egress_port.EnqueuePacket(QuicMakeUnique<Packet>(*packet));
+    egress_port.EnqueuePacket(std::make_unique<Packet>(*packet));
   }
 }