gfe-relnote: Move the logic for sending the MAX_PUSH_ID frame from QuicSpdyClientSessionBase to QuicSpdySession along with the other "send initial data" logic. Protected by disabled QUIC v99 flag.

PiperOrigin-RevId: 283608387
Change-Id: I3d80b0a4a596b8644912cd78993950d81f396da3
diff --git a/quic/core/http/quic_spdy_client_session_base.cc b/quic/core/http/quic_spdy_client_session_base.cc
index 0150be8..7dd2aec 100644
--- a/quic/core/http/quic_spdy_client_session_base.cc
+++ b/quic/core/http/quic_spdy_client_session_base.cc
@@ -39,24 +39,6 @@
   QuicSpdySession::OnConfigNegotiated();
 }
 
-void QuicSpdyClientSessionBase::OnCryptoHandshakeEvent(
-    CryptoHandshakeEvent event) {
-  QuicSpdySession::OnCryptoHandshakeEvent(event);
-  if (event == HANDSHAKE_CONFIRMED && max_allowed_push_id() > 0 &&
-      VersionUsesHttp3(transport_version())) {
-    SendMaxPushId();
-  }
-}
-
-void QuicSpdyClientSessionBase::SetDefaultEncryptionLevel(
-    quic::EncryptionLevel level) {
-  QuicSpdySession::SetDefaultEncryptionLevel(level);
-  if (level == ENCRYPTION_FORWARD_SECURE && max_allowed_push_id() > 0 &&
-      VersionUsesHttp3(transport_version())) {
-    SendMaxPushId();
-  }
-}
-
 void QuicSpdyClientSessionBase::OnInitialHeadersComplete(
     QuicStreamId stream_id,
     const SpdyHeaderBlock& response_headers) {
diff --git a/quic/core/http/quic_spdy_client_session_base.h b/quic/core/http/quic_spdy_client_session_base.h
index b208abd..3ca3499 100644
--- a/quic/core/http/quic_spdy_client_session_base.h
+++ b/quic/core/http/quic_spdy_client_session_base.h
@@ -50,10 +50,6 @@
 
   void OnConfigNegotiated() override;
 
-  // Override base class to set FEC policy before any data is sent by client.
-  void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) override;
-  void SetDefaultEncryptionLevel(quic::EncryptionLevel level) override;
-
   // Called by |headers_stream_| when push promise headers have been
   // completely received.
   void OnPromiseHeaderList(QuicStreamId stream_id,
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index 6bf2f1d..a34d580 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -349,7 +349,8 @@
       destruction_indicator_(123456789),
       debug_visitor_(nullptr),
       http3_goaway_received_(false),
-      http3_goaway_sent_(false) {
+      http3_goaway_sent_(false),
+      http3_max_push_id_sent_(false) {
   h2_deframer_.set_visitor(spdy_framer_visitor_.get());
   h2_deframer_.set_debug_visitor(spdy_framer_visitor_.get());
   spdy_framer_.set_debug_visitor(spdy_framer_visitor_.get());
@@ -598,6 +599,10 @@
   send_control_stream_->MaybeSendSettingsFrame();
   qpack_decoder_send_stream_->MaybeSendStreamType();
   qpack_encoder_send_stream_->MaybeSendStreamType();
+  if (perspective() == Perspective::IS_CLIENT && !http3_max_push_id_sent_) {
+    SendMaxPushId();
+    http3_max_push_id_sent_ = true;
+  }
 }
 
 QpackEncoder* QuicSpdySession::qpack_encoder() {
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h
index 50ec602..575d664 100644
--- a/quic/core/http/quic_spdy_session.h
+++ b/quic/core/http/quic_spdy_session.h
@@ -440,6 +440,9 @@
   bool http3_goaway_received_;
   // If the endpoint has sent HTTP/3 GOAWAY frame.
   bool http3_goaway_sent_;
+
+  // If the sendpoint has sent the initial HTTP/3 MAX_PUSH_ID frame.
+  bool http3_max_push_id_sent_;
 };
 
 }  // namespace quic
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc
index 8def703..42e9954 100644
--- a/quic/core/http/quic_spdy_stream_test.cc
+++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -232,10 +232,15 @@
       auto send_control_stream =
           QuicSpdySessionPeer::GetSendControlStream(session_.get());
       // The control stream will write 3 times, including stream type, settings
-      // frame, priority for headers.
+      // frame and max push id, priority for headers.
+      int num_control_stream_writes = 2;
+      if (session_->perspective() == Perspective::IS_CLIENT) {
+        // The control stream also writes the max push id frame.
+        num_control_stream_writes++;
+      }
       EXPECT_CALL(*session_, WritevData(send_control_stream,
                                         send_control_stream->id(), _, _, _))
-          .Times(2);
+          .Times(num_control_stream_writes);
       auto qpack_decoder_stream =
           QuicSpdySessionPeer::GetQpackDecoderSendStream(session_.get());
       EXPECT_CALL(*session_, WritevData(qpack_decoder_stream,
@@ -1279,7 +1284,8 @@
         .Times(4);
     auto send_control_stream =
         QuicSpdySessionPeer::GetSendControlStream(session_.get());
-    // The control stream will write priority for headers.
+    // The control stream will write priority for headers as well as
+    // the settings/max_push_id.
     EXPECT_CALL(*session_, WritevData(send_control_stream,
                                       send_control_stream->id(), _, _, _))
         .Times(1);