| 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 19 matching lines...) Expand all Loading... |
| 30 #include "net/quic/quic_clock.h" | 30 #include "net/quic/quic_clock.h" |
| 31 #include "net/quic/quic_connection.h" | 31 #include "net/quic/quic_connection.h" |
| 32 #include "net/quic/quic_connection_helper.h" | 32 #include "net/quic/quic_connection_helper.h" |
| 33 #include "net/quic/quic_crypto_client_stream_factory.h" | 33 #include "net/quic/quic_crypto_client_stream_factory.h" |
| 34 #include "net/quic/quic_default_packet_writer.h" | 34 #include "net/quic/quic_default_packet_writer.h" |
| 35 #include "net/quic/quic_flags.h" | 35 #include "net/quic/quic_flags.h" |
| 36 #include "net/quic/quic_http_stream.h" | 36 #include "net/quic/quic_http_stream.h" |
| 37 #include "net/quic/quic_protocol.h" | 37 #include "net/quic/quic_protocol.h" |
| 38 #include "net/quic/quic_server_id.h" | 38 #include "net/quic/quic_server_id.h" |
| 39 #include "net/socket/client_socket_factory.h" | 39 #include "net/socket/client_socket_factory.h" |
| 40 #include "net/udp/udp_client_socket.h" |
| 40 | 41 |
| 41 #if defined(OS_WIN) | 42 #if defined(OS_WIN) |
| 42 #include "base/win/windows_version.h" | 43 #include "base/win/windows_version.h" |
| 43 #endif | 44 #endif |
| 44 | 45 |
| 45 namespace net { | 46 namespace net { |
| 46 | 47 |
| 47 namespace { | 48 namespace { |
| 48 | 49 |
| 49 enum CreateSessionFailure { | 50 enum CreateSessionFailure { |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 size_t max_packet_length, | 590 size_t max_packet_length, |
| 590 const std::string& user_agent_id, | 591 const std::string& user_agent_id, |
| 591 const QuicVersionVector& supported_versions, | 592 const QuicVersionVector& supported_versions, |
| 592 bool enable_port_selection, | 593 bool enable_port_selection, |
| 593 bool always_require_handshake_confirmation, | 594 bool always_require_handshake_confirmation, |
| 594 bool disable_connection_pooling, | 595 bool disable_connection_pooling, |
| 595 int load_server_info_timeout, | 596 int load_server_info_timeout, |
| 596 float load_server_info_timeout_srtt_multiplier, | 597 float load_server_info_timeout_srtt_multiplier, |
| 597 bool enable_truncated_connection_ids, | 598 bool enable_truncated_connection_ids, |
| 598 bool enable_connection_racing, | 599 bool enable_connection_racing, |
| 600 bool enable_nonblocking_io, |
| 599 bool disable_disk_cache, | 601 bool disable_disk_cache, |
| 600 const QuicTagVector& connection_options) | 602 const QuicTagVector& connection_options) |
| 601 : require_confirmation_(true), | 603 : require_confirmation_(true), |
| 602 host_resolver_(host_resolver), | 604 host_resolver_(host_resolver), |
| 603 client_socket_factory_(client_socket_factory), | 605 client_socket_factory_(client_socket_factory), |
| 604 http_server_properties_(http_server_properties), | 606 http_server_properties_(http_server_properties), |
| 605 transport_security_state_(transport_security_state), | 607 transport_security_state_(transport_security_state), |
| 606 quic_server_info_factory_(nullptr), | 608 quic_server_info_factory_(nullptr), |
| 607 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 609 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
| 608 random_generator_(random_generator), | 610 random_generator_(random_generator), |
| 609 clock_(clock), | 611 clock_(clock), |
| 610 max_packet_length_(max_packet_length), | 612 max_packet_length_(max_packet_length), |
| 611 config_(InitializeQuicConfig(connection_options)), | 613 config_(InitializeQuicConfig(connection_options)), |
| 612 supported_versions_(supported_versions), | 614 supported_versions_(supported_versions), |
| 613 enable_port_selection_(enable_port_selection), | 615 enable_port_selection_(enable_port_selection), |
| 614 always_require_handshake_confirmation_( | 616 always_require_handshake_confirmation_( |
| 615 always_require_handshake_confirmation), | 617 always_require_handshake_confirmation), |
| 616 disable_connection_pooling_(disable_connection_pooling), | 618 disable_connection_pooling_(disable_connection_pooling), |
| 617 load_server_info_timeout_ms_(load_server_info_timeout), | 619 load_server_info_timeout_ms_(load_server_info_timeout), |
| 618 load_server_info_timeout_srtt_multiplier_( | 620 load_server_info_timeout_srtt_multiplier_( |
| 619 load_server_info_timeout_srtt_multiplier), | 621 load_server_info_timeout_srtt_multiplier), |
| 620 enable_truncated_connection_ids_(enable_truncated_connection_ids), | 622 enable_truncated_connection_ids_(enable_truncated_connection_ids), |
| 621 enable_connection_racing_(enable_connection_racing), | 623 enable_connection_racing_(enable_connection_racing), |
| 624 enable_nonblocking_io_(enable_nonblocking_io), |
| 622 disable_disk_cache_(disable_disk_cache), | 625 disable_disk_cache_(disable_disk_cache), |
| 623 port_seed_(random_generator_->RandUint64()), | 626 port_seed_(random_generator_->RandUint64()), |
| 624 check_persisted_supports_quic_(true), | 627 check_persisted_supports_quic_(true), |
| 625 task_runner_(nullptr), | 628 task_runner_(nullptr), |
| 626 weak_factory_(this) { | 629 weak_factory_(this) { |
| 627 DCHECK(transport_security_state_); | 630 DCHECK(transport_security_state_); |
| 628 crypto_config_.set_user_agent_id(user_agent_id); | 631 crypto_config_.set_user_agent_id(user_agent_id); |
| 629 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); | 632 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); |
| 630 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); | 633 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); |
| 631 crypto_config_.SetProofVerifier( | 634 crypto_config_.SetProofVerifier( |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 new PortSuggester(server_id.host_port_pair(), port_seed_); | 1008 new PortSuggester(server_id.host_port_pair(), port_seed_); |
| 1006 DatagramSocket::BindType bind_type = enable_port_selection ? | 1009 DatagramSocket::BindType bind_type = enable_port_selection ? |
| 1007 DatagramSocket::RANDOM_BIND : // Use our callback. | 1010 DatagramSocket::RANDOM_BIND : // Use our callback. |
| 1008 DatagramSocket::DEFAULT_BIND; // Use OS to randomize. | 1011 DatagramSocket::DEFAULT_BIND; // Use OS to randomize. |
| 1009 scoped_ptr<DatagramClientSocket> socket( | 1012 scoped_ptr<DatagramClientSocket> socket( |
| 1010 client_socket_factory_->CreateDatagramClientSocket( | 1013 client_socket_factory_->CreateDatagramClientSocket( |
| 1011 bind_type, | 1014 bind_type, |
| 1012 base::Bind(&PortSuggester::SuggestPort, port_suggester), | 1015 base::Bind(&PortSuggester::SuggestPort, port_suggester), |
| 1013 net_log.net_log(), net_log.source())); | 1016 net_log.net_log(), net_log.source())); |
| 1014 | 1017 |
| 1018 if (enable_nonblocking_io_ && |
| 1019 client_socket_factory_ == ClientSocketFactory::GetDefaultFactory()) { |
| 1020 #if defined(OS_WIN) |
| 1021 static_cast<UDPClientSocket*>(socket.get())->UseNonBlockingIO(); |
| 1022 #endif |
| 1023 } |
| 1024 |
| 1015 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. | 1025 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 1016 tracked_objects::ScopedTracker tracking_profile2( | 1026 tracked_objects::ScopedTracker tracking_profile2( |
| 1017 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 1027 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1018 "422516 QuicStreamFactory::CreateSession2")); | 1028 "422516 QuicStreamFactory::CreateSession2")); |
| 1019 | 1029 |
| 1020 int rv = socket->Connect(addr); | 1030 int rv = socket->Connect(addr); |
| 1021 | 1031 |
| 1022 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. | 1032 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 1023 tracked_objects::ScopedTracker tracking_profile3( | 1033 tracked_objects::ScopedTracker tracking_profile3( |
| 1024 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 1034 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 http_server_properties_->ClearAlternateProtocol(server); | 1353 http_server_properties_->ClearAlternateProtocol(server); |
| 1344 http_server_properties_->SetAlternateProtocol( | 1354 http_server_properties_->SetAlternateProtocol( |
| 1345 server, alternate.port, alternate.protocol, 1); | 1355 server, alternate.port, alternate.protocol, 1); |
| 1346 DCHECK_EQ(QUIC, | 1356 DCHECK_EQ(QUIC, |
| 1347 http_server_properties_->GetAlternateProtocol(server).protocol); | 1357 http_server_properties_->GetAlternateProtocol(server).protocol); |
| 1348 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 1358 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
| 1349 server)); | 1359 server)); |
| 1350 } | 1360 } |
| 1351 | 1361 |
| 1352 } // namespace net | 1362 } // namespace net |
| OLD | NEW |