OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/ios_chrome_io_thread.h" | 5 #include "ios/chrome/browser/ios_chrome_io_thread.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 params->testing_fixed_https_port = globals.testing_fixed_https_port; | 627 params->testing_fixed_https_port = globals.testing_fixed_https_port; |
628 globals.enable_tcp_fast_open_for_ssl.CopyToIfSet( | 628 globals.enable_tcp_fast_open_for_ssl.CopyToIfSet( |
629 ¶ms->enable_tcp_fast_open_for_ssl); | 629 ¶ms->enable_tcp_fast_open_for_ssl); |
630 | 630 |
631 globals.enable_spdy31.CopyToIfSet(¶ms->enable_spdy31); | 631 globals.enable_spdy31.CopyToIfSet(¶ms->enable_spdy31); |
632 globals.enable_http2.CopyToIfSet(¶ms->enable_http2); | 632 globals.enable_http2.CopyToIfSet(¶ms->enable_http2); |
633 globals.parse_alternative_services.CopyToIfSet( | 633 globals.parse_alternative_services.CopyToIfSet( |
634 ¶ms->parse_alternative_services); | 634 ¶ms->parse_alternative_services); |
635 globals.enable_alternative_service_with_different_host.CopyToIfSet( | 635 globals.enable_alternative_service_with_different_host.CopyToIfSet( |
636 ¶ms->enable_alternative_service_with_different_host); | 636 ¶ms->enable_alternative_service_with_different_host); |
637 globals.alternative_service_probability_threshold.CopyToIfSet( | |
638 ¶ms->alternative_service_probability_threshold); | |
639 | 637 |
640 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); | 638 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); |
641 | 639 |
642 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 640 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
643 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); | 641 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); |
644 globals.quic_always_require_handshake_confirmation.CopyToIfSet( | 642 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
645 ¶ms->quic_always_require_handshake_confirmation); | 643 ¶ms->quic_always_require_handshake_confirmation); |
646 globals.quic_disable_connection_pooling.CopyToIfSet( | 644 globals.quic_disable_connection_pooling.CopyToIfSet( |
647 ¶ms->quic_disable_connection_pooling); | 645 ¶ms->quic_disable_connection_pooling); |
648 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( | 646 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 quic_user_agent_id.push_back(' '); | 797 quic_user_agent_id.push_back(' '); |
800 quic_user_agent_id.append(web::BuildOSCpuInfo()); | 798 quic_user_agent_id.append(web::BuildOSCpuInfo()); |
801 globals->quic_user_agent_id.set(quic_user_agent_id); | 799 globals->quic_user_agent_id.set(quic_user_agent_id); |
802 | 800 |
803 net::QuicVersion version = GetQuicVersion(quic_trial_params); | 801 net::QuicVersion version = GetQuicVersion(quic_trial_params); |
804 if (version != net::QUIC_VERSION_UNSUPPORTED) { | 802 if (version != net::QUIC_VERSION_UNSUPPORTED) { |
805 net::QuicVersionVector supported_versions; | 803 net::QuicVersionVector supported_versions; |
806 supported_versions.push_back(version); | 804 supported_versions.push_back(version); |
807 globals->quic_supported_versions.set(supported_versions); | 805 globals->quic_supported_versions.set(supported_versions); |
808 } | 806 } |
809 | |
810 double threshold = | |
811 GetAlternativeProtocolProbabilityThreshold(quic_trial_params); | |
812 if (threshold >= 0 && threshold <= 1) { | |
813 globals->alternative_service_probability_threshold.set(threshold); | |
814 globals->http_server_properties->SetAlternativeServiceProbabilityThreshold( | |
815 threshold); | |
816 } | |
817 } | 807 } |
818 | 808 |
819 bool IOSChromeIOThread::ShouldEnableQuic(base::StringPiece quic_trial_group) { | 809 bool IOSChromeIOThread::ShouldEnableQuic(base::StringPiece quic_trial_group) { |
820 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || | 810 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || |
821 quic_trial_group.starts_with(kQuicFieldTrialHttpsEnabledGroupName); | 811 quic_trial_group.starts_with(kQuicFieldTrialHttpsEnabledGroupName); |
822 } | 812 } |
823 | 813 |
824 bool IOSChromeIOThread::ShouldEnableQuicForProxies( | 814 bool IOSChromeIOThread::ShouldEnableQuicForProxies( |
825 base::StringPiece quic_trial_group) { | 815 base::StringPiece quic_trial_group) { |
826 return ShouldEnableQuic(quic_trial_group) || | 816 return ShouldEnableQuic(quic_trial_group) || |
827 ShouldEnableQuicForDataReductionProxy(); | 817 ShouldEnableQuicForDataReductionProxy(); |
828 } | 818 } |
829 | 819 |
830 bool IOSChromeIOThread::ShouldEnableQuicForDataReductionProxy() { | 820 bool IOSChromeIOThread::ShouldEnableQuicForDataReductionProxy() { |
831 return data_reduction_proxy::params::IsIncludedInQuicFieldTrial(); | 821 return data_reduction_proxy::params::IsIncludedInQuicFieldTrial(); |
832 } | 822 } |
833 | 823 |
834 net::QuicTagVector IOSChromeIOThread::GetQuicConnectionOptions( | 824 net::QuicTagVector IOSChromeIOThread::GetQuicConnectionOptions( |
835 const VariationParameters& quic_trial_params) { | 825 const VariationParameters& quic_trial_params) { |
836 VariationParameters::const_iterator it = | 826 VariationParameters::const_iterator it = |
837 quic_trial_params.find("connection_options"); | 827 quic_trial_params.find("connection_options"); |
838 if (it == quic_trial_params.end()) { | 828 if (it == quic_trial_params.end()) { |
839 return net::QuicTagVector(); | 829 return net::QuicTagVector(); |
840 } | 830 } |
841 | 831 |
842 return net::QuicUtils::ParseQuicConnectionOptions(it->second); | 832 return net::QuicUtils::ParseQuicConnectionOptions(it->second); |
843 } | 833 } |
844 | 834 |
845 double IOSChromeIOThread::GetAlternativeProtocolProbabilityThreshold( | |
846 const VariationParameters& quic_trial_params) { | |
847 double value; | |
848 // TODO(bnc): Remove when new parameter name rolls out and server | |
849 // configuration is changed. | |
850 if (base::StringToDouble( | |
851 GetVariationParam(quic_trial_params, | |
852 "alternate_protocol_probability_threshold"), | |
853 &value)) { | |
854 return value; | |
855 } | |
856 if (base::StringToDouble( | |
857 GetVariationParam(quic_trial_params, | |
858 "alternative_service_probability_threshold"), | |
859 &value)) { | |
860 return value; | |
861 } | |
862 return -1; | |
863 } | |
864 | |
865 bool IOSChromeIOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( | 835 bool IOSChromeIOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( |
866 const VariationParameters& quic_trial_params) { | 836 const VariationParameters& quic_trial_params) { |
867 return base::LowerCaseEqualsASCII( | 837 return base::LowerCaseEqualsASCII( |
868 GetVariationParam(quic_trial_params, | 838 GetVariationParam(quic_trial_params, |
869 "always_require_handshake_confirmation"), | 839 "always_require_handshake_confirmation"), |
870 "true"); | 840 "true"); |
871 } | 841 } |
872 | 842 |
873 bool IOSChromeIOThread::ShouldQuicDisableConnectionPooling( | 843 bool IOSChromeIOThread::ShouldQuicDisableConnectionPooling( |
874 const VariationParameters& quic_trial_params) { | 844 const VariationParameters& quic_trial_params) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 | 1014 |
1045 globals->system_http_network_session.reset( | 1015 globals->system_http_network_session.reset( |
1046 new net::HttpNetworkSession(system_params)); | 1016 new net::HttpNetworkSession(system_params)); |
1047 globals->system_http_transaction_factory.reset( | 1017 globals->system_http_transaction_factory.reset( |
1048 new net::HttpNetworkLayer(globals->system_http_network_session.get())); | 1018 new net::HttpNetworkLayer(globals->system_http_network_session.get())); |
1049 context->set_http_transaction_factory( | 1019 context->set_http_transaction_factory( |
1050 globals->system_http_transaction_factory.get()); | 1020 globals->system_http_transaction_factory.get()); |
1051 | 1021 |
1052 return context; | 1022 return context; |
1053 } | 1023 } |
OLD | NEW |