Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(889)

Unified Diff: net/quic/crypto/quic_crypto_client_config.cc

Issue 149413008: QUIC - Start the process for reading crypto config data from disk cache (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed wtc's comments Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/quic/crypto/quic_crypto_client_config.cc
diff --git a/net/quic/crypto/quic_crypto_client_config.cc b/net/quic/crypto/quic_crypto_client_config.cc
index 84dfee02b5e9b7875df6e4b7a8a0c1d222626377..7c96066afa88b09a37e9c505ed2320fc871bc214 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,24 @@ void QuicCryptoClientConfig::SetDefaults() {
aead[0] = kAESG;
}
+QuicCryptoClientConfig::CachedState* QuicCryptoClientConfig::CreateCachedState(
+ const string& server_hostname,
+ QuicServerInfoFactory* quic_server_info_factory) {
+ DCHECK(quic_server_info_factory);
+
+ map<string, CachedState*>::const_iterator it =
+ cached_states_.find(server_hostname);
+ DCHECK(it == cached_states_.end());
wtc 2014/02/04 01:37:02 Nit: this should be DCHECK_EQ(cached_states_.fi
ramant (doing other things) 2014/02/04 19:23:53 Done.
+
+ scoped_ptr<QuicServerInfo> quic_server_info(
+ 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 =
@@ -248,9 +256,6 @@ QuicCryptoClientConfig::CachedState* QuicCryptoClientConfig::LookupOrCreate(
}
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));
wtc 2014/02/04 01:37:02 It seems that you should use the new CreateCachedS
ramant (doing other things) 2014/02/04 19:23:53 In chrome, we call LookupOrCreate() after we call
return cached;
}

Powered by Google App Engine
This is Rietveld 408576698