| 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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 ¶ms->spdy_default_protocol); | 1046 ¶ms->spdy_default_protocol); |
| 1047 params->next_protos = globals.next_protos; | 1047 params->next_protos = globals.next_protos; |
| 1048 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); | 1048 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); |
| 1049 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; | 1049 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; |
| 1050 globals.use_alternative_services.CopyToIfSet( | 1050 globals.use_alternative_services.CopyToIfSet( |
| 1051 ¶ms->use_alternative_services); | 1051 ¶ms->use_alternative_services); |
| 1052 globals.alternative_service_probability_threshold.CopyToIfSet( | 1052 globals.alternative_service_probability_threshold.CopyToIfSet( |
| 1053 ¶ms->alternative_service_probability_threshold); | 1053 ¶ms->alternative_service_probability_threshold); |
| 1054 | 1054 |
| 1055 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 1055 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
| 1056 globals.enable_insecure_quic.CopyToIfSet(¶ms->enable_insecure_quic); | |
| 1057 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); | 1056 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); |
| 1058 globals.quic_always_require_handshake_confirmation.CopyToIfSet( | 1057 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
| 1059 ¶ms->quic_always_require_handshake_confirmation); | 1058 ¶ms->quic_always_require_handshake_confirmation); |
| 1060 globals.quic_disable_connection_pooling.CopyToIfSet( | 1059 globals.quic_disable_connection_pooling.CopyToIfSet( |
| 1061 ¶ms->quic_disable_connection_pooling); | 1060 ¶ms->quic_disable_connection_pooling); |
| 1062 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( | 1061 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( |
| 1063 ¶ms->quic_load_server_info_timeout_srtt_multiplier); | 1062 ¶ms->quic_load_server_info_timeout_srtt_multiplier); |
| 1064 globals.quic_enable_connection_racing.CopyToIfSet( | 1063 globals.quic_enable_connection_racing.CopyToIfSet( |
| 1065 ¶ms->quic_enable_connection_racing); | 1064 ¶ms->quic_enable_connection_racing); |
| 1066 globals.quic_enable_non_blocking_io.CopyToIfSet( | 1065 globals.quic_enable_non_blocking_io.CopyToIfSet( |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 IOThread::Globals* globals) { | 1171 IOThread::Globals* globals) { |
| 1173 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group, | 1172 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group, |
| 1174 quic_allowed_by_policy); | 1173 quic_allowed_by_policy); |
| 1175 globals->enable_quic.set(enable_quic); | 1174 globals->enable_quic.set(enable_quic); |
| 1176 bool enable_quic_for_proxies = ShouldEnableQuicForProxies( | 1175 bool enable_quic_for_proxies = ShouldEnableQuicForProxies( |
| 1177 command_line, quic_trial_group, quic_allowed_by_policy); | 1176 command_line, quic_trial_group, quic_allowed_by_policy); |
| 1178 globals->enable_quic_for_proxies.set(enable_quic_for_proxies); | 1177 globals->enable_quic_for_proxies.set(enable_quic_for_proxies); |
| 1179 globals->use_alternative_services.set( | 1178 globals->use_alternative_services.set( |
| 1180 ShouldQuicEnableAlternativeServices(command_line, quic_trial_params)); | 1179 ShouldQuicEnableAlternativeServices(command_line, quic_trial_params)); |
| 1181 if (enable_quic) { | 1180 if (enable_quic) { |
| 1182 globals->enable_insecure_quic.set( | |
| 1183 ShouldEnableInsecureQuic(command_line, quic_trial_params)); | |
| 1184 globals->quic_always_require_handshake_confirmation.set( | 1181 globals->quic_always_require_handshake_confirmation.set( |
| 1185 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params)); | 1182 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params)); |
| 1186 globals->quic_disable_connection_pooling.set( | 1183 globals->quic_disable_connection_pooling.set( |
| 1187 ShouldQuicDisableConnectionPooling(quic_trial_params)); | 1184 ShouldQuicDisableConnectionPooling(quic_trial_params)); |
| 1188 int receive_buffer_size = GetQuicSocketReceiveBufferSize(quic_trial_params); | 1185 int receive_buffer_size = GetQuicSocketReceiveBufferSize(quic_trial_params); |
| 1189 if (receive_buffer_size != 0) { | 1186 if (receive_buffer_size != 0) { |
| 1190 globals->quic_socket_receive_buffer_size.set(receive_buffer_size); | 1187 globals->quic_socket_receive_buffer_size.set(receive_buffer_size); |
| 1191 } | 1188 } |
| 1192 globals->quic_delay_tcp_race.set(ShouldQuicDelayTcpRace(quic_trial_params)); | 1189 globals->quic_delay_tcp_race.set(ShouldQuicDelayTcpRace(quic_trial_params)); |
| 1193 float load_server_info_timeout_srtt_multiplier = | 1190 float load_server_info_timeout_srtt_multiplier = |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 bool IOThread::ShouldEnableQuicForDataReductionProxy() { | 1280 bool IOThread::ShouldEnableQuicForDataReductionProxy() { |
| 1284 const base::CommandLine& command_line = | 1281 const base::CommandLine& command_line = |
| 1285 *base::CommandLine::ForCurrentProcess(); | 1282 *base::CommandLine::ForCurrentProcess(); |
| 1286 | 1283 |
| 1287 if (command_line.HasSwitch(switches::kDisableQuic)) | 1284 if (command_line.HasSwitch(switches::kDisableQuic)) |
| 1288 return false; | 1285 return false; |
| 1289 | 1286 |
| 1290 return data_reduction_proxy::params::IsIncludedInQuicFieldTrial(); | 1287 return data_reduction_proxy::params::IsIncludedInQuicFieldTrial(); |
| 1291 } | 1288 } |
| 1292 | 1289 |
| 1293 bool IOThread::ShouldEnableInsecureQuic( | |
| 1294 const base::CommandLine& command_line, | |
| 1295 const VariationParameters& quic_trial_params) { | |
| 1296 if (command_line.HasSwitch(switches::kEnableInsecureQuic)) | |
| 1297 return true; | |
| 1298 | |
| 1299 return base::LowerCaseEqualsASCII( | |
| 1300 GetVariationParam(quic_trial_params, "enable_insecure_quic"), | |
| 1301 "true"); | |
| 1302 } | |
| 1303 | |
| 1304 bool IOThread::ShouldEnableQuicPortSelection( | 1290 bool IOThread::ShouldEnableQuicPortSelection( |
| 1305 const base::CommandLine& command_line) { | 1291 const base::CommandLine& command_line) { |
| 1306 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) | 1292 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) |
| 1307 return false; | 1293 return false; |
| 1308 | 1294 |
| 1309 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) | 1295 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) |
| 1310 return true; | 1296 return true; |
| 1311 | 1297 |
| 1312 return false; // Default to disabling port selection on all channels. | 1298 return false; // Default to disabling port selection on all channels. |
| 1313 } | 1299 } |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | 1619 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); |
| 1634 | 1620 |
| 1635 context->set_job_factory( | 1621 context->set_job_factory( |
| 1636 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1622 globals->proxy_script_fetcher_url_request_job_factory.get()); |
| 1637 | 1623 |
| 1638 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1624 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 1639 // system URLRequestContext too. There's no reason this should be tied to a | 1625 // system URLRequestContext too. There's no reason this should be tied to a |
| 1640 // profile. | 1626 // profile. |
| 1641 return context; | 1627 return context; |
| 1642 } | 1628 } |
| OLD | NEW |