Deprecate gfe2_reloadable_flag_quic_coalesced_packet_of_higher_space2.

PiperOrigin-RevId: 331576158
Change-Id: I0c0c333b12d3fb7da7d0aff807932a8c2c425e36
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index 38a72fb..fc6ed3d 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -3804,10 +3804,7 @@
     }
     connection_->packet_creator_.Flush();
     if (connection_->version().CanSendCoalescedPackets()) {
-      if (connection_->packet_creator().coalesced_packet_of_higher_space()) {
-        QUIC_RELOADABLE_FLAG_COUNT(quic_coalesced_packet_of_higher_space2);
-        connection_->MaybeCoalescePacketOfHigherSpace();
-      }
+      connection_->MaybeCoalescePacketOfHigherSpace();
       connection_->FlushCoalescedPacket();
     }
     connection_->FlushPackets();
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index d33718a..ef15691 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -10114,12 +10114,8 @@
                            _, _));
   EXPECT_CALL(visitor_, OnHandshakePacketSent()).Times(1);
   connection_.GetRetransmissionAlarm()->Fire();
-  if (GetQuicReloadableFlag(quic_coalesced_packet_of_higher_space2)) {
-    // Verify 1-RTT packet gets coalesced with handshake retransmission.
-    EXPECT_EQ(0x01010101u, writer_->final_bytes_of_last_packet());
-  } else {
-    EXPECT_EQ(0x02020202u, writer_->final_bytes_of_last_packet());
-  }
+  // Verify 1-RTT packet gets coalesced with handshake retransmission.
+  EXPECT_EQ(0x01010101u, writer_->final_bytes_of_last_packet());
 
   // Send application data.
   connection_.SendApplicationDataAtLevel(ENCRYPTION_FORWARD_SECURE, 5, "data",
@@ -10133,21 +10129,15 @@
   QuicPacketNumber handshake_retransmission =
       GetQuicReloadableFlag(quic_default_on_pto) ? QuicPacketNumber(5)
                                                  : QuicPacketNumber(7);
-  if (GetQuicReloadableFlag(quic_coalesced_packet_of_higher_space2)) {
-    handshake_retransmission += 1;
-    EXPECT_CALL(*send_algorithm_,
-                OnPacketSent(_, _, handshake_retransmission + 1, _, _));
-  }
+  handshake_retransmission += 1;
+  EXPECT_CALL(*send_algorithm_,
+              OnPacketSent(_, _, handshake_retransmission + 1, _, _));
   EXPECT_CALL(*send_algorithm_,
               OnPacketSent(_, _, handshake_retransmission, _, _));
   EXPECT_CALL(visitor_, OnHandshakePacketSent()).Times(1);
   connection_.GetRetransmissionAlarm()->Fire();
-  if (GetQuicReloadableFlag(quic_coalesced_packet_of_higher_space2)) {
-    // Verify 1-RTT packet gets coalesced with handshake retransmission.
-    EXPECT_EQ(0x01010101u, writer_->final_bytes_of_last_packet());
-  } else {
-    EXPECT_EQ(0x02020202u, writer_->final_bytes_of_last_packet());
-  }
+  // Verify 1-RTT packet gets coalesced with handshake retransmission.
+  EXPECT_EQ(0x01010101u, writer_->final_bytes_of_last_packet());
 
   // Discard handshake key.
   connection_.OnHandshakeComplete();
@@ -10159,9 +10149,7 @@
   QuicPacketNumber application_retransmission =
       GetQuicReloadableFlag(quic_default_on_pto) ? QuicPacketNumber(6)
                                                  : QuicPacketNumber(9);
-  if (GetQuicReloadableFlag(quic_coalesced_packet_of_higher_space2)) {
-    application_retransmission += 2;
-  }
+  application_retransmission += 2;
   EXPECT_CALL(*send_algorithm_,
               OnPacketSent(_, _, application_retransmission, _, _));
   connection_.GetRetransmissionAlarm()->Fire();
@@ -10921,11 +10909,7 @@
   connection_.SetEncrypter(ENCRYPTION_HANDSHAKE,
                            std::make_unique<TaggingEncrypter>(0x02));
   connection_.SetDefaultEncryptionLevel(ENCRYPTION_HANDSHAKE);
-  if (GetQuicReloadableFlag(quic_coalesced_packet_of_higher_space2)) {
-    EXPECT_CALL(visitor_, OnHandshakePacketSent()).Times(2);
-  } else {
-    EXPECT_CALL(visitor_, OnHandshakePacketSent()).Times(1);
-  }
+  EXPECT_CALL(visitor_, OnHandshakePacketSent()).Times(2);
   connection_.SendCryptoDataWithString("foo", 0, ENCRYPTION_HANDSHAKE);
   // Verify PTO time does not change.
   EXPECT_EQ(expected_pto_time,
@@ -11094,12 +11078,7 @@
   connection_.SetEncrypter(ENCRYPTION_HANDSHAKE,
                            std::make_unique<TaggingEncrypter>(0x02));
   connection_.SetDefaultEncryptionLevel(ENCRYPTION_HANDSHAKE);
-  if (GetQuicReloadableFlag(quic_coalesced_packet_of_higher_space2)) {
-    // Verify HANDSHAKE packet is coalesced with INITIAL retransmission.
-    EXPECT_CALL(visitor_, OnHandshakePacketSent()).Times(2);
-  } else {
-    EXPECT_CALL(visitor_, OnHandshakePacketSent()).Times(1);
-  }
+  EXPECT_CALL(visitor_, OnHandshakePacketSent()).Times(2);
   std::string handshake_crypto_data(1024, 'a');
   connection_.SendCryptoDataWithString(handshake_crypto_data, 0,
                                        ENCRYPTION_HANDSHAKE);
@@ -11123,26 +11102,15 @@
   EXPECT_EQ(kTestRTT, rtt_stats->latest_rtt());
   // Because retransmitted INITIAL gets received so HANDSHAKE 2 gets processed.
   frames.clear();
-  QuicAckFrame ack_frame2;
-  if (GetQuicReloadableFlag(quic_coalesced_packet_of_higher_space2)) {
-    // HANDSHAKE 5 is also processed.
-    ack_frame2 = InitAckFrame(
-        {{QuicPacketNumber(2), QuicPacketNumber(3)},
-         {initial_retransmission + 1, initial_retransmission + 2}});
-  } else {
-    ack_frame2 = InitAckFrame({{QuicPacketNumber(2), QuicPacketNumber(3)}});
-  }
+  // HANDSHAKE 5 is also processed.
+  QuicAckFrame ack_frame2 =
+      InitAckFrame({{QuicPacketNumber(2), QuicPacketNumber(3)},
+                    {initial_retransmission + 1, initial_retransmission + 2}});
   ack_frame2.ack_delay_time = QuicTime::Delta::Zero();
   frames.push_back(QuicFrame(&ack_frame2));
   ProcessFramesPacketAtLevel(1, frames, ENCRYPTION_HANDSHAKE);
-  if (GetQuicReloadableFlag(quic_coalesced_packet_of_higher_space2)) {
-    // Verify RTT inflation gets mitigated.
-    EXPECT_EQ(rtt_stats->latest_rtt(), kTestRTT);
-  } else {
-    // Verify this RTT sample gets inflated as it includes the PTO timeout and
-    // the actual RTT.
-    EXPECT_GE(rtt_stats->latest_rtt(), pto_timeout + kTestRTT);
-  }
+  // Verify RTT inflation gets mitigated.
+  EXPECT_EQ(rtt_stats->latest_rtt(), kTestRTT);
 }
 
 // Regression test for b/161228202
@@ -11181,12 +11149,8 @@
   connection_.SetEncrypter(ENCRYPTION_HANDSHAKE,
                            std::make_unique<TaggingEncrypter>(0x02));
   connection_.SetDefaultEncryptionLevel(ENCRYPTION_HANDSHAKE);
-  if (GetQuicReloadableFlag(quic_coalesced_packet_of_higher_space2)) {
-    // Verify HANDSHAKE packet is coalesced with INITIAL retransmission.
-    EXPECT_CALL(visitor_, OnHandshakePacketSent()).Times(2);
-  } else {
-    EXPECT_CALL(visitor_, OnHandshakePacketSent()).Times(1);
-  }
+  // Verify HANDSHAKE packet is coalesced with INITIAL retransmission.
+  EXPECT_CALL(visitor_, OnHandshakePacketSent()).Times(2);
   std::string handshake_crypto_data(1024, 'a');
   connection_.SendCryptoDataWithString(handshake_crypto_data, 0,
                                        ENCRYPTION_HANDSHAKE);
@@ -11858,8 +11822,7 @@
 
 // Regression test for b/168101557.
 TEST_P(QuicConnectionTest, HandshakeDataDoesNotGetPtoed) {
-  if (!connection_.SupportsMultiplePacketNumberSpaces() ||
-      !GetQuicReloadableFlag(quic_coalesced_packet_of_higher_space2)) {
+  if (!connection_.SupportsMultiplePacketNumberSpaces()) {
     return;
   }
   set_perspective(Perspective::IS_SERVER);
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc
index 2e507a0..939d78d 100644
--- a/quic/core/quic_packet_creator.cc
+++ b/quic/core/quic_packet_creator.cc
@@ -206,9 +206,7 @@
     // Please note: this would not guarantee to fit next packet if the size of
     // packet header increases (e.g., encryption level changes).
     QUIC_DLOG(INFO) << length << " is too small to fit packet header";
-    if (coalesced_packet_of_higher_space_) {
-      RemoveSoftMaxPacketLength();
-    }
+    RemoveSoftMaxPacketLength();
     return;
   }
   QUIC_DVLOG(1) << "Setting soft max packet length to: " << length;
diff --git a/quic/core/quic_packet_creator.h b/quic/core/quic_packet_creator.h
index edb428b..b025d06 100644
--- a/quic/core/quic_packet_creator.h
+++ b/quic/core/quic_packet_creator.h
@@ -465,10 +465,6 @@
   // Returns true if max_packet_length_ is currently a soft value.
   bool HasSoftMaxPacketLength() const;
 
-  bool coalesced_packet_of_higher_space() const {
-    return coalesced_packet_of_higher_space_;
-  }
-
   // Use this address to sent to the peer from now on. If this address is
   // different from the current one, flush all the queue frames first.
   void SetDefaultPeerAddress(QuicSocketAddress address);
@@ -667,9 +663,6 @@
   // negotiates this during the handshake.
   QuicByteCount max_datagram_frame_size_;
 
-  const bool coalesced_packet_of_higher_space_ =
-      GetQuicReloadableFlag(quic_coalesced_packet_of_higher_space2);
-
   const bool close_connection_on_serialization_failure_ =
       GetQuicReloadableFlag(quic_close_connection_on_serialization_failure);
 };