Automated g4 rollback of changelist 257008406.

*** Reason for rollback ***

To allow this flag to be turned off in chromium due to b/137681973.

*** Original change description ***

gfe-relnote: Deprecate gfe2_reloadable_flag_quic_simplify_stop_waiting.

***

PiperOrigin-RevId: 258640921
Change-Id: I26998bd7dfc8fdeb297ce4e4f77d2e06b65dd19d
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index ecab751..22ee18a 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -991,8 +991,12 @@
   // If the incoming ack's packets set expresses received packets: peer is still
   // acking packets which we never care about.
   // Send an ack to raise the high water mark.
-  const bool send_stop_waiting =
-      no_stop_waiting_frames_ ? false : GetLeastUnacked() > start;
+  bool send_stop_waiting = GetLeastUnacked() > start;
+  if (GetQuicReloadableFlag(quic_simplify_stop_waiting) &&
+      no_stop_waiting_frames_) {
+    QUIC_RELOADABLE_FLAG_COUNT(quic_simplify_stop_waiting);
+    send_stop_waiting = false;
+  }
   PostProcessAfterAckFrame(send_stop_waiting,
                            ack_result == PACKETS_NEWLY_ACKED);
   processing_ack_frame_ = false;
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h
index 5fdffee..59a3656 100644
--- a/quic/core/quic_connection.h
+++ b/quic/core/quic_connection.h
@@ -1243,6 +1243,7 @@
 
   // Indicates how many consecutive times an ack has arrived which indicates
   // the peer needs to stop waiting for some packets.
+  // TODO(fayang): remove this when deprecating quic_simplify_stop_waiting.
   int stop_waiting_count_;
 
   // Indicates the retransmission alarm needs to be set.
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index 6b5b943..ee7b651 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -2604,13 +2604,18 @@
   connection_.SendStreamDataWithString(3, "foofoofoo", 9, NO_FIN);
   // Ack bundled.
   if (GetParam().no_stop_waiting) {
-    // Do not ACK acks.
-    EXPECT_EQ(1u, writer_->frame_count());
+    if (GetQuicReloadableFlag(quic_simplify_stop_waiting)) {
+      // Do not ACK acks.
+      EXPECT_EQ(1u, writer_->frame_count());
+    } else {
+      EXPECT_EQ(2u, writer_->frame_count());
+    }
   } else {
     EXPECT_EQ(3u, writer_->frame_count());
   }
   EXPECT_EQ(1u, writer_->stream_frames().size());
-  if (GetParam().no_stop_waiting) {
+  if (GetParam().no_stop_waiting &&
+      GetQuicReloadableFlag(quic_simplify_stop_waiting)) {
     EXPECT_TRUE(writer_->ack_frames().empty());
   } else {
     EXPECT_FALSE(writer_->ack_frames().empty());
@@ -6530,13 +6535,19 @@
   // Check that ack is bundled with outgoing data and the delayed ack
   // alarm is reset.
   if (GetParam().no_stop_waiting) {
-    // Do not ACK acks.
-    EXPECT_EQ(1u, writer_->frame_count());
+    if (GetQuicReloadableFlag(quic_simplify_stop_waiting)) {
+      // Do not ACK acks.
+      EXPECT_EQ(1u, writer_->frame_count());
+    } else {
+      EXPECT_EQ(2u, writer_->frame_count());
+      EXPECT_TRUE(writer_->stop_waiting_frames().empty());
+    }
   } else {
     EXPECT_EQ(3u, writer_->frame_count());
     EXPECT_FALSE(writer_->stop_waiting_frames().empty());
   }
-  if (GetParam().no_stop_waiting) {
+  if (GetParam().no_stop_waiting &&
+      GetQuicReloadableFlag(quic_simplify_stop_waiting)) {
     EXPECT_TRUE(writer_->ack_frames().empty());
   } else {
     EXPECT_FALSE(writer_->ack_frames().empty());
@@ -7976,8 +7987,12 @@
   connection_.GetPingAlarm()->Fire();
   size_t padding_frame_count = writer_->padding_frames().size();
   if (GetParam().no_stop_waiting) {
-    // Do not ACK acks.
-    EXPECT_EQ(padding_frame_count + 1u, writer_->frame_count());
+    if (GetQuicReloadableFlag(quic_simplify_stop_waiting)) {
+      // Do not ACK acks.
+      EXPECT_EQ(padding_frame_count + 1u, writer_->frame_count());
+    } else {
+      EXPECT_EQ(padding_frame_count + 2u, writer_->frame_count());
+    }
   } else {
     EXPECT_EQ(padding_frame_count + 3u, writer_->frame_count());
   }
diff --git a/quic/core/quic_versions.cc b/quic/core/quic_versions.cc
index 66b8ad6..9f53c3b 100644
--- a/quic/core/quic_versions.cc
+++ b/quic/core/quic_versions.cc
@@ -452,6 +452,7 @@
   // Enable necessary flags.
   SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   SetQuicFlag(FLAGS_quic_headers_stream_id_in_v99, 60);
+  SetQuicReloadableFlag(quic_simplify_stop_waiting, true);
   SetQuicRestartFlag(quic_do_not_override_connection_id, true);
   SetQuicRestartFlag(quic_use_allocated_connection_ids, true);
 }