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