| OLD | NEW |
| 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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 http_server_properties_->GetServerNetworkStats(host_port_pair); | 670 http_server_properties_->GetServerNetworkStats(host_port_pair); |
| 671 if (stats != NULL) { | 671 if (stats != NULL) { |
| 672 config.set_initial_round_trip_time_us(stats->rtt.InMicroseconds(), | 672 config.set_initial_round_trip_time_us(stats->rtt.InMicroseconds(), |
| 673 stats->rtt.InMicroseconds()); | 673 stats->rtt.InMicroseconds()); |
| 674 } | 674 } |
| 675 } | 675 } |
| 676 | 676 |
| 677 *session = new QuicClientSession( | 677 *session = new QuicClientSession( |
| 678 connection, socket.Pass(), writer.Pass(), this, | 678 connection, socket.Pass(), writer.Pass(), this, |
| 679 quic_crypto_client_stream_factory_, host_port_pair.host(), | 679 quic_crypto_client_stream_factory_, host_port_pair.host(), |
| 680 config, crypto_config, net_log.net_log()); | 680 host_port_pair.port(), config, crypto_config, net_log.net_log()); |
| 681 all_sessions_.insert(*session); // owning pointer | 681 all_sessions_.insert(*session); // owning pointer |
| 682 if (is_https) { | 682 if (is_https) { |
| 683 crypto_config->SetProofVerifier( | 683 crypto_config->SetProofVerifier( |
| 684 new ProofVerifierChromium(cert_verifier, net_log)); | 684 new ProofVerifierChromium(cert_verifier, net_log)); |
| 685 } | 685 } |
| 686 return OK; | 686 return OK; |
| 687 } | 687 } |
| 688 | 688 |
| 689 bool QuicStreamFactory::HasActiveJob(const SessionKey& key) const { | 689 bool QuicStreamFactory::HasActiveJob(const SessionKey& key) const { |
| 690 return ContainsKey(active_jobs_, key); | 690 return ContainsKey(active_jobs_, key); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 709 if (ContainsKey(all_crypto_configs_, session_key)) { | 709 if (ContainsKey(all_crypto_configs_, session_key)) { |
| 710 crypto_config = all_crypto_configs_[session_key]; | 710 crypto_config = all_crypto_configs_[session_key]; |
| 711 DCHECK(crypto_config); | 711 DCHECK(crypto_config); |
| 712 } else { | 712 } else { |
| 713 // TODO(rtenneti): if two quic_sessions for the same host_port_pair | 713 // TODO(rtenneti): if two quic_sessions for the same host_port_pair |
| 714 // share the same crypto_config, will it cause issues? | 714 // share the same crypto_config, will it cause issues? |
| 715 crypto_config = new QuicCryptoClientConfig(); | 715 crypto_config = new QuicCryptoClientConfig(); |
| 716 if (quic_server_info_factory_) { | 716 if (quic_server_info_factory_) { |
| 717 QuicCryptoClientConfig::CachedState* cached = | 717 QuicCryptoClientConfig::CachedState* cached = |
| 718 crypto_config->Create(session_key.host_port_pair.host(), | 718 crypto_config->Create(session_key.host_port_pair.host(), |
| 719 session_key.host_port_pair.port(), |
| 719 quic_server_info_factory_); | 720 quic_server_info_factory_); |
| 720 DCHECK(cached); | 721 DCHECK(cached); |
| 721 } | 722 } |
| 722 crypto_config->SetDefaults(); | 723 crypto_config->SetDefaults(); |
| 723 all_crypto_configs_[session_key] = crypto_config; | 724 all_crypto_configs_[session_key] = crypto_config; |
| 724 PopulateFromCanonicalConfig(session_key, crypto_config); | 725 PopulateFromCanonicalConfig(session_key, crypto_config); |
| 725 } | 726 } |
| 726 return crypto_config; | 727 return crypto_config; |
| 727 } | 728 } |
| 728 | 729 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 754 canonical_hostname_to_origin_map_[suffix_session_key]; | 755 canonical_hostname_to_origin_map_[suffix_session_key]; |
| 755 QuicCryptoClientConfig* canonical_crypto_config = | 756 QuicCryptoClientConfig* canonical_crypto_config = |
| 756 all_crypto_configs_[canonical_session_key]; | 757 all_crypto_configs_[canonical_session_key]; |
| 757 DCHECK(canonical_crypto_config); | 758 DCHECK(canonical_crypto_config); |
| 758 const HostPortPair& canonical_host_port_pair = | 759 const HostPortPair& canonical_host_port_pair = |
| 759 canonical_session_key.host_port_pair; | 760 canonical_session_key.host_port_pair; |
| 760 | 761 |
| 761 // Copy the CachedState for the canonical server from canonical_crypto_config | 762 // Copy the CachedState for the canonical server from canonical_crypto_config |
| 762 // as the initial CachedState for the server_hostname in crypto_config. | 763 // as the initial CachedState for the server_hostname in crypto_config. |
| 763 crypto_config->InitializeFrom(server_hostname, | 764 crypto_config->InitializeFrom(server_hostname, |
| 765 server_port, |
| 764 canonical_host_port_pair.host(), | 766 canonical_host_port_pair.host(), |
| 767 canonical_host_port_pair.port(), |
| 765 canonical_crypto_config); | 768 canonical_crypto_config); |
| 766 // Update canonical version to point at the "most recent" crypto_config. | 769 // Update canonical version to point at the "most recent" crypto_config. |
| 767 canonical_hostname_to_origin_map_[suffix_session_key] = | 770 canonical_hostname_to_origin_map_[suffix_session_key] = |
| 768 canonical_session_key; | 771 canonical_session_key; |
| 769 } | 772 } |
| 770 | 773 |
| 771 } // namespace net | 774 } // namespace net |
| OLD | NEW |