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 <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/cpu.h" | 10 #include "base/cpu.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 size_t max_packet_length, | 546 size_t max_packet_length, |
547 const std::string& user_agent_id, | 547 const std::string& user_agent_id, |
548 const QuicVersionVector& supported_versions, | 548 const QuicVersionVector& supported_versions, |
549 bool enable_port_selection, | 549 bool enable_port_selection, |
550 bool always_require_handshake_confirmation, | 550 bool always_require_handshake_confirmation, |
551 bool disable_connection_pooling, | 551 bool disable_connection_pooling, |
552 float load_server_info_timeout_srtt_multiplier, | 552 float load_server_info_timeout_srtt_multiplier, |
553 bool enable_connection_racing, | 553 bool enable_connection_racing, |
554 bool enable_non_blocking_io, | 554 bool enable_non_blocking_io, |
555 bool disable_disk_cache, | 555 bool disable_disk_cache, |
| 556 bool prefer_aes, |
556 int max_number_of_lossy_connections, | 557 int max_number_of_lossy_connections, |
557 float packet_loss_threshold, | 558 float packet_loss_threshold, |
558 int socket_receive_buffer_size, | 559 int socket_receive_buffer_size, |
559 const QuicTagVector& connection_options) | 560 const QuicTagVector& connection_options) |
560 : require_confirmation_(true), | 561 : require_confirmation_(true), |
561 host_resolver_(host_resolver), | 562 host_resolver_(host_resolver), |
562 client_socket_factory_(client_socket_factory), | 563 client_socket_factory_(client_socket_factory), |
563 http_server_properties_(http_server_properties), | 564 http_server_properties_(http_server_properties), |
564 transport_security_state_(transport_security_state), | 565 transport_security_state_(transport_security_state), |
565 quic_server_info_factory_(nullptr), | 566 quic_server_info_factory_(nullptr), |
566 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 567 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
567 random_generator_(random_generator), | 568 random_generator_(random_generator), |
568 clock_(clock), | 569 clock_(clock), |
569 max_packet_length_(max_packet_length), | 570 max_packet_length_(max_packet_length), |
570 config_(InitializeQuicConfig(connection_options)), | 571 config_(InitializeQuicConfig(connection_options)), |
571 supported_versions_(supported_versions), | 572 supported_versions_(supported_versions), |
572 enable_port_selection_(enable_port_selection), | 573 enable_port_selection_(enable_port_selection), |
573 always_require_handshake_confirmation_( | 574 always_require_handshake_confirmation_( |
574 always_require_handshake_confirmation), | 575 always_require_handshake_confirmation), |
575 disable_connection_pooling_(disable_connection_pooling), | 576 disable_connection_pooling_(disable_connection_pooling), |
576 load_server_info_timeout_srtt_multiplier_( | 577 load_server_info_timeout_srtt_multiplier_( |
577 load_server_info_timeout_srtt_multiplier), | 578 load_server_info_timeout_srtt_multiplier), |
578 enable_connection_racing_(enable_connection_racing), | 579 enable_connection_racing_(enable_connection_racing), |
579 enable_non_blocking_io_(enable_non_blocking_io), | 580 enable_non_blocking_io_(enable_non_blocking_io), |
580 disable_disk_cache_(disable_disk_cache), | 581 disable_disk_cache_(disable_disk_cache), |
| 582 prefer_aes_(prefer_aes), |
581 max_number_of_lossy_connections_(max_number_of_lossy_connections), | 583 max_number_of_lossy_connections_(max_number_of_lossy_connections), |
582 packet_loss_threshold_(packet_loss_threshold), | 584 packet_loss_threshold_(packet_loss_threshold), |
583 socket_receive_buffer_size_(socket_receive_buffer_size), | 585 socket_receive_buffer_size_(socket_receive_buffer_size), |
584 port_seed_(random_generator_->RandUint64()), | 586 port_seed_(random_generator_->RandUint64()), |
585 check_persisted_supports_quic_(true), | 587 check_persisted_supports_quic_(true), |
586 task_runner_(nullptr), | 588 task_runner_(nullptr), |
587 weak_factory_(this) { | 589 weak_factory_(this) { |
588 DCHECK(transport_security_state_); | 590 DCHECK(transport_security_state_); |
589 crypto_config_.set_user_agent_id(user_agent_id); | 591 crypto_config_.set_user_agent_id(user_agent_id); |
590 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); | 592 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); |
591 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); | 593 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); |
592 crypto_config_.AddCanonicalSuffix(".googleusercontent.com"); | 594 crypto_config_.AddCanonicalSuffix(".googleusercontent.com"); |
593 crypto_config_.SetProofVerifier( | 595 crypto_config_.SetProofVerifier( |
594 new ProofVerifierChromium(cert_verifier, transport_security_state)); | 596 new ProofVerifierChromium(cert_verifier, transport_security_state)); |
595 // TODO(rtenneti): http://crbug.com/487355. Temporary fix for b/20760730 until | 597 // TODO(rtenneti): http://crbug.com/487355. Temporary fix for b/20760730 until |
596 // channel_id_service is supported in cronet. | 598 // channel_id_service is supported in cronet. |
597 if (channel_id_service) { | 599 if (channel_id_service) { |
598 crypto_config_.SetChannelIDSource( | 600 crypto_config_.SetChannelIDSource( |
599 new ChannelIDSourceChromium(channel_id_service)); | 601 new ChannelIDSourceChromium(channel_id_service)); |
600 } | 602 } |
601 base::CPU cpu; | 603 base::CPU cpu; |
602 bool has_aes_hardware_support = cpu.has_aesni() && cpu.has_avx(); | 604 bool has_aes_hardware_support = cpu.has_aesni() && cpu.has_avx(); |
603 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.PreferAesGcm", | 605 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.PreferAesGcm", |
604 has_aes_hardware_support); | 606 has_aes_hardware_support); |
605 if (has_aes_hardware_support) | 607 if (has_aes_hardware_support || prefer_aes_) |
606 crypto_config_.PreferAesGcm(); | 608 crypto_config_.PreferAesGcm(); |
607 if (!IsEcdsaSupported()) | 609 if (!IsEcdsaSupported()) |
608 crypto_config_.DisableEcdsa(); | 610 crypto_config_.DisableEcdsa(); |
609 } | 611 } |
610 | 612 |
611 QuicStreamFactory::~QuicStreamFactory() { | 613 QuicStreamFactory::~QuicStreamFactory() { |
612 CloseAllSessions(ERR_ABORTED); | 614 CloseAllSessions(ERR_ABORTED); |
613 while (!all_sessions_.empty()) { | 615 while (!all_sessions_.empty()) { |
614 delete all_sessions_.begin()->first; | 616 delete all_sessions_.begin()->first; |
615 all_sessions_.erase(all_sessions_.begin()); | 617 all_sessions_.erase(all_sessions_.begin()); |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 // Since the session was active, there's no longer an | 1256 // Since the session was active, there's no longer an |
1255 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1257 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
1256 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1258 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
1257 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1259 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1258 // still race. | 1260 // still race. |
1259 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1261 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1260 alternative_service); | 1262 alternative_service); |
1261 } | 1263 } |
1262 | 1264 |
1263 } // namespace net | 1265 } // namespace net |
OLD | NEW |