Deprecate quic_dispatcher_hands_chlo_extractor_one_version

gfe-relnote: deprecate gfe2_restart_flag_quic_dispatcher_hands_chlo_extractor_one_version
PiperOrigin-RevId: 268104424
Change-Id: I87e36aa31ea9402d10f04d33affdb9ae5b2a0091
diff --git a/quic/core/chlo_extractor.cc b/quic/core/chlo_extractor.cc
index 38e97bd..02c0cdf 100644
--- a/quic/core/chlo_extractor.cc
+++ b/quic/core/chlo_extractor.cc
@@ -321,13 +321,12 @@
 
 // static
 bool ChloExtractor::Extract(const QuicEncryptedPacket& packet,
-                            const ParsedQuicVersionVector& versions,
+                            ParsedQuicVersion version,
                             const QuicTagVector& create_session_tag_indicators,
                             Delegate* delegate,
                             uint8_t connection_id_length) {
-  QUIC_DVLOG(1) << "Extracting CHLO using versions "
-                << ParsedQuicVersionVectorToString(versions);
-  QuicFramer framer(versions, QuicTime::Zero(), Perspective::IS_SERVER,
+  QUIC_DVLOG(1) << "Extracting CHLO using version " << version;
+  QuicFramer framer({version}, QuicTime::Zero(), Perspective::IS_SERVER,
                     connection_id_length);
   ChloFramerVisitor visitor(&framer, create_session_tag_indicators, delegate);
   framer.set_visitor(&visitor);
diff --git a/quic/core/chlo_extractor.h b/quic/core/chlo_extractor.h
index 4e53a10..3cf0d24 100644
--- a/quic/core/chlo_extractor.h
+++ b/quic/core/chlo_extractor.h
@@ -31,7 +31,7 @@
   // if found will result in the session being created early, to
   // enable support for multi-packet CHLOs.
   static bool Extract(const QuicEncryptedPacket& packet,
-                      const ParsedQuicVersionVector& versions,
+                      ParsedQuicVersion version,
                       const QuicTagVector& create_session_tag_indicators,
                       Delegate* delegate,
                       uint8_t connection_id_length);
diff --git a/quic/core/chlo_extractor_test.cc b/quic/core/chlo_extractor_test.cc
index 0aacb18..34f9ff4 100644
--- a/quic/core/chlo_extractor_test.cc
+++ b/quic/core/chlo_extractor_test.cc
@@ -119,7 +119,6 @@
   // Construct a CHLO with each supported version
   for (ParsedQuicVersion version : AllSupportedVersions()) {
     SCOPED_TRACE(version);
-    ParsedQuicVersionVector versions(SupportedVersions(version));
     header_.version = version;
     if (QuicVersionHasLongHeaderLengths(version.transport_version) &&
         header_.version_flag) {
@@ -131,7 +130,7 @@
     }
     MakePacket(version, client_hello_str, /*munge_offset*/ false,
                /*munge_stream_id*/ false);
-    EXPECT_TRUE(ChloExtractor::Extract(*packet_, versions, {}, &delegate_,
+    EXPECT_TRUE(ChloExtractor::Extract(*packet_, version, {}, &delegate_,
                                        kQuicDefaultConnectionIdLength))
         << ParsedQuicVersionToString(version);
     EXPECT_EQ(version.transport_version, delegate_.transport_version());
@@ -152,20 +151,19 @@
   std::string client_hello_str(client_hello.GetSerialized().AsStringPiece());
   MakePacket(version, client_hello_str,
              /*munge_offset*/ false, /*munge_stream_id*/ true);
-  EXPECT_FALSE(ChloExtractor::Extract(*packet_, AllSupportedVersions(), {},
-                                      &delegate_,
+  EXPECT_FALSE(ChloExtractor::Extract(*packet_, version, {}, &delegate_,
                                       kQuicDefaultConnectionIdLength));
 }
 
 TEST_F(ChloExtractorTest, DoesNotFindValidChloOnWrongOffset) {
+  ParsedQuicVersion version = AllSupportedVersions()[0];
   CryptoHandshakeMessage client_hello;
   client_hello.set_tag(kCHLO);
 
   std::string client_hello_str(client_hello.GetSerialized().AsStringPiece());
-  MakePacket(AllSupportedVersions()[0], client_hello_str, /*munge_offset*/ true,
+  MakePacket(version, client_hello_str, /*munge_offset*/ true,
              /*munge_stream_id*/ false);
-  EXPECT_FALSE(ChloExtractor::Extract(*packet_, AllSupportedVersions(), {},
-                                      &delegate_,
+  EXPECT_FALSE(ChloExtractor::Extract(*packet_, version, {}, &delegate_,
                                       kQuicDefaultConnectionIdLength));
 }
 
@@ -176,8 +174,7 @@
   }
   MakePacket(version, "foo", /*munge_offset*/ false,
              /*munge_stream_id*/ true);
-  EXPECT_FALSE(ChloExtractor::Extract(*packet_, AllSupportedVersions(), {},
-                                      &delegate_,
+  EXPECT_FALSE(ChloExtractor::Extract(*packet_, version, {}, &delegate_,
                                       kQuicDefaultConnectionIdLength));
 }
 
diff --git a/quic/core/quic_dispatcher.cc b/quic/core/quic_dispatcher.cc
index 542d205..6a4ce01 100644
--- a/quic/core/quic_dispatcher.cc
+++ b/quic/core/quic_dispatcher.cc
@@ -451,20 +451,8 @@
         ProcessChlo(/*alpn=*/"", packet_info);
         break;
       }
-      ParsedQuicVersionVector chlo_extractor_versions;
-      if (!GetQuicRestartFlag(
-              quic_dispatcher_hands_chlo_extractor_one_version)) {
-        chlo_extractor_versions = GetSupportedVersions();
-      } else {
-        QUIC_RESTART_FLAG_COUNT(
-            quic_dispatcher_hands_chlo_extractor_one_version);
-        chlo_extractor_versions = {packet_info->version};
-        // TODO(dschinazi) once we deprecate
-        // quic_dispatcher_hands_chlo_extractor_one_version, we should change
-        // ChloExtractor::Extract to only take one version.
-      }
       if (GetQuicFlag(FLAGS_quic_allow_chlo_buffering) &&
-          !ChloExtractor::Extract(packet_info->packet, chlo_extractor_versions,
+          !ChloExtractor::Extract(packet_info->packet, packet_info->version,
                                   config_->create_session_tag_indicators(),
                                   &alpn_extractor,
                                   server_connection_id.length())) {
diff --git a/quic/core/quic_dispatcher_test.cc b/quic/core/quic_dispatcher_test.cc
index edb7ee1..f52fa64 100644
--- a/quic/core/quic_dispatcher_test.cc
+++ b/quic/core/quic_dispatcher_test.cc
@@ -301,7 +301,7 @@
     std::unique_ptr<QuicReceivedPacket> received_packet(
         ConstructReceivedPacket(*packet, mock_helper_.GetClock()->Now()));
 
-    if (ChloExtractor::Extract(*packet, versions, {}, nullptr,
+    if (ChloExtractor::Extract(*packet, version, {}, nullptr,
                                server_connection_id.length())) {
       // Add CHLO packet to the beginning to be verified first, because it is
       // also processed first by new session.
@@ -929,7 +929,6 @@
 }
 
 TEST_F(QuicDispatcherTest, SupportedTransportVersionsChangeInFlight) {
-  SetQuicRestartFlag(quic_dispatcher_hands_chlo_extractor_one_version, true);
   SetQuicReloadableFlag(quic_use_parse_public_header, true);
   static_assert(QUIC_ARRAYSIZE(kSupportedTransportVersions) == 6u,
                 "Supported versions out of sync");
diff --git a/quic/core/quic_versions.cc b/quic/core/quic_versions.cc
index 8281b68..4900911 100644
--- a/quic/core/quic_versions.cc
+++ b/quic/core/quic_versions.cc
@@ -458,7 +458,6 @@
   SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   SetQuicReloadableFlag(quic_simplify_stop_waiting, true);
   SetQuicReloadableFlag(quic_use_parse_public_header, true);
-  SetQuicRestartFlag(quic_dispatcher_hands_chlo_extractor_one_version, true);
   SetQuicRestartFlag(quic_use_hashed_stateless_reset_tokens, true);
 }