| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 globals.use_alternative_services.CopyToIfSet( | 1137 globals.use_alternative_services.CopyToIfSet( |
| 1138 ¶ms->use_alternative_services); | 1138 ¶ms->use_alternative_services); |
| 1139 globals.alternative_service_probability_threshold.CopyToIfSet( | 1139 globals.alternative_service_probability_threshold.CopyToIfSet( |
| 1140 ¶ms->alternative_service_probability_threshold); | 1140 ¶ms->alternative_service_probability_threshold); |
| 1141 | 1141 |
| 1142 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); | 1142 globals.enable_npn.CopyToIfSet(¶ms->enable_npn); |
| 1143 | 1143 |
| 1144 globals.enable_brotli.CopyToIfSet(¶ms->enable_brotli); | 1144 globals.enable_brotli.CopyToIfSet(¶ms->enable_brotli); |
| 1145 | 1145 |
| 1146 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 1146 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
| 1147 globals.disable_quic_when_connection_times_out_with_open_streams.CopyToIfSet( |
| 1148 ¶ms->disable_quic_when_connection_times_out_with_open_streams); |
| 1147 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); | 1149 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); |
| 1148 globals.quic_always_require_handshake_confirmation.CopyToIfSet( | 1150 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
| 1149 ¶ms->quic_always_require_handshake_confirmation); | 1151 ¶ms->quic_always_require_handshake_confirmation); |
| 1150 globals.quic_disable_connection_pooling.CopyToIfSet( | 1152 globals.quic_disable_connection_pooling.CopyToIfSet( |
| 1151 ¶ms->quic_disable_connection_pooling); | 1153 ¶ms->quic_disable_connection_pooling); |
| 1152 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( | 1154 globals.quic_load_server_info_timeout_srtt_multiplier.CopyToIfSet( |
| 1153 ¶ms->quic_load_server_info_timeout_srtt_multiplier); | 1155 ¶ms->quic_load_server_info_timeout_srtt_multiplier); |
| 1154 globals.quic_enable_connection_racing.CopyToIfSet( | 1156 globals.quic_enable_connection_racing.CopyToIfSet( |
| 1155 ¶ms->quic_enable_connection_racing); | 1157 ¶ms->quic_enable_connection_racing); |
| 1156 globals.quic_enable_non_blocking_io.CopyToIfSet( | 1158 globals.quic_enable_non_blocking_io.CopyToIfSet( |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 | 1263 |
| 1262 void IOThread::ConfigureQuicGlobals( | 1264 void IOThread::ConfigureQuicGlobals( |
| 1263 const base::CommandLine& command_line, | 1265 const base::CommandLine& command_line, |
| 1264 base::StringPiece quic_trial_group, | 1266 base::StringPiece quic_trial_group, |
| 1265 const VariationParameters& quic_trial_params, | 1267 const VariationParameters& quic_trial_params, |
| 1266 bool quic_allowed_by_policy, | 1268 bool quic_allowed_by_policy, |
| 1267 IOThread::Globals* globals) { | 1269 IOThread::Globals* globals) { |
| 1268 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group, | 1270 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group, |
| 1269 quic_allowed_by_policy); | 1271 quic_allowed_by_policy); |
| 1270 globals->enable_quic.set(enable_quic); | 1272 globals->enable_quic.set(enable_quic); |
| 1273 globals->disable_quic_when_connection_times_out_with_open_streams.set( |
| 1274 ShouldDisableQuicWhenConnectionTimesOutWithOpenStreams(quic_trial_params)); |
| 1271 bool enable_quic_for_proxies = ShouldEnableQuicForProxies( | 1275 bool enable_quic_for_proxies = ShouldEnableQuicForProxies( |
| 1272 command_line, quic_trial_group, quic_allowed_by_policy); | 1276 command_line, quic_trial_group, quic_allowed_by_policy); |
| 1273 globals->enable_quic_for_proxies.set(enable_quic_for_proxies); | 1277 globals->enable_quic_for_proxies.set(enable_quic_for_proxies); |
| 1274 globals->use_alternative_services.set( | 1278 globals->use_alternative_services.set( |
| 1275 ShouldQuicEnableAlternativeServices(command_line, quic_trial_params)); | 1279 ShouldQuicEnableAlternativeServices(command_line, quic_trial_params)); |
| 1276 if (enable_quic) { | 1280 if (enable_quic) { |
| 1277 globals->quic_always_require_handshake_confirmation.set( | 1281 globals->quic_always_require_handshake_confirmation.set( |
| 1278 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params)); | 1282 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params)); |
| 1279 globals->quic_disable_connection_pooling.set( | 1283 globals->quic_disable_connection_pooling.set( |
| 1280 ShouldQuicDisableConnectionPooling(quic_trial_params)); | 1284 ShouldQuicDisableConnectionPooling(quic_trial_params)); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { | 1363 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { |
| 1360 net::HostPortPair quic_origin = | 1364 net::HostPortPair quic_origin = |
| 1361 net::HostPortPair::FromString( | 1365 net::HostPortPair::FromString( |
| 1362 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); | 1366 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); |
| 1363 if (!quic_origin.IsEmpty()) { | 1367 if (!quic_origin.IsEmpty()) { |
| 1364 globals->origin_to_force_quic_on.set(quic_origin); | 1368 globals->origin_to_force_quic_on.set(quic_origin); |
| 1365 } | 1369 } |
| 1366 } | 1370 } |
| 1367 } | 1371 } |
| 1368 | 1372 |
| 1373 bool IOThread::ShouldDisableQuicWhenConnectionTimesOutWithOpenStreams( |
| 1374 const VariationParameters& quic_trial_params) { |
| 1375 return base::LowerCaseEqualsASCII( |
| 1376 GetVariationParam(quic_trial_params, |
| 1377 "disable_quic_when_connection_times_out_with_open_streams"), |
| 1378 "true"); |
| 1379 } |
| 1380 |
| 1369 bool IOThread::ShouldEnableQuic(const base::CommandLine& command_line, | 1381 bool IOThread::ShouldEnableQuic(const base::CommandLine& command_line, |
| 1370 base::StringPiece quic_trial_group, | 1382 base::StringPiece quic_trial_group, |
| 1371 bool quic_allowed_by_policy) { | 1383 bool quic_allowed_by_policy) { |
| 1372 if (command_line.HasSwitch(switches::kDisableQuic) || !quic_allowed_by_policy) | 1384 if (command_line.HasSwitch(switches::kDisableQuic) || !quic_allowed_by_policy) |
| 1373 return false; | 1385 return false; |
| 1374 | 1386 |
| 1375 if (command_line.HasSwitch(switches::kEnableQuic)) | 1387 if (command_line.HasSwitch(switches::kEnableQuic)) |
| 1376 return true; | 1388 return true; |
| 1377 | 1389 |
| 1378 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || | 1390 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1781 std::move(job_factory); | 1793 std::move(job_factory); |
| 1782 | 1794 |
| 1783 context->set_job_factory( | 1795 context->set_job_factory( |
| 1784 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1796 globals->proxy_script_fetcher_url_request_job_factory.get()); |
| 1785 | 1797 |
| 1786 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1798 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 1787 // system URLRequestContext too. There's no reason this should be tied to a | 1799 // system URLRequestContext too. There's no reason this should be tied to a |
| 1788 // profile. | 1800 // profile. |
| 1789 return context; | 1801 return context; |
| 1790 } | 1802 } |
| OLD | NEW |