gfe-relnote: Replace QuicCryptoServerStream constructor with CreateCryptoServerStream. Refactor only - no behavior change, not flag protected

PiperOrigin-RevId: 288047090
Change-Id: I625816cfe339f61257062347889d11389f8c5b8f
diff --git a/quic/core/quic_crypto_server_stream.h b/quic/core/quic_crypto_server_stream.h
index 1b74474..890ee56 100644
--- a/quic/core/quic_crypto_server_stream.h
+++ b/quic/core/quic_crypto_server_stream.h
@@ -140,13 +140,6 @@
                                       std::string* error_details) const = 0;
   };
 
-  // |crypto_config| must outlive the stream.
-  // |session| must outlive the stream.
-  // |helper| must outlive the stream.
-  QuicCryptoServerStream(const QuicCryptoServerConfig* crypto_config,
-                         QuicCompressedCertsCache* compressed_certs_cache,
-                         QuicSession* session,
-                         Helper* helper);
   QuicCryptoServerStream(const QuicCryptoServerStream&) = delete;
   QuicCryptoServerStream& operator=(const QuicCryptoServerStream&) = delete;
 
@@ -183,6 +176,16 @@
       const ParsedQuicVersion& version) override;
 
  protected:
+  friend std::unique_ptr<QuicCryptoServerStream> CreateCryptoServerStream(
+      const QuicCryptoServerConfig* crypto_config,
+      QuicCompressedCertsCache* compressed_certs_cache,
+      QuicSession* session,
+      Helper* helper);
+
+  QuicCryptoServerStream(const QuicCryptoServerConfig* crypto_config,
+                         QuicCompressedCertsCache* compressed_certs_cache,
+                         QuicSession* session,
+                         Helper* helper);
   // Provided so that subclasses can provide their own handshaker.
   // set_handshaker can only be called if this QuicCryptoServerStream's
   // handshaker hasn't been set yet. If set_handshaker is called outside of
@@ -212,6 +215,16 @@
   Helper* helper_;
 };
 
+// Creates an appropriate QuicCryptoServerStream for the provided parameters,
+// including the version used by |session|. |crypto_config|, |session|, and
+// |helper| must all outlive the stream. The caller takes ownership of the
+// returned object.
+std::unique_ptr<QuicCryptoServerStream> CreateCryptoServerStream(
+    const QuicCryptoServerConfig* crypto_config,
+    QuicCompressedCertsCache* compressed_certs_cache,
+    QuicSession* session,
+    QuicCryptoServerStream::Helper* helper);
+
 }  // namespace quic
 
 #endif  // QUICHE_QUIC_CORE_QUIC_CRYPTO_SERVER_STREAM_H_