| 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, | 558 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, |
| 559 QuicRandom* random_generator, | 559 QuicRandom* random_generator, |
| 560 QuicClock* clock, | 560 QuicClock* clock, |
| 561 size_t max_packet_length, | 561 size_t max_packet_length, |
| 562 const std::string& user_agent_id, | 562 const std::string& user_agent_id, |
| 563 const QuicVersionVector& supported_versions, | 563 const QuicVersionVector& supported_versions, |
| 564 bool enable_port_selection, | 564 bool enable_port_selection, |
| 565 bool always_require_handshake_confirmation, | 565 bool always_require_handshake_confirmation, |
| 566 bool disable_connection_pooling, | 566 bool disable_connection_pooling, |
| 567 int load_server_info_timeout, | 567 int load_server_info_timeout, |
| 568 bool disable_loading_server_info_for_new_servers, |
| 568 float load_server_info_timeout_srtt_multiplier, | 569 float load_server_info_timeout_srtt_multiplier, |
| 569 bool enable_truncated_connection_ids, | 570 bool enable_truncated_connection_ids, |
| 570 const QuicTagVector& connection_options) | 571 const QuicTagVector& connection_options) |
| 571 : require_confirmation_(true), | 572 : require_confirmation_(true), |
| 572 host_resolver_(host_resolver), | 573 host_resolver_(host_resolver), |
| 573 client_socket_factory_(client_socket_factory), | 574 client_socket_factory_(client_socket_factory), |
| 574 http_server_properties_(http_server_properties), | 575 http_server_properties_(http_server_properties), |
| 575 transport_security_state_(transport_security_state), | 576 transport_security_state_(transport_security_state), |
| 576 quic_server_info_factory_(nullptr), | 577 quic_server_info_factory_(nullptr), |
| 577 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 578 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
| 578 random_generator_(random_generator), | 579 random_generator_(random_generator), |
| 579 clock_(clock), | 580 clock_(clock), |
| 580 max_packet_length_(max_packet_length), | 581 max_packet_length_(max_packet_length), |
| 581 config_(InitializeQuicConfig(connection_options)), | 582 config_(InitializeQuicConfig(connection_options)), |
| 582 supported_versions_(supported_versions), | 583 supported_versions_(supported_versions), |
| 583 enable_port_selection_(enable_port_selection), | 584 enable_port_selection_(enable_port_selection), |
| 584 always_require_handshake_confirmation_( | 585 always_require_handshake_confirmation_( |
| 585 always_require_handshake_confirmation), | 586 always_require_handshake_confirmation), |
| 586 disable_connection_pooling_(disable_connection_pooling), | 587 disable_connection_pooling_(disable_connection_pooling), |
| 587 load_server_info_timeout_ms_(load_server_info_timeout), | 588 load_server_info_timeout_ms_(load_server_info_timeout), |
| 589 disable_loading_server_info_for_new_servers_( |
| 590 disable_loading_server_info_for_new_servers), |
| 588 load_server_info_timeout_srtt_multiplier_( | 591 load_server_info_timeout_srtt_multiplier_( |
| 589 load_server_info_timeout_srtt_multiplier), | 592 load_server_info_timeout_srtt_multiplier), |
| 590 enable_truncated_connection_ids_(enable_truncated_connection_ids), | 593 enable_truncated_connection_ids_(enable_truncated_connection_ids), |
| 591 port_seed_(random_generator_->RandUint64()), | 594 port_seed_(random_generator_->RandUint64()), |
| 592 check_persisted_supports_quic_(true), | 595 check_persisted_supports_quic_(true), |
| 593 task_runner_(nullptr), | 596 task_runner_(nullptr), |
| 594 weak_factory_(this) { | 597 weak_factory_(this) { |
| 595 DCHECK(transport_security_state_); | 598 DCHECK(transport_security_state_); |
| 596 crypto_config_.set_user_agent_id(user_agent_id); | 599 crypto_config_.set_user_agent_id(user_agent_id); |
| 597 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); | 600 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 if (HasActiveJob(server_id)) { | 645 if (HasActiveJob(server_id)) { |
| 643 Job* job = active_jobs_[server_id]; | 646 Job* job = active_jobs_[server_id]; |
| 644 active_requests_[request] = job; | 647 active_requests_[request] = job; |
| 645 job_requests_map_[job].insert(request); | 648 job_requests_map_[job].insert(request); |
| 646 return ERR_IO_PENDING; | 649 return ERR_IO_PENDING; |
| 647 } | 650 } |
| 648 | 651 |
| 649 QuicServerInfo* quic_server_info = nullptr; | 652 QuicServerInfo* quic_server_info = nullptr; |
| 650 if (quic_server_info_factory_) { | 653 if (quic_server_info_factory_) { |
| 651 bool load_from_disk_cache = true; | 654 bool load_from_disk_cache = true; |
| 652 if (http_server_properties_) { | 655 if (disable_loading_server_info_for_new_servers_) { |
| 653 const AlternateProtocolMap& alternate_protocol_map = | 656 const AlternateProtocolMap& alternate_protocol_map = |
| 654 http_server_properties_->alternate_protocol_map(); | 657 http_server_properties_->alternate_protocol_map(); |
| 655 AlternateProtocolMap::const_iterator it = | 658 AlternateProtocolMap::const_iterator it = |
| 656 alternate_protocol_map.Peek(server_id.host_port_pair()); | 659 alternate_protocol_map.Peek(server_id.host_port_pair()); |
| 657 if (it == alternate_protocol_map.end() || it->second.protocol != QUIC) { | 660 if (it == alternate_protocol_map.end() || it->second.protocol != QUIC) { |
| 658 // If there is no entry for QUIC, consider that as a new server and | 661 // If there is no entry for QUIC, consider that as a new server and |
| 659 // don't wait for Cache thread to load the data for that server. | 662 // don't wait for Cache thread to load the data for that server. |
| 660 load_from_disk_cache = false; | 663 load_from_disk_cache = false; |
| 661 } | 664 } |
| 662 } | 665 } |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 http_server_properties_->ClearAlternateProtocol(server); | 1273 http_server_properties_->ClearAlternateProtocol(server); |
| 1271 http_server_properties_->SetAlternateProtocol( | 1274 http_server_properties_->SetAlternateProtocol( |
| 1272 server, alternate.port, alternate.protocol, 1); | 1275 server, alternate.port, alternate.protocol, 1); |
| 1273 DCHECK_EQ(QUIC, | 1276 DCHECK_EQ(QUIC, |
| 1274 http_server_properties_->GetAlternateProtocol(server).protocol); | 1277 http_server_properties_->GetAlternateProtocol(server).protocol); |
| 1275 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 1278 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
| 1276 server)); | 1279 server)); |
| 1277 } | 1280 } |
| 1278 | 1281 |
| 1279 } // namespace net | 1282 } // namespace net |
| OLD | NEW |