Add knobs to QuicSpdySession for QPACK maximum table capacity and blocked stream limit.

gfe-relnote: n/a, change to QUIC v99-only code.  Protected by existing disabled gfe2_reloadable_flag_quic_enable_version_99.
PiperOrigin-RevId: 265048552
Change-Id: Iab652cf6a0578d56a7e1d4cd7eb6cf1b7f562f60
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index dd9b4f4..08ff7e6 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -318,6 +318,9 @@
       qpack_decoder_receive_stream_(nullptr),
       qpack_encoder_send_stream_(nullptr),
       qpack_decoder_send_stream_(nullptr),
+      qpack_maximum_dynamic_table_capacity_(
+          kDefaultQpackMaxDynamicTableCapacity),
+      qpack_maximum_blocked_streams_(kDefaultMaximumBlockedStreams),
       max_inbound_header_list_size_(kDefaultMaxUncompressedHeaderSize),
       max_outbound_header_list_size_(kDefaultMaxUncompressedHeaderSize),
       server_push_enabled_(true),
@@ -379,12 +382,12 @@
   } else {
     qpack_encoder_ = QuicMakeUnique<QpackEncoder>(this);
     qpack_decoder_ =
-        QuicMakeUnique<QpackDecoder>(kDefaultQpackMaxDynamicTableCapacity,
-                                     kDefaultMaximumBlockedStreams, this);
+        QuicMakeUnique<QpackDecoder>(qpack_maximum_dynamic_table_capacity_,
+                                     qpack_maximum_blocked_streams_, this);
     MaybeInitializeHttp3UnidirectionalStreams();
     // TODO(b/112770235): Send SETTINGS_QPACK_MAX_TABLE_CAPACITY with value
-    // kDefaultQpackMaxDynamicTableCapacity, and SETTINGS_QPACK_BLOCKED_STREAMS
-    // with value kDefaultMaximumBlockedStreams.
+    // qpack_maximum_dynamic_table_capacity_, and SETTINGS_QPACK_BLOCKED_STREAMS
+    // with value qpack_maximum_blocked_streams_.
   }
 
   spdy_framer_visitor_->set_max_header_list_size(max_inbound_header_list_size_);
@@ -680,6 +683,8 @@
         QUIC_DVLOG(1)
             << "SETTINGS_QPACK_MAX_TABLE_CAPACITY received with value "
             << value;
+        // TODO(b/112770235): Limit value to
+        // qpack_maximum_dynamic_table_capacity_.
         qpack_encoder_->SetMaximumDynamicTableCapacity(value);
         break;
       case SETTINGS_MAX_HEADER_LIST_SIZE:
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h
index e16e09a..0ee3632 100644
--- a/quic/core/http/quic_spdy_session.h
+++ b/quic/core/http/quic_spdy_session.h
@@ -155,7 +155,22 @@
   void CloseConnectionWithDetails(QuicErrorCode error,
                                   const std::string& details);
 
-  // Must be called before Initialize().
+  // Must not be called after Initialize().
+  // TODO(bnc): Move to constructor argument.
+  void set_qpack_maximum_dynamic_table_capacity(
+      uint64_t qpack_maximum_dynamic_table_capacity) {
+    qpack_maximum_dynamic_table_capacity_ =
+        qpack_maximum_dynamic_table_capacity;
+  }
+
+  // Must not be called after Initialize().
+  // TODO(bnc): Move to constructor argument.
+  void set_qpack_maximum_blocked_streams(
+      uint64_t qpack_maximum_blocked_streams) {
+    qpack_maximum_blocked_streams_ = qpack_maximum_blocked_streams;
+  }
+
+  // Must not be called after Initialize().
   // TODO(bnc): Move to constructor argument.
   void set_max_inbound_header_list_size(size_t max_inbound_header_list_size) {
     max_inbound_header_list_size_ = max_inbound_header_list_size;
@@ -302,8 +317,21 @@
   QpackSendStream* qpack_encoder_send_stream_;
   QpackSendStream* qpack_decoder_send_stream_;
 
+  // Maximum dynamic table capacity as defined at
+  // https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#maximum-dynamic-table-capacity
+  // for the decoding context.  Value will be sent via
+  // SETTINGS_QPACK_MAX_TABLE_CAPACITY.
+  uint64_t qpack_maximum_dynamic_table_capacity_;
+
+  // Maximum number of blocked streams as defined at
+  // https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#blocked-streams
+  // for the decoding context.  Value will be sent via
+  // SETTINGS_QPACK_BLOCKED_STREAMS.
+  uint64_t qpack_maximum_blocked_streams_;
+
   // The maximum size of a header block that will be accepted from the peer,
   // defined per spec as key + value + overhead per field (uncompressed).
+  // Value will be sent via SETTINGS_MAX_HEADER_LIST_SIZE.
   size_t max_inbound_header_list_size_;
 
   // The maximum size of a header block that can be sent to the peer. This field