Chromium Code Reviews| 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/chromium/quic_stream_factory.h" | 5 #include "net/quic/chromium/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
| 14 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
| 15 #include "base/metrics/sparse_histogram.h" | 15 #include "base/metrics/sparse_histogram.h" |
| 16 #include "base/rand_util.h" | 16 #include "base/rand_util.h" |
| 17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
| 19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 22 #include "base/threading/thread_task_runner_handle.h" | 22 #include "base/threading/thread_task_runner_handle.h" |
| 23 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
| 24 #include "base/values.h" | 24 #include "base/values.h" |
| 25 #include "crypto/openssl_util.h" | 25 #include "crypto/openssl_util.h" |
| 26 #include "net/base/ip_address.h" | 26 #include "net/base/ip_address.h" |
| 27 #include "net/base/net_errors.h" | 27 #include "net/base/net_errors.h" |
| 28 #include "net/base/proxy_delegate.h" | |
| 28 #include "net/cert/cert_verifier.h" | 29 #include "net/cert/cert_verifier.h" |
| 29 #include "net/cert/ct_verifier.h" | 30 #include "net/cert/ct_verifier.h" |
| 30 #include "net/dns/host_resolver.h" | 31 #include "net/dns/host_resolver.h" |
| 31 #include "net/http/bidirectional_stream_impl.h" | 32 #include "net/http/bidirectional_stream_impl.h" |
| 32 #include "net/log/net_log_capture_mode.h" | 33 #include "net/log/net_log_capture_mode.h" |
| 33 #include "net/log/net_log_event_type.h" | 34 #include "net/log/net_log_event_type.h" |
| 34 #include "net/log/net_log_source_type.h" | 35 #include "net/log/net_log_source_type.h" |
| 35 #include "net/quic/chromium/bidirectional_stream_quic_impl.h" | 36 #include "net/quic/chromium/bidirectional_stream_quic_impl.h" |
| 36 #include "net/quic/chromium/crypto/channel_id_chromium.h" | 37 #include "net/quic/chromium/crypto/channel_id_chromium.h" |
| 37 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" | 38 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 697 return nullptr; | 698 return nullptr; |
| 698 return base::MakeUnique<BidirectionalStreamQuicImpl>(session_); | 699 return base::MakeUnique<BidirectionalStreamQuicImpl>(session_); |
| 699 } | 700 } |
| 700 | 701 |
| 701 QuicStreamFactory::QuicStreamFactory( | 702 QuicStreamFactory::QuicStreamFactory( |
| 702 NetLog* net_log, | 703 NetLog* net_log, |
| 703 HostResolver* host_resolver, | 704 HostResolver* host_resolver, |
| 704 SSLConfigService* ssl_config_service, | 705 SSLConfigService* ssl_config_service, |
| 705 ClientSocketFactory* client_socket_factory, | 706 ClientSocketFactory* client_socket_factory, |
| 706 HttpServerProperties* http_server_properties, | 707 HttpServerProperties* http_server_properties, |
| 708 ProxyDelegate* proxy_delegate, | |
| 707 CertVerifier* cert_verifier, | 709 CertVerifier* cert_verifier, |
| 708 CTPolicyEnforcer* ct_policy_enforcer, | 710 CTPolicyEnforcer* ct_policy_enforcer, |
| 709 ChannelIDService* channel_id_service, | 711 ChannelIDService* channel_id_service, |
| 710 TransportSecurityState* transport_security_state, | 712 TransportSecurityState* transport_security_state, |
| 711 CTVerifier* cert_transparency_verifier, | 713 CTVerifier* cert_transparency_verifier, |
| 712 SocketPerformanceWatcherFactory* socket_performance_watcher_factory, | 714 SocketPerformanceWatcherFactory* socket_performance_watcher_factory, |
| 713 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, | 715 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, |
| 714 QuicRandom* random_generator, | 716 QuicRandom* random_generator, |
| 715 QuicClock* clock, | 717 QuicClock* clock, |
| 716 size_t max_packet_length, | 718 size_t max_packet_length, |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 738 bool force_hol_blocking, | 740 bool force_hol_blocking, |
| 739 bool race_cert_verification, | 741 bool race_cert_verification, |
| 740 bool quic_do_not_fragment, | 742 bool quic_do_not_fragment, |
| 741 const QuicTagVector& connection_options, | 743 const QuicTagVector& connection_options, |
| 742 bool enable_token_binding) | 744 bool enable_token_binding) |
| 743 : require_confirmation_(true), | 745 : require_confirmation_(true), |
| 744 net_log_(net_log), | 746 net_log_(net_log), |
| 745 host_resolver_(host_resolver), | 747 host_resolver_(host_resolver), |
| 746 client_socket_factory_(client_socket_factory), | 748 client_socket_factory_(client_socket_factory), |
| 747 http_server_properties_(http_server_properties), | 749 http_server_properties_(http_server_properties), |
| 750 proxy_delegate_(proxy_delegate), | |
| 748 transport_security_state_(transport_security_state), | 751 transport_security_state_(transport_security_state), |
| 749 cert_transparency_verifier_(cert_transparency_verifier), | 752 cert_transparency_verifier_(cert_transparency_verifier), |
| 750 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 753 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
| 751 random_generator_(random_generator), | 754 random_generator_(random_generator), |
| 752 clock_(clock), | 755 clock_(clock), |
| 753 max_packet_length_(max_packet_length), | 756 max_packet_length_(max_packet_length), |
| 754 socket_performance_watcher_factory_(socket_performance_watcher_factory), | 757 socket_performance_watcher_factory_(socket_performance_watcher_factory), |
| 755 config_(InitializeQuicConfig(connection_options, | 758 config_(InitializeQuicConfig(connection_options, |
| 756 idle_connection_timeout_seconds)), | 759 idle_connection_timeout_seconds)), |
| 757 crypto_config_(base::WrapUnique( | 760 crypto_config_(base::WrapUnique( |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1814 | 1817 |
| 1815 void QuicStreamFactory::MaybeInitialize() { | 1818 void QuicStreamFactory::MaybeInitialize() { |
| 1816 // We don't initialize data from HttpServerProperties in the constructor | 1819 // We don't initialize data from HttpServerProperties in the constructor |
| 1817 // because HttpServerProperties has not yet initialized. We're guaranteed | 1820 // because HttpServerProperties has not yet initialized. We're guaranteed |
| 1818 // HttpServerProperties has been initialized by the first time a request is | 1821 // HttpServerProperties has been initialized by the first time a request is |
| 1819 // made. | 1822 // made. |
| 1820 if (has_initialized_data_) | 1823 if (has_initialized_data_) |
| 1821 return; | 1824 return; |
| 1822 | 1825 |
| 1823 has_initialized_data_ = true; | 1826 has_initialized_data_ = true; |
| 1827 | |
| 1828 // Query the proxy delegate, and add the proxy server that supports QUIC. | |
| 1829 if (proxy_delegate_ && | |
| 1830 proxy_delegate_->GetQuicSupportedProxyServerAtStartUp().is_quic()) { | |
|
RyanSturm
2016/10/21 22:35:10
Can you only call GetQuicSupportedServerAtStartUp
| |
| 1831 quic_supported_servers_at_startup_.insert( | |
| 1832 proxy_delegate_->GetQuicSupportedProxyServerAtStartUp() | |
| 1833 .host_port_pair()); | |
| 1834 } | |
| 1835 | |
| 1824 for (const std::pair<const url::SchemeHostPort, AlternativeServiceInfoVector>& | 1836 for (const std::pair<const url::SchemeHostPort, AlternativeServiceInfoVector>& |
| 1825 key_value : http_server_properties_->alternative_service_map()) { | 1837 key_value : http_server_properties_->alternative_service_map()) { |
| 1826 HostPortPair host_port_pair(key_value.first.host(), key_value.first.port()); | 1838 HostPortPair host_port_pair(key_value.first.host(), key_value.first.port()); |
| 1827 for (const AlternativeServiceInfo& alternative_service_info : | 1839 for (const AlternativeServiceInfo& alternative_service_info : |
| 1828 key_value.second) { | 1840 key_value.second) { |
| 1829 if (alternative_service_info.alternative_service.protocol == QUIC) { | 1841 if (alternative_service_info.alternative_service.protocol == QUIC) { |
| 1830 quic_supported_servers_at_startup_.insert(host_port_pair); | 1842 quic_supported_servers_at_startup_.insert(host_port_pair); |
| 1831 break; | 1843 break; |
| 1832 } | 1844 } |
| 1833 } | 1845 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1902 void QuicStreamFactory::OpenFactory() { | 1914 void QuicStreamFactory::OpenFactory() { |
| 1903 status_ = OPEN; | 1915 status_ = OPEN; |
| 1904 } | 1916 } |
| 1905 | 1917 |
| 1906 void QuicStreamFactory::MaybeClearConsecutiveDisabledCount() { | 1918 void QuicStreamFactory::MaybeClearConsecutiveDisabledCount() { |
| 1907 if (status_ == OPEN) | 1919 if (status_ == OPEN) |
| 1908 consecutive_disabled_count_ = 0; | 1920 consecutive_disabled_count_ = 0; |
| 1909 } | 1921 } |
| 1910 | 1922 |
| 1911 } // namespace net | 1923 } // namespace net |
| OLD | NEW |