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

Side by Side Diff: net/quic/quic_stream_factory.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 for patch set 2 Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_stream_factory.h" 5 #include "net/quic/quic_stream_factory.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 return OK; 320 return OK;
321 } 321 }
322 322
323 if (HasActiveJob(host_port_proxy_pair)) { 323 if (HasActiveJob(host_port_proxy_pair)) {
324 Job* job = active_jobs_[host_port_proxy_pair]; 324 Job* job = active_jobs_[host_port_proxy_pair];
325 active_requests_[request] = job; 325 active_requests_[request] = job;
326 job_requests_map_[job].insert(request); 326 job_requests_map_[job].insert(request);
327 return ERR_IO_PENDING; 327 return ERR_IO_PENDING;
328 } 328 }
329 329
330 // Create crypto config and start the process of loading QUIC server
331 // information from disk cache.
332 QuicCryptoClientConfig* crypto_config =
333 GetOrCreateCryptoConfig(host_port_proxy_pair);
334 DCHECK(crypto_config);
335
330 scoped_ptr<Job> job(new Job(this, host_resolver_, host_port_proxy_pair, 336 scoped_ptr<Job> job(new Job(this, host_resolver_, host_port_proxy_pair,
331 is_https, cert_verifier, net_log)); 337 is_https, cert_verifier, net_log));
332 int rv = job->Run(base::Bind(&QuicStreamFactory::OnJobComplete, 338 int rv = job->Run(base::Bind(&QuicStreamFactory::OnJobComplete,
333 base::Unretained(this), job.get())); 339 base::Unretained(this), job.get()));
334 340
335 if (rv == ERR_IO_PENDING) { 341 if (rv == ERR_IO_PENDING) {
336 active_requests_[request] = job.get(); 342 active_requests_[request] = job.get();
337 job_requests_map_[job.get()].insert(request); 343 job_requests_map_[job.get()].insert(request);
338 active_jobs_[host_port_proxy_pair] = job.release(); 344 active_jobs_[host_port_proxy_pair] = job.release();
339 } 345 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 QuicCryptoClientConfig* QuicStreamFactory::GetOrCreateCryptoConfig( 605 QuicCryptoClientConfig* QuicStreamFactory::GetOrCreateCryptoConfig(
600 const HostPortProxyPair& host_port_proxy_pair) { 606 const HostPortProxyPair& host_port_proxy_pair) {
601 QuicCryptoClientConfig* crypto_config; 607 QuicCryptoClientConfig* crypto_config;
602 608
603 if (ContainsKey(all_crypto_configs_, host_port_proxy_pair)) { 609 if (ContainsKey(all_crypto_configs_, host_port_proxy_pair)) {
604 crypto_config = all_crypto_configs_[host_port_proxy_pair]; 610 crypto_config = all_crypto_configs_[host_port_proxy_pair];
605 DCHECK(crypto_config); 611 DCHECK(crypto_config);
606 } else { 612 } else {
607 // TODO(rtenneti): if two quic_sessions for the same host_port_proxy_pair 613 // TODO(rtenneti): if two quic_sessions for the same host_port_proxy_pair
608 // share the same crypto_config, will it cause issues? 614 // share the same crypto_config, will it cause issues?
609 crypto_config = new QuicCryptoClientConfig(quic_server_info_factory_); 615 crypto_config = new QuicCryptoClientConfig();
616 if (quic_server_info_factory_) {
617 QuicCryptoClientConfig::CachedState* cached =
618 crypto_config->Create(host_port_proxy_pair.first.host(),
619 quic_server_info_factory_);
620 DCHECK(cached);
621 }
610 crypto_config->SetDefaults(); 622 crypto_config->SetDefaults();
611 all_crypto_configs_[host_port_proxy_pair] = crypto_config; 623 all_crypto_configs_[host_port_proxy_pair] = crypto_config;
612 PopulateFromCanonicalConfig(host_port_proxy_pair, crypto_config); 624 PopulateFromCanonicalConfig(host_port_proxy_pair, crypto_config);
613 } 625 }
614 return crypto_config; 626 return crypto_config;
615 } 627 }
616 628
617 void QuicStreamFactory::PopulateFromCanonicalConfig( 629 void QuicStreamFactory::PopulateFromCanonicalConfig(
618 const HostPortProxyPair& host_port_proxy_pair, 630 const HostPortProxyPair& host_port_proxy_pair,
619 QuicCryptoClientConfig* crypto_config) { 631 QuicCryptoClientConfig* crypto_config) {
(...skipping 27 matching lines...) Expand all
647 // Copy the CachedState for the canonical server from canonical_crypto_config 659 // Copy the CachedState for the canonical server from canonical_crypto_config
648 // as the initial CachedState for the server_hostname in crypto_config. 660 // as the initial CachedState for the server_hostname in crypto_config.
649 crypto_config->InitializeFrom(server_hostname, 661 crypto_config->InitializeFrom(server_hostname,
650 canonical_host_port_proxy_pair.first.host(), 662 canonical_host_port_proxy_pair.first.host(),
651 canonical_crypto_config); 663 canonical_crypto_config);
652 // Update canonical version to point at the "most recent" crypto_config. 664 // Update canonical version to point at the "most recent" crypto_config.
653 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; 665 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair;
654 } 666 }
655 667
656 } // namespace net 668 } // namespace net
OLDNEW
« net/quic/crypto/quic_crypto_client_config.cc ('K') | « net/quic/crypto/quic_crypto_client_config.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698