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" |
11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
18 #include "net/cert/cert_verifier.h" | 18 #include "net/cert/cert_verifier.h" |
19 #include "net/dns/host_resolver.h" | 19 #include "net/dns/host_resolver.h" |
20 #include "net/dns/single_request_host_resolver.h" | 20 #include "net/dns/single_request_host_resolver.h" |
21 #include "net/http/http_server_properties.h" | 21 #include "net/http/http_server_properties.h" |
22 #include "net/quic/congestion_control/tcp_receiver.h" | 22 #include "net/quic/congestion_control/tcp_receiver.h" |
| 23 #include "net/quic/crypto/channel_id_chromium.h" |
23 #include "net/quic/crypto/proof_verifier_chromium.h" | 24 #include "net/quic/crypto/proof_verifier_chromium.h" |
24 #include "net/quic/crypto/quic_random.h" | 25 #include "net/quic/crypto/quic_random.h" |
25 #include "net/quic/crypto/quic_server_info.h" | 26 #include "net/quic/crypto/quic_server_info.h" |
26 #include "net/quic/port_suggester.h" | 27 #include "net/quic/port_suggester.h" |
27 #include "net/quic/quic_client_session.h" | 28 #include "net/quic/quic_client_session.h" |
28 #include "net/quic/quic_clock.h" | 29 #include "net/quic/quic_clock.h" |
29 #include "net/quic/quic_connection.h" | 30 #include "net/quic/quic_connection.h" |
30 #include "net/quic/quic_connection_helper.h" | 31 #include "net/quic/quic_connection_helper.h" |
31 #include "net/quic/quic_crypto_client_stream_factory.h" | 32 #include "net/quic/quic_crypto_client_stream_factory.h" |
32 #include "net/quic/quic_default_packet_writer.h" | 33 #include "net/quic/quic_default_packet_writer.h" |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 scoped_ptr<QuicHttpStream> QuicStreamRequest::ReleaseStream() { | 446 scoped_ptr<QuicHttpStream> QuicStreamRequest::ReleaseStream() { |
446 DCHECK(stream_); | 447 DCHECK(stream_); |
447 return stream_.Pass(); | 448 return stream_.Pass(); |
448 } | 449 } |
449 | 450 |
450 QuicStreamFactory::QuicStreamFactory( | 451 QuicStreamFactory::QuicStreamFactory( |
451 HostResolver* host_resolver, | 452 HostResolver* host_resolver, |
452 ClientSocketFactory* client_socket_factory, | 453 ClientSocketFactory* client_socket_factory, |
453 base::WeakPtr<HttpServerProperties> http_server_properties, | 454 base::WeakPtr<HttpServerProperties> http_server_properties, |
454 CertVerifier* cert_verifier, | 455 CertVerifier* cert_verifier, |
| 456 ServerBoundCertService* server_bound_cert_service, |
455 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, | 457 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, |
456 QuicRandom* random_generator, | 458 QuicRandom* random_generator, |
457 QuicClock* clock, | 459 QuicClock* clock, |
458 size_t max_packet_length, | 460 size_t max_packet_length, |
459 const std::string& user_agent_id, | 461 const std::string& user_agent_id, |
460 const QuicVersionVector& supported_versions, | 462 const QuicVersionVector& supported_versions, |
461 bool enable_port_selection, | 463 bool enable_port_selection, |
462 bool enable_pacing, | 464 bool enable_pacing, |
463 bool enable_time_based_loss_detection, | 465 bool enable_time_based_loss_detection, |
464 QuicTagVector connection_options) | 466 QuicTagVector connection_options) |
465 : require_confirmation_(true), | 467 : require_confirmation_(true), |
466 host_resolver_(host_resolver), | 468 host_resolver_(host_resolver), |
467 client_socket_factory_(client_socket_factory), | 469 client_socket_factory_(client_socket_factory), |
468 http_server_properties_(http_server_properties), | 470 http_server_properties_(http_server_properties), |
469 cert_verifier_(cert_verifier), | |
470 quic_server_info_factory_(NULL), | 471 quic_server_info_factory_(NULL), |
471 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 472 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
472 random_generator_(random_generator), | 473 random_generator_(random_generator), |
473 clock_(clock), | 474 clock_(clock), |
474 max_packet_length_(max_packet_length), | 475 max_packet_length_(max_packet_length), |
475 config_(InitializeQuicConfig(enable_pacing, | 476 config_(InitializeQuicConfig(enable_pacing, |
476 enable_time_based_loss_detection, | 477 enable_time_based_loss_detection, |
477 connection_options)), | 478 connection_options)), |
478 supported_versions_(supported_versions), | 479 supported_versions_(supported_versions), |
479 enable_port_selection_(enable_port_selection), | 480 enable_port_selection_(enable_port_selection), |
480 port_seed_(random_generator_->RandUint64()), | 481 port_seed_(random_generator_->RandUint64()), |
481 weak_factory_(this) { | 482 weak_factory_(this) { |
482 crypto_config_.SetDefaults(); | 483 crypto_config_.SetDefaults(); |
483 crypto_config_.set_user_agent_id(user_agent_id); | 484 crypto_config_.set_user_agent_id(user_agent_id); |
484 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); | 485 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); |
485 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); | 486 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); |
486 crypto_config_.SetProofVerifier(new ProofVerifierChromium(cert_verifier)); | 487 crypto_config_.SetProofVerifier(new ProofVerifierChromium(cert_verifier)); |
| 488 crypto_config_.SetChannelIDSource( |
| 489 new ChannelIDSourceChromium(server_bound_cert_service)); |
487 base::CPU cpu; | 490 base::CPU cpu; |
488 if (cpu.has_aesni() && cpu.has_avx()) | 491 if (cpu.has_aesni() && cpu.has_avx()) |
489 crypto_config_.PreferAesGcm(); | 492 crypto_config_.PreferAesGcm(); |
490 if (!IsEcdsaSupported()) | 493 if (!IsEcdsaSupported()) |
491 crypto_config_.DisableEcdsa(); | 494 crypto_config_.DisableEcdsa(); |
492 } | 495 } |
493 | 496 |
494 QuicStreamFactory::~QuicStreamFactory() { | 497 QuicStreamFactory::~QuicStreamFactory() { |
495 CloseAllSessions(ERR_ABORTED); | 498 CloseAllSessions(ERR_ABORTED); |
496 while (!all_sessions_.empty()) { | 499 while (!all_sessions_.empty()) { |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 http_server_properties_->ClearAlternateProtocol(server); | 953 http_server_properties_->ClearAlternateProtocol(server); |
951 http_server_properties_->SetAlternateProtocol( | 954 http_server_properties_->SetAlternateProtocol( |
952 server, alternate.port, alternate.protocol); | 955 server, alternate.port, alternate.protocol); |
953 DCHECK_EQ(QUIC, | 956 DCHECK_EQ(QUIC, |
954 http_server_properties_->GetAlternateProtocol(server).protocol); | 957 http_server_properties_->GetAlternateProtocol(server).protocol); |
955 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 958 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
956 server)); | 959 server)); |
957 } | 960 } |
958 | 961 |
959 } // namespace net | 962 } // namespace net |
OLD | NEW |