Remove one layer of abstraction in QuicCryptoServerStream classes

The former QuicCryptoServerStream::HandshakerDelegate interface matches the
interface of QuicCryptoServerStreamBase. Classes that formerly implemented
the HandshakerDelegate now directly implement QuicCryptoServerStreamBase
and the QuicCryptoServerStream class is removed.

Prior to this change, QuicCryptoServerStream extends QuicCryptoServerStreamBase,
but the whole implementation of QuicCryptoServerStream is to call the
corresponding methods on its HandshakerInterface. The only implementation of
QuicCryptoServerStream::HandshakerInterface is QuicCryptoServerHandshaker. That
class now directly implements QuicCryptoServerStreamBase and bypasses
QuicCryptoServerStream. A similar setup exists with GfeQuicCryptoServerStream
extending QuicCryptoServerStream, but delegating its entire implementation to
GfeQuicCryptoServerHandshaker. Now GfeQuicCryptoServerStream is removed, and
GfeQuicCryptoServerHandshaker implements GfeCryptoServerStream (which used to
be implemented by GfeQuicCryptoServerStream).

The only place (excluding test code) where a GfeQuicCryptoServerStream is
created is in CreateGfeCryptoServerStream, which now creates a
GfeQuicCryptoServerHandshaker directly. Likewise, the only place a
QuicCryptoServerStream is created (apart from the GfeQuicCryptoServerStream
subclass, which is taken care of by the above, and excluding test code) is in
CreateCryptoServerStream, which now creates a QuicCryptoServerHandshaker
instead of a QuicCryptoServerStream.

gfe-relnote: rename classes and remove dead code. no behavior change, not flag protected
PiperOrigin-RevId: 296542342
Change-Id: I516035e2f574554dd5a32ba3ac413c2d16d46c8d
diff --git a/quic/core/quic_crypto_server_stream.cc b/quic/core/quic_crypto_server_stream.cc
index dbbb541..a4ee9d1 100644
--- a/quic/core/quic_crypto_server_stream.cc
+++ b/quic/core/quic_crypto_server_stream.cc
@@ -34,8 +34,9 @@
     QuicCryptoServerStreamBase::Helper* helper) {
   switch (session->connection()->version().handshake_protocol) {
     case PROTOCOL_QUIC_CRYPTO:
-      return std::unique_ptr<QuicCryptoServerStream>(new QuicCryptoServerStream(
-          crypto_config, compressed_certs_cache, session, helper));
+      return std::unique_ptr<QuicCryptoServerHandshaker>(
+          new QuicCryptoServerHandshaker(crypto_config, compressed_certs_cache,
+                                         session, helper));
     case PROTOCOL_TLS1_3:
       return std::unique_ptr<TlsServerHandshaker>(new TlsServerHandshaker(
           session, crypto_config->ssl_ctx(), crypto_config->proof_source()));
@@ -48,156 +49,4 @@
   return nullptr;
 }
 
-QuicCryptoServerStream::QuicCryptoServerStream(
-    const QuicCryptoServerConfig* crypto_config,
-    QuicCompressedCertsCache* compressed_certs_cache,
-    QuicSession* session,
-    QuicCryptoServerStreamBase::Helper* helper)
-    : QuicCryptoServerStream(crypto_config,
-                             compressed_certs_cache,
-                             session,
-                             helper,
-                             /*handshaker*/ nullptr) {}
-
-QuicCryptoServerStream::QuicCryptoServerStream(
-    const QuicCryptoServerConfig* crypto_config,
-    QuicCompressedCertsCache* compressed_certs_cache,
-    QuicSession* session,
-    QuicCryptoServerStreamBase::Helper* helper,
-    std::unique_ptr<HandshakerInterface> handshaker)
-    : QuicCryptoServerStreamBase(session),
-      handshaker_(std::move(handshaker)),
-      crypto_config_(crypto_config),
-      compressed_certs_cache_(compressed_certs_cache),
-      helper_(helper) {
-  DCHECK_EQ(Perspective::IS_SERVER, session->connection()->perspective());
-  if (!handshaker_) {
-    switch (session->connection()->version().handshake_protocol) {
-      case PROTOCOL_QUIC_CRYPTO:
-        handshaker_ = std::make_unique<QuicCryptoServerHandshaker>(
-            crypto_config_, this, compressed_certs_cache_, session, helper_);
-        break;
-      case PROTOCOL_TLS1_3:
-        QUIC_BUG
-            << "Attempting to create QuicCryptoServerStream for TLS version";
-        break;
-      case PROTOCOL_UNSUPPORTED:
-        QUIC_BUG << "Attempting to create QuicCryptoServerStream for unknown "
-                    "handshake protocol";
-    }
-  }
-}
-
-QuicCryptoServerStream::~QuicCryptoServerStream() {}
-
-void QuicCryptoServerStream::CancelOutstandingCallbacks() {
-  if (handshaker_) {
-    handshaker_->CancelOutstandingCallbacks();
-  }
-}
-
-bool QuicCryptoServerStream::GetBase64SHA256ClientChannelID(
-    std::string* output) const {
-  return handshaker_->GetBase64SHA256ClientChannelID(output);
-}
-
-void QuicCryptoServerStream::SendServerConfigUpdate(
-    const CachedNetworkParameters* cached_network_params) {
-  handshaker_->SendServerConfigUpdate(cached_network_params);
-}
-
-uint8_t QuicCryptoServerStream::NumHandshakeMessages() const {
-  return handshaker_->NumHandshakeMessages();
-}
-
-uint8_t QuicCryptoServerStream::NumHandshakeMessagesWithServerNonces() const {
-  return handshaker_->NumHandshakeMessagesWithServerNonces();
-}
-
-int QuicCryptoServerStream::NumServerConfigUpdateMessagesSent() const {
-  return handshaker_->NumServerConfigUpdateMessagesSent();
-}
-
-const CachedNetworkParameters*
-QuicCryptoServerStream::PreviousCachedNetworkParams() const {
-  return handshaker_->PreviousCachedNetworkParams();
-}
-
-bool QuicCryptoServerStream::ZeroRttAttempted() const {
-  return handshaker_->ZeroRttAttempted();
-}
-
-void QuicCryptoServerStream::SetPreviousCachedNetworkParams(
-    CachedNetworkParameters cached_network_params) {
-  handshaker_->SetPreviousCachedNetworkParams(cached_network_params);
-}
-
-bool QuicCryptoServerStream::ShouldSendExpectCTHeader() const {
-  return handshaker_->ShouldSendExpectCTHeader();
-}
-
-bool QuicCryptoServerStream::encryption_established() const {
-  if (!handshaker_) {
-    return false;
-  }
-  return handshaker_->encryption_established();
-}
-
-bool QuicCryptoServerStream::one_rtt_keys_available() const {
-  if (!handshaker_) {
-    return false;
-  }
-  return handshaker_->one_rtt_keys_available();
-}
-
-const QuicCryptoNegotiatedParameters&
-QuicCryptoServerStream::crypto_negotiated_params() const {
-  return handshaker_->crypto_negotiated_params();
-}
-
-CryptoMessageParser* QuicCryptoServerStream::crypto_message_parser() {
-  return handshaker_->crypto_message_parser();
-}
-
-void QuicCryptoServerStream::OnPacketDecrypted(EncryptionLevel level) {
-  handshaker_->OnPacketDecrypted(level);
-}
-
-void QuicCryptoServerStream::OnHandshakeDoneReceived() {
-  DCHECK(false);
-}
-
-HandshakeState QuicCryptoServerStream::GetHandshakeState() const {
-  return handshaker_->GetHandshakeState();
-}
-
-size_t QuicCryptoServerStream::BufferSizeLimitForLevel(
-    EncryptionLevel level) const {
-  return handshaker_->BufferSizeLimitForLevel(level);
-}
-
-void QuicCryptoServerStream::set_handshaker(
-    std::unique_ptr<QuicCryptoServerStream::HandshakerInterface> handshaker) {
-  CHECK(!handshaker_);
-  handshaker_ = std::move(handshaker);
-}
-
-QuicCryptoServerStream::HandshakerInterface*
-QuicCryptoServerStream::handshaker() const {
-  return handshaker_.get();
-}
-
-const QuicCryptoServerConfig* QuicCryptoServerStream::crypto_config() const {
-  return crypto_config_;
-}
-
-QuicCompressedCertsCache* QuicCryptoServerStream::compressed_certs_cache()
-    const {
-  return compressed_certs_cache_;
-}
-
-QuicCryptoServerStreamBase::Helper* QuicCryptoServerStream::helper() const {
-  return helper_;
-}
-
 }  // namespace quic