summaryrefslogtreecommitdiffstats
path: root/net/quic/crypto/quic_crypto_client_config.cc
diff options
context:
space:
mode:
authorrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 07:38:36 +0000
committerrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 07:38:36 +0000
commit2b0703754b5fc68539fee3c70f1a4dbe9edc763e (patch)
tree5f197fa286d5beebf61652d2245a2086a3207285 /net/quic/crypto/quic_crypto_client_config.cc
parenta3c5c07dd1717fd7d372622bb51c8391aa54a35d (diff)
downloadchromium_src-2b0703754b5fc68539fee3c70f1a4dbe9edc763e.zip
chromium_src-2b0703754b5fc68539fee3c70f1a4dbe9edc763e.tar.gz
chromium_src-2b0703754b5fc68539fee3c70f1a4dbe9edc763e.tar.bz2
QUIC - Start the process for reading crypto config data from disk cache
as early as possible (even before host resokution has started). Create QuicServerInfo in QuicStreamFactory and pass the ownership to QuicCryptoClientConfig::CachedState. This is a parital release. Will be hooking up persisting and reading of the data (including waiting for the disk read to finish) in the next release. R=wtc@chromium.org Review URL: https://codereview.chromium.org/149413008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248905 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/quic/crypto/quic_crypto_client_config.cc')
-rw-r--r--net/quic/crypto/quic_crypto_client_config.cc48
1 files changed, 24 insertions, 24 deletions
diff --git a/net/quic/crypto/quic_crypto_client_config.cc b/net/quic/crypto/quic_crypto_client_config.cc
index 84dfee0..8763910 100644
--- a/net/quic/crypto/quic_crypto_client_config.cc
+++ b/net/quic/crypto/quic_crypto_client_config.cc
@@ -29,13 +29,7 @@ using std::vector;
namespace net {
-QuicCryptoClientConfig::QuicCryptoClientConfig()
- : quic_server_info_factory_(NULL) {
-}
-
-QuicCryptoClientConfig::QuicCryptoClientConfig(
- QuicServerInfoFactory* quic_server_info_factory)
- : quic_server_info_factory_(quic_server_info_factory) {
+QuicCryptoClientConfig::QuicCryptoClientConfig() {
}
QuicCryptoClientConfig::~QuicCryptoClientConfig() {
@@ -46,17 +40,13 @@ QuicCryptoClientConfig::CachedState::CachedState()
: server_config_valid_(false),
generation_counter_(0) {}
-QuicCryptoClientConfig::CachedState::~CachedState() {}
-
-void QuicCryptoClientConfig::CachedState::LoadFromDiskCache(
- QuicServerInfoFactory* quic_server_info_factory,
- const string& server_hostname) {
- DCHECK(quic_server_info_factory);
- quic_server_info_.reset(
- quic_server_info_factory->GetForHost(server_hostname));
+QuicCryptoClientConfig::CachedState::CachedState(
+ scoped_ptr<QuicServerInfo> quic_server_info)
+ : server_config_valid_(false),
+ generation_counter_(0),
+ quic_server_info_(quic_server_info.Pass()) {}
- // TODO(rtenneti): Need to flesh out reading data from disk cache.
-}
+QuicCryptoClientConfig::CachedState::~CachedState() {}
bool QuicCryptoClientConfig::CachedState::IsComplete(QuicWallTime now) const {
if (server_config_.empty() || !server_config_valid_) {
@@ -239,6 +229,22 @@ void QuicCryptoClientConfig::SetDefaults() {
aead[0] = kAESG;
}
+QuicCryptoClientConfig::CachedState* QuicCryptoClientConfig::Create(
+ const string& server_hostname,
+ QuicServerInfoFactory* quic_server_info_factory) {
+ DCHECK(cached_states_.find(server_hostname) == cached_states_.end());
+ scoped_ptr<QuicServerInfo> quic_server_info;
+ if (quic_server_info_factory) {
+ quic_server_info.reset(
+ quic_server_info_factory->GetForHost(server_hostname));
+ quic_server_info->Start();
+ }
+
+ CachedState* cached = new CachedState(quic_server_info.Pass());
+ cached_states_.insert(make_pair(server_hostname, cached));
+ return cached;
+}
+
QuicCryptoClientConfig::CachedState* QuicCryptoClientConfig::LookupOrCreate(
const string& server_hostname) {
map<string, CachedState*>::const_iterator it =
@@ -246,13 +252,7 @@ QuicCryptoClientConfig::CachedState* QuicCryptoClientConfig::LookupOrCreate(
if (it != cached_states_.end()) {
return it->second;
}
-
- CachedState* cached = new CachedState;
- if (quic_server_info_factory_) {
- cached->LoadFromDiskCache(quic_server_info_factory_, server_hostname);
- }
- cached_states_.insert(make_pair(server_hostname, cached));
- return cached;
+ return Create(server_hostname, NULL);
}
void QuicCryptoClientConfig::FillInchoateClientHello(