Refactor QuicSpdySession::SendMaxPushId().

Lift the if(max_push_id_.has_value()) conditional from SendMaxPushId() to
SendInitialData().  (It is always true when SendMaxPushId() is called from
SetMaxPushId()).  This makes the name SendMaxPushId() accurate (otherwise it
should be called MaybeSendMaxPushId()).

Also, make SendMaxPushId() private.

No behavioral change.

PiperOrigin-RevId: 314776010
Change-Id: I838c64b098d802122add77c0807c385b989dc474
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index 751a4d7..4376d8a 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -736,7 +736,8 @@
   }
   QuicConnection::ScopedPacketFlusher flusher(connection());
   send_control_stream_->MaybeSendSettingsFrame();
-  if (perspective() == Perspective::IS_CLIENT && !http3_max_push_id_sent_) {
+  if (perspective() == Perspective::IS_CLIENT && max_push_id_.has_value() &&
+      !http3_max_push_id_sent_) {
     SendMaxPushId();
     http3_max_push_id_sent_ = true;
   }
@@ -1282,9 +1283,7 @@
   DCHECK(VersionUsesHttp3(transport_version()));
   DCHECK_EQ(Perspective::IS_CLIENT, perspective());
 
-  if (max_push_id_.has_value()) {
-    send_control_stream_->SendMaxPushIdFrame(max_push_id_.value());
-  }
+  send_control_stream_->SendMaxPushIdFrame(max_push_id_.value());
 }
 
 void QuicSpdySession::EnableServerPush() {
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h
index 1232367..cdd81a0 100644
--- a/quic/core/http/quic_spdy_session.h
+++ b/quic/core/http/quic_spdy_session.h
@@ -446,8 +446,6 @@
   // Initializes HTTP/3 unidirectional streams if not yet initialzed.
   virtual void MaybeInitializeHttp3UnidirectionalStreams();
 
-  void SendMaxPushId();
-
  private:
   friend class test::QuicSpdySessionPeer;
 
@@ -472,6 +470,9 @@
   // including the initial SETTINGS frame, etc.
   void SendInitialData();
 
+  // Send a MAX_PUSH_ID frame.  Used in IETF QUIC only.
+  void SendMaxPushId();
+
   std::unique_ptr<QpackEncoder> qpack_encoder_;
   std::unique_ptr<QpackDecoder> qpack_decoder_;