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); |
637 | 639 |
638 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); | 640 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); |
639 | 641 |
640 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 642 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
641 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); | 643 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); |
642 globals.quic_always_require_handshake_confirmation.CopyToIfSet( | 644 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
643 ¶ms->quic_always_require_handshake_confirmation); | 645 ¶ms->quic_always_require_handshake_confirmation); |
644 globals.quic_disable_connection_pooling.CopyToIfSet( | 646 globals.quic_disable_connection_pooling.CopyToIfSet( |
645 ¶ms->quic_disable_connection_pooling); | 647 ¶ms->quic_disable_connection_pooling); |
646 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( | 648 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 quic_user_agent_id.push_back(' '); | 799 quic_user_agent_id.push_back(' '); |
798 quic_user_agent_id.append(web::BuildOSCpuInfo()); | 800 quic_user_agent_id.append(web::BuildOSCpuInfo()); |
799 globals->quic_user_agent_id.set(quic_user_agent_id); | 801 globals->quic_user_agent_id.set(quic_user_agent_id); |
800 | 802 |
801 net::QuicVersion version = GetQuicVersion(quic_trial_params); | 803 net::QuicVersion version = GetQuicVersion(quic_trial_params); |
802 if (version != net::QUIC_VERSION_UNSUPPORTED) { | 804 if (version != net::QUIC_VERSION_UNSUPPORTED) { |
803 net::QuicVersionVector supported_versions; | 805 net::QuicVersionVector supported_versions; |
804 supported_versions.push_back(version); | 806 supported_versions.push_back(version); |
805 globals->quic_supported_versions.set(supported_versions); | 807 globals->quic_supported_versions.set(supported_versions); |
806 } | 808 } |
| 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 } |
807 } | 817 } |
808 | 818 |
809 bool IOSChromeIOThread::ShouldEnableQuic(base::StringPiece quic_trial_group) { | 819 bool IOSChromeIOThread::ShouldEnableQuic(base::StringPiece quic_trial_group) { |
810 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || | 820 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || |
811 quic_trial_group.starts_with(kQuicFieldTrialHttpsEnabledGroupName); | 821 quic_trial_group.starts_with(kQuicFieldTrialHttpsEnabledGroupName); |
812 } | 822 } |
813 | 823 |
814 bool IOSChromeIOThread::ShouldEnableQuicForProxies( | 824 bool IOSChromeIOThread::ShouldEnableQuicForProxies( |
815 base::StringPiece quic_trial_group) { | 825 base::StringPiece quic_trial_group) { |
816 return ShouldEnableQuic(quic_trial_group) || | 826 return ShouldEnableQuic(quic_trial_group) || |
817 ShouldEnableQuicForDataReductionProxy(); | 827 ShouldEnableQuicForDataReductionProxy(); |
818 } | 828 } |
819 | 829 |
820 bool IOSChromeIOThread::ShouldEnableQuicForDataReductionProxy() { | 830 bool IOSChromeIOThread::ShouldEnableQuicForDataReductionProxy() { |
821 return data_reduction_proxy::params::IsIncludedInQuicFieldTrial(); | 831 return data_reduction_proxy::params::IsIncludedInQuicFieldTrial(); |
822 } | 832 } |
823 | 833 |
824 net::QuicTagVector IOSChromeIOThread::GetQuicConnectionOptions( | 834 net::QuicTagVector IOSChromeIOThread::GetQuicConnectionOptions( |
825 const VariationParameters& quic_trial_params) { | 835 const VariationParameters& quic_trial_params) { |
826 VariationParameters::const_iterator it = | 836 VariationParameters::const_iterator it = |
827 quic_trial_params.find("connection_options"); | 837 quic_trial_params.find("connection_options"); |
828 if (it == quic_trial_params.end()) { | 838 if (it == quic_trial_params.end()) { |
829 return net::QuicTagVector(); | 839 return net::QuicTagVector(); |
830 } | 840 } |
831 | 841 |
832 return net::QuicUtils::ParseQuicConnectionOptions(it->second); | 842 return net::QuicUtils::ParseQuicConnectionOptions(it->second); |
833 } | 843 } |
834 | 844 |
| 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 |
835 bool IOSChromeIOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( | 865 bool IOSChromeIOThread::ShouldQuicAlwaysRequireHandshakeConfirmation( |
836 const VariationParameters& quic_trial_params) { | 866 const VariationParameters& quic_trial_params) { |
837 return base::LowerCaseEqualsASCII( | 867 return base::LowerCaseEqualsASCII( |
838 GetVariationParam(quic_trial_params, | 868 GetVariationParam(quic_trial_params, |
839 "always_require_handshake_confirmation"), | 869 "always_require_handshake_confirmation"), |
840 "true"); | 870 "true"); |
841 } | 871 } |
842 | 872 |
843 bool IOSChromeIOThread::ShouldQuicDisableConnectionPooling( | 873 bool IOSChromeIOThread::ShouldQuicDisableConnectionPooling( |
844 const VariationParameters& quic_trial_params) { | 874 const VariationParameters& quic_trial_params) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 | 1044 |
1015 globals->system_http_network_session.reset( | 1045 globals->system_http_network_session.reset( |
1016 new net::HttpNetworkSession(system_params)); | 1046 new net::HttpNetworkSession(system_params)); |
1017 globals->system_http_transaction_factory.reset( | 1047 globals->system_http_transaction_factory.reset( |
1018 new net::HttpNetworkLayer(globals->system_http_network_session.get())); | 1048 new net::HttpNetworkLayer(globals->system_http_network_session.get())); |
1019 context->set_http_transaction_factory( | 1049 context->set_http_transaction_factory( |
1020 globals->system_http_transaction_factory.get()); | 1050 globals->system_http_transaction_factory.get()); |
1021 | 1051 |
1022 return context; | 1052 return context; |
1023 } | 1053 } |
OLD | NEW |