SSLClientSessionCache ownership refactor
In master, there is one instance of SSLClientSessionCache, accessible through
the singleton SSLClientSocketImpl::SSLContext.
Design principle for refactor: everywhere that a unique shard key is used to
index into the global session cache, we can refactor to use a unique instance
of the session cache.
This CL (1) removes the cache from the singleton and (2) adds an instance of
the cache to each instance of HttpNetworkSession.
[email protected]
Change-Id: Iccbad54264e8f9014c92f06e9698f253f365c8d3
Bug: 458365
Reviewed-on: https://chromium-review.googlesource.com/c/1400777
Commit-Queue: Daniel McArdle <[email protected]>
Reviewed-by: Matt Menke <[email protected]>
Reviewed-by: Steven Bennetts <[email protected]>
Reviewed-by: mark a. foltz <[email protected]>
Reviewed-by: Primiano Tucci <[email protected]>
Reviewed-by: Luke Halliwell <[email protected]>
Reviewed-by: David Benjamin <[email protected]>
Auto-Submit: Daniel McArdle <[email protected]>
Cr-Commit-Position: refs/heads/master@{#627694}
diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc
index 781ba95..48352a7 100644
--- a/net/socket/ssl_server_socket_unittest.cc
+++ b/net/socket/ssl_server_socket_unittest.cc
@@ -59,6 +59,7 @@
#include "net/socket/stream_socket.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_cipher_suite_names.h"
+#include "net/ssl/ssl_client_session_cache.h"
#include "net/ssl/ssl_connection_status_flags.h"
#include "net/ssl/ssl_info.h"
#include "net/ssl/ssl_private_key.h"
@@ -361,7 +362,9 @@
client_cert_verifier_(new MockClientCertVerifier()),
transport_security_state_(new TransportSecurityState),
ct_verifier_(new DoNothingCTVerifier),
- ct_policy_enforcer_(new MockCTPolicyEnforcer) {}
+ ct_policy_enforcer_(new MockCTPolicyEnforcer),
+ ssl_client_session_cache_(
+ new SSLClientSessionCache(SSLClientSessionCache::Config())) {}
void SetUp() override {
PlatformTest::SetUp();
@@ -427,7 +430,8 @@
context.transport_security_state = transport_security_state_.get();
context.cert_transparency_verifier = ct_verifier_.get();
context.ct_policy_enforcer = ct_policy_enforcer_.get();
- // Set a dummy session cache shard to enable session caching.
+ // Set a dummy session cache (and shard) to enable session caching.
+ context.ssl_client_session_cache = ssl_client_session_cache_.get();
context.ssl_session_cache_shard = "shard";
client_socket_ = socket_factory_->CreateSSLClientSocket(
@@ -526,6 +530,7 @@
std::unique_ptr<TransportSecurityState> transport_security_state_;
std::unique_ptr<DoNothingCTVerifier> ct_verifier_;
std::unique_ptr<MockCTPolicyEnforcer> ct_policy_enforcer_;
+ std::unique_ptr<SSLClientSessionCache> ssl_client_session_cache_;
std::unique_ptr<SSLServerContext> server_context_;
std::unique_ptr<crypto::RSAPrivateKey> server_private_key_;
scoped_refptr<SSLPrivateKey> server_ssl_private_key_;