In TlsClientHandshaker, only insert data into cache if all required states are present.

ApplicationState is now  optional to TlsClientHandshaker because not all applications have it.

gfe-relnote: unused code. not protected.
PiperOrigin-RevId: 307719344
Change-Id: Ib4e359c6a13c9b7b805dca7a1cfd3b1bf89af6ef
diff --git a/quic/core/tls_client_handshaker.h b/quic/core/tls_client_handshaker.h
index 0128c8b..7acec4f 100644
--- a/quic/core/tls_client_handshaker.h
+++ b/quic/core/tls_client_handshaker.h
@@ -34,7 +34,8 @@
                       QuicSession* session,
                       std::unique_ptr<ProofVerifyContext> verify_context,
                       QuicCryptoClientConfig* crypto_config,
-                      QuicCryptoClientStream::ProofHandler* proof_handler);
+                      QuicCryptoClientStream::ProofHandler* proof_handler,
+                      bool has_application_state);
   TlsClientHandshaker(const TlsClientHandshaker&) = delete;
   TlsClientHandshaker& operator=(const TlsClientHandshaker&) = delete;
 
@@ -165,8 +166,14 @@
 
   bool allow_empty_alpn_for_tests_ = false;
 
+  const bool has_application_state_;
+
   TlsClientConnection tls_connection_;
 
+  // If |has_application_state_|, stores the tls session tickets before
+  // application state is received. The latest one is put in the front.
+  bssl::UniquePtr<SSL_SESSION> cached_tls_sessions_[2] = {};
+
   std::unique_ptr<TransportParameters> received_transport_params_ = nullptr;
   std::unique_ptr<ApplicationState> received_application_state_ = nullptr;
 };