Add support for accepting 0-RTT in TlsServerHandshaker

This adds support at the crypto handshake layer for supporting 0-RTT TLS
handshakes on the server. Part of this support includes receiving a signal
from the application layer, via a new method
QuicCryptoStream::SetServerApplicationStateForResumption. This method
replaces the previously client-only
QuicCryptoClientStream::OnApplicationState.

Introduce quic 0-rtt tls support, protected by quic_enable_zero_rtt_for_tls

PiperOrigin-RevId: 315331343
Change-Id: Ife83cf526be38bd4f5c8a3de0e6cd4c40be6f7ae
diff --git a/quic/core/http/quic_spdy_client_session_base.cc b/quic/core/http/quic_spdy_client_session_base.cc
index 04f8594..86592bb 100644
--- a/quic/core/http/quic_spdy_client_session_base.cc
+++ b/quic/core/http/quic_spdy_client_session_base.cc
@@ -240,8 +240,8 @@
       HttpEncoder::SerializeSettingsFrame(frame, &buffer);
   auto serialized_data = std::make_unique<ApplicationState>(
       buffer.get(), buffer.get() + frame_length);
-  static_cast<QuicCryptoClientStreamBase*>(GetMutableCryptoStream())
-      ->OnApplicationState(std::move(serialized_data));
+  GetMutableCryptoStream()->SetServerApplicationStateForResumption(
+      std::move(serialized_data));
 }
 
 }  // namespace quic
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index 4376d8a..cb6a7f6 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -857,7 +857,7 @@
                                 ConnectionCloseBehavior::SILENT_CLOSE);
 }
 
-bool QuicSpdySession::SetApplicationState(ApplicationState* cached_state) {
+bool QuicSpdySession::ResumeApplicationState(ApplicationState* cached_state) {
   DCHECK_EQ(perspective(), Perspective::IS_CLIENT);
   DCHECK(VersionUsesHttp3(transport_version()));
 
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h
index cdd81a0..069cceb 100644
--- a/quic/core/http/quic_spdy_session.h
+++ b/quic/core/http/quic_spdy_session.h
@@ -378,7 +378,7 @@
   void OnStreamCreated(QuicSpdyStream* stream);
 
   // Decode SETTINGS from |cached_state| and apply it to the session.
-  bool SetApplicationState(ApplicationState* cached_state) override;
+  bool ResumeApplicationState(ApplicationState* cached_state) override;
 
  protected:
   // Override CreateIncomingStream(), CreateOutgoingBidirectionalStream() and
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index 8223617..7b4e0d7 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -140,6 +140,8 @@
   HandshakeState GetHandshakeState() const override {
     return one_rtt_keys_available() ? HANDSHAKE_COMPLETE : HANDSHAKE_START;
   }
+  void SetServerApplicationStateForResumption(
+      std::unique_ptr<ApplicationState> /*application_state*/) override {}
   const QuicCryptoNegotiatedParameters& crypto_negotiated_params()
       const override {
     return *params_;
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc
index 7ab9aa0..e769a9d 100644
--- a/quic/core/http/quic_spdy_stream_test.cc
+++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -127,6 +127,8 @@
   HandshakeState GetHandshakeState() const override {
     return one_rtt_keys_available() ? HANDSHAKE_COMPLETE : HANDSHAKE_START;
   }
+  void SetServerApplicationStateForResumption(
+      std::unique_ptr<ApplicationState> /*application_state*/) override {}
   const QuicCryptoNegotiatedParameters& crypto_negotiated_params()
       const override {
     return *params_;