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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 scoped_ptr<QuicHttpStream> QuicStreamRequest::ReleaseStream() { | 444 scoped_ptr<QuicHttpStream> QuicStreamRequest::ReleaseStream() { |
444 DCHECK(stream_); | 445 DCHECK(stream_); |
445 return stream_.Pass(); | 446 return stream_.Pass(); |
446 } | 447 } |
447 | 448 |
448 QuicStreamFactory::QuicStreamFactory( | 449 QuicStreamFactory::QuicStreamFactory( |
449 HostResolver* host_resolver, | 450 HostResolver* host_resolver, |
450 ClientSocketFactory* client_socket_factory, | 451 ClientSocketFactory* client_socket_factory, |
451 base::WeakPtr<HttpServerProperties> http_server_properties, | 452 base::WeakPtr<HttpServerProperties> http_server_properties, |
452 CertVerifier* cert_verifier, | 453 CertVerifier* cert_verifier, |
| 454 ServerBoundCertService* server_bound_cert_service, |
453 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, | 455 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, |
454 QuicRandom* random_generator, | 456 QuicRandom* random_generator, |
455 QuicClock* clock, | 457 QuicClock* clock, |
456 size_t max_packet_length, | 458 size_t max_packet_length, |
457 const std::string& user_agent_id, | 459 const std::string& user_agent_id, |
458 const QuicVersionVector& supported_versions, | 460 const QuicVersionVector& supported_versions, |
459 bool enable_port_selection, | 461 bool enable_port_selection, |
460 bool enable_pacing, | 462 bool enable_pacing, |
461 bool enable_time_based_loss_detection) | 463 bool enable_time_based_loss_detection) |
462 : require_confirmation_(true), | 464 : require_confirmation_(true), |
463 host_resolver_(host_resolver), | 465 host_resolver_(host_resolver), |
464 client_socket_factory_(client_socket_factory), | 466 client_socket_factory_(client_socket_factory), |
465 http_server_properties_(http_server_properties), | 467 http_server_properties_(http_server_properties), |
466 cert_verifier_(cert_verifier), | |
467 quic_server_info_factory_(NULL), | 468 quic_server_info_factory_(NULL), |
468 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 469 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
469 random_generator_(random_generator), | 470 random_generator_(random_generator), |
470 clock_(clock), | 471 clock_(clock), |
471 max_packet_length_(max_packet_length), | 472 max_packet_length_(max_packet_length), |
472 config_(InitializeQuicConfig(enable_pacing, | 473 config_(InitializeQuicConfig(enable_pacing, |
473 enable_time_based_loss_detection)), | 474 enable_time_based_loss_detection)), |
474 supported_versions_(supported_versions), | 475 supported_versions_(supported_versions), |
475 enable_port_selection_(enable_port_selection), | 476 enable_port_selection_(enable_port_selection), |
476 port_seed_(random_generator_->RandUint64()), | 477 port_seed_(random_generator_->RandUint64()), |
477 weak_factory_(this) { | 478 weak_factory_(this) { |
478 crypto_config_.SetDefaults(); | 479 crypto_config_.SetDefaults(); |
479 crypto_config_.set_user_agent_id(user_agent_id); | 480 crypto_config_.set_user_agent_id(user_agent_id); |
480 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); | 481 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); |
481 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); | 482 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); |
482 crypto_config_.SetProofVerifier(new ProofVerifierChromium(cert_verifier)); | 483 crypto_config_.SetProofVerifier(new ProofVerifierChromium(cert_verifier)); |
| 484 crypto_config_.SetChannelIDSource( |
| 485 new ChannelIDSourceChromium(server_bound_cert_service)); |
483 base::CPU cpu; | 486 base::CPU cpu; |
484 if (cpu.has_aesni() && cpu.has_avx()) | 487 if (cpu.has_aesni() && cpu.has_avx()) |
485 crypto_config_.PreferAesGcm(); | 488 crypto_config_.PreferAesGcm(); |
486 if (!IsEcdsaSupported()) | 489 if (!IsEcdsaSupported()) |
487 crypto_config_.DisableEcdsa(); | 490 crypto_config_.DisableEcdsa(); |
488 } | 491 } |
489 | 492 |
490 QuicStreamFactory::~QuicStreamFactory() { | 493 QuicStreamFactory::~QuicStreamFactory() { |
491 CloseAllSessions(ERR_ABORTED); | 494 CloseAllSessions(ERR_ABORTED); |
492 while (!all_sessions_.empty()) { | 495 while (!all_sessions_.empty()) { |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 http_server_properties_->ClearAlternateProtocol(server); | 949 http_server_properties_->ClearAlternateProtocol(server); |
947 http_server_properties_->SetAlternateProtocol( | 950 http_server_properties_->SetAlternateProtocol( |
948 server, alternate.port, alternate.protocol); | 951 server, alternate.port, alternate.protocol); |
949 DCHECK_EQ(QUIC, | 952 DCHECK_EQ(QUIC, |
950 http_server_properties_->GetAlternateProtocol(server).protocol); | 953 http_server_properties_->GetAlternateProtocol(server).protocol); |
951 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 954 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
952 server)); | 955 server)); |
953 } | 956 } |
954 | 957 |
955 } // namespace net | 958 } // namespace net |
OLD | NEW |