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/cpu.h" | 9 #include "base/cpu.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 size_t max_packet_length, | 459 size_t max_packet_length, |
460 const std::string& user_agent_id, | 460 const std::string& user_agent_id, |
461 const QuicVersionVector& supported_versions, | 461 const QuicVersionVector& supported_versions, |
462 bool enable_port_selection, | 462 bool enable_port_selection, |
463 bool enable_time_based_loss_detection, | 463 bool enable_time_based_loss_detection, |
464 const QuicTagVector& connection_options) | 464 const QuicTagVector& connection_options) |
465 : require_confirmation_(true), | 465 : require_confirmation_(true), |
466 host_resolver_(host_resolver), | 466 host_resolver_(host_resolver), |
467 client_socket_factory_(client_socket_factory), | 467 client_socket_factory_(client_socket_factory), |
468 http_server_properties_(http_server_properties), | 468 http_server_properties_(http_server_properties), |
| 469 transport_security_state_(transport_security_state), |
469 quic_server_info_factory_(NULL), | 470 quic_server_info_factory_(NULL), |
470 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 471 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
471 random_generator_(random_generator), | 472 random_generator_(random_generator), |
472 clock_(clock), | 473 clock_(clock), |
473 max_packet_length_(max_packet_length), | 474 max_packet_length_(max_packet_length), |
474 config_(InitializeQuicConfig(enable_time_based_loss_detection, | 475 config_(InitializeQuicConfig(enable_time_based_loss_detection, |
475 connection_options)), | 476 connection_options)), |
476 supported_versions_(supported_versions), | 477 supported_versions_(supported_versions), |
477 enable_port_selection_(enable_port_selection), | 478 enable_port_selection_(enable_port_selection), |
478 port_seed_(random_generator_->RandUint64()), | 479 port_seed_(random_generator_->RandUint64()), |
479 weak_factory_(this) { | 480 weak_factory_(this) { |
| 481 DCHECK(transport_security_state_); |
480 crypto_config_.SetDefaults(); | 482 crypto_config_.SetDefaults(); |
481 crypto_config_.set_user_agent_id(user_agent_id); | 483 crypto_config_.set_user_agent_id(user_agent_id); |
482 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); | 484 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); |
483 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); | 485 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); |
484 crypto_config_.SetProofVerifier( | 486 crypto_config_.SetProofVerifier( |
485 new ProofVerifierChromium(cert_verifier, transport_security_state)); | 487 new ProofVerifierChromium(cert_verifier, transport_security_state)); |
486 crypto_config_.SetChannelIDSource( | 488 crypto_config_.SetChannelIDSource( |
487 new ChannelIDSourceChromium(channel_id_service)); | 489 new ChannelIDSourceChromium(channel_id_service)); |
488 base::CPU cpu; | 490 base::CPU cpu; |
489 if (cpu.has_aesni() && cpu.has_avx()) | 491 if (cpu.has_aesni() && cpu.has_avx()) |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 const HttpServerProperties::NetworkStats* stats = | 852 const HttpServerProperties::NetworkStats* stats = |
851 http_server_properties_->GetServerNetworkStats( | 853 http_server_properties_->GetServerNetworkStats( |
852 server_id.host_port_pair()); | 854 server_id.host_port_pair()); |
853 if (stats != NULL) { | 855 if (stats != NULL) { |
854 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); | 856 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); |
855 } | 857 } |
856 } | 858 } |
857 | 859 |
858 *session = new QuicClientSession( | 860 *session = new QuicClientSession( |
859 connection, socket.Pass(), writer.Pass(), this, | 861 connection, socket.Pass(), writer.Pass(), this, |
860 quic_crypto_client_stream_factory_, server_info.Pass(), server_id, | 862 quic_crypto_client_stream_factory_, transport_security_state_, |
861 config, &crypto_config_, | 863 server_info.Pass(), server_id, config, &crypto_config_, |
862 base::MessageLoop::current()->message_loop_proxy().get(), | 864 base::MessageLoop::current()->message_loop_proxy().get(), |
863 net_log.net_log()); | 865 net_log.net_log()); |
864 (*session)->InitializeSession(); | 866 (*session)->InitializeSession(); |
865 all_sessions_[*session] = server_id; // owning pointer | 867 all_sessions_[*session] = server_id; // owning pointer |
866 return OK; | 868 return OK; |
867 } | 869 } |
868 | 870 |
869 bool QuicStreamFactory::HasActiveJob(const QuicServerId& key) const { | 871 bool QuicStreamFactory::HasActiveJob(const QuicServerId& key) const { |
870 return ContainsKey(active_jobs_, key); | 872 return ContainsKey(active_jobs_, key); |
871 } | 873 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 http_server_properties_->ClearAlternateProtocol(server); | 958 http_server_properties_->ClearAlternateProtocol(server); |
957 http_server_properties_->SetAlternateProtocol( | 959 http_server_properties_->SetAlternateProtocol( |
958 server, alternate.port, alternate.protocol, 1); | 960 server, alternate.port, alternate.protocol, 1); |
959 DCHECK_EQ(QUIC, | 961 DCHECK_EQ(QUIC, |
960 http_server_properties_->GetAlternateProtocol(server).protocol); | 962 http_server_properties_->GetAlternateProtocol(server).protocol); |
961 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 963 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
962 server)); | 964 server)); |
963 } | 965 } |
964 | 966 |
965 } // namespace net | 967 } // namespace net |
OLD | NEW |