| 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 "chrome/browser/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 ¶ms->spdy_default_protocol); | 1005 ¶ms->spdy_default_protocol); |
| 1006 params->next_protos = globals.next_protos; | 1006 params->next_protos = globals.next_protos; |
| 1007 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); | 1007 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); |
| 1008 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; | 1008 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; |
| 1009 globals.use_alternative_services.CopyToIfSet( | 1009 globals.use_alternative_services.CopyToIfSet( |
| 1010 ¶ms->use_alternative_services); | 1010 ¶ms->use_alternative_services); |
| 1011 globals.alternative_service_probability_threshold.CopyToIfSet( | 1011 globals.alternative_service_probability_threshold.CopyToIfSet( |
| 1012 ¶ms->alternative_service_probability_threshold); | 1012 ¶ms->alternative_service_probability_threshold); |
| 1013 | 1013 |
| 1014 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 1014 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
| 1015 globals.enable_insecure_quic.CopyToIfSet(¶ms->enable_insecure_quic); | |
| 1016 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); | 1015 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); |
| 1017 globals.quic_always_require_handshake_confirmation.CopyToIfSet( | 1016 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
| 1018 ¶ms->quic_always_require_handshake_confirmation); | 1017 ¶ms->quic_always_require_handshake_confirmation); |
| 1019 globals.quic_disable_connection_pooling.CopyToIfSet( | 1018 globals.quic_disable_connection_pooling.CopyToIfSet( |
| 1020 ¶ms->quic_disable_connection_pooling); | 1019 ¶ms->quic_disable_connection_pooling); |
| 1021 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( | 1020 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( |
| 1022 ¶ms->quic_load_server_info_timeout_srtt_multiplier); | 1021 ¶ms->quic_load_server_info_timeout_srtt_multiplier); |
| 1023 globals.quic_enable_connection_racing.CopyToIfSet( | 1022 globals.quic_enable_connection_racing.CopyToIfSet( |
| 1024 ¶ms->quic_enable_connection_racing); | 1023 ¶ms->quic_enable_connection_racing); |
| 1025 globals.quic_enable_non_blocking_io.CopyToIfSet( | 1024 globals.quic_enable_non_blocking_io.CopyToIfSet( |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 IOThread::Globals* globals) { | 1126 IOThread::Globals* globals) { |
| 1128 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group, | 1127 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group, |
| 1129 quic_allowed_by_policy); | 1128 quic_allowed_by_policy); |
| 1130 globals->enable_quic.set(enable_quic); | 1129 globals->enable_quic.set(enable_quic); |
| 1131 bool enable_quic_for_proxies = ShouldEnableQuicForProxies( | 1130 bool enable_quic_for_proxies = ShouldEnableQuicForProxies( |
| 1132 command_line, quic_trial_group, quic_allowed_by_policy); | 1131 command_line, quic_trial_group, quic_allowed_by_policy); |
| 1133 globals->enable_quic_for_proxies.set(enable_quic_for_proxies); | 1132 globals->enable_quic_for_proxies.set(enable_quic_for_proxies); |
| 1134 globals->use_alternative_services.set( | 1133 globals->use_alternative_services.set( |
| 1135 ShouldQuicEnableAlternativeServices(command_line, quic_trial_params)); | 1134 ShouldQuicEnableAlternativeServices(command_line, quic_trial_params)); |
| 1136 if (enable_quic) { | 1135 if (enable_quic) { |
| 1137 globals->enable_insecure_quic.set( | |
| 1138 ShouldEnableInsecureQuic(command_line, quic_trial_params)); | |
| 1139 globals->quic_always_require_handshake_confirmation.set( | 1136 globals->quic_always_require_handshake_confirmation.set( |
| 1140 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params)); | 1137 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params)); |
| 1141 globals->quic_disable_connection_pooling.set( | 1138 globals->quic_disable_connection_pooling.set( |
| 1142 ShouldQuicDisableConnectionPooling(quic_trial_params)); | 1139 ShouldQuicDisableConnectionPooling(quic_trial_params)); |
| 1143 int receive_buffer_size = GetQuicSocketReceiveBufferSize(quic_trial_params); | 1140 int receive_buffer_size = GetQuicSocketReceiveBufferSize(quic_trial_params); |
| 1144 if (receive_buffer_size != 0) { | 1141 if (receive_buffer_size != 0) { |
| 1145 globals->quic_socket_receive_buffer_size.set(receive_buffer_size); | 1142 globals->quic_socket_receive_buffer_size.set(receive_buffer_size); |
| 1146 } | 1143 } |
| 1147 globals->quic_delay_tcp_race.set(ShouldQuicDelayTcpRace(quic_trial_params)); | 1144 globals->quic_delay_tcp_race.set(ShouldQuicDelayTcpRace(quic_trial_params)); |
| 1148 float load_server_info_timeout_srtt_multiplier = | 1145 float load_server_info_timeout_srtt_multiplier = |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 bool IOThread::ShouldEnableQuicForDataReductionProxy() { | 1235 bool IOThread::ShouldEnableQuicForDataReductionProxy() { |
| 1239 const base::CommandLine& command_line = | 1236 const base::CommandLine& command_line = |
| 1240 *base::CommandLine::ForCurrentProcess(); | 1237 *base::CommandLine::ForCurrentProcess(); |
| 1241 | 1238 |
| 1242 if (command_line.HasSwitch(switches::kDisableQuic)) | 1239 if (command_line.HasSwitch(switches::kDisableQuic)) |
| 1243 return false; | 1240 return false; |
| 1244 | 1241 |
| 1245 return data_reduction_proxy::params::IsIncludedInQuicFieldTrial(); | 1242 return data_reduction_proxy::params::IsIncludedInQuicFieldTrial(); |
| 1246 } | 1243 } |
| 1247 | 1244 |
| 1248 bool IOThread::ShouldEnableInsecureQuic( | |
| 1249 const base::CommandLine& command_line, | |
| 1250 const VariationParameters& quic_trial_params) { | |
| 1251 if (command_line.HasSwitch(switches::kEnableInsecureQuic)) | |
| 1252 return true; | |
| 1253 | |
| 1254 return base::LowerCaseEqualsASCII( | |
| 1255 GetVariationParam(quic_trial_params, "enable_insecure_quic"), | |
| 1256 "true"); | |
| 1257 } | |
| 1258 | |
| 1259 bool IOThread::ShouldEnableQuicPortSelection( | 1245 bool IOThread::ShouldEnableQuicPortSelection( |
| 1260 const base::CommandLine& command_line) { | 1246 const base::CommandLine& command_line) { |
| 1261 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) | 1247 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) |
| 1262 return false; | 1248 return false; |
| 1263 | 1249 |
| 1264 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) | 1250 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) |
| 1265 return true; | 1251 return true; |
| 1266 | 1252 |
| 1267 return false; // Default to disabling port selection on all channels. | 1253 return false; // Default to disabling port selection on all channels. |
| 1268 } | 1254 } |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | 1571 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); |
| 1586 | 1572 |
| 1587 context->set_job_factory( | 1573 context->set_job_factory( |
| 1588 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1574 globals->proxy_script_fetcher_url_request_job_factory.get()); |
| 1589 | 1575 |
| 1590 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1576 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 1591 // system URLRequestContext too. There's no reason this should be tied to a | 1577 // system URLRequestContext too. There's no reason this should be tied to a |
| 1592 // profile. | 1578 // profile. |
| 1593 return context; | 1579 return context; |
| 1594 } | 1580 } |
| OLD | NEW |