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