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 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 ¶ms->enable_quic_port_selection); | 1115 ¶ms->enable_quic_port_selection); |
1116 globals.quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); | 1116 globals.quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); |
1117 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); | 1117 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); |
1118 globals.quic_supported_versions.CopyToIfSet( | 1118 globals.quic_supported_versions.CopyToIfSet( |
1119 ¶ms->quic_supported_versions); | 1119 ¶ms->quic_supported_versions); |
1120 params->quic_connection_options = globals.quic_connection_options; | 1120 params->quic_connection_options = globals.quic_connection_options; |
1121 globals.quic_close_sessions_on_ip_change.CopyToIfSet( | 1121 globals.quic_close_sessions_on_ip_change.CopyToIfSet( |
1122 ¶ms->quic_close_sessions_on_ip_change); | 1122 ¶ms->quic_close_sessions_on_ip_change); |
1123 globals.quic_idle_connection_timeout_seconds.CopyToIfSet( | 1123 globals.quic_idle_connection_timeout_seconds.CopyToIfSet( |
1124 ¶ms->quic_idle_connection_timeout_seconds); | 1124 ¶ms->quic_idle_connection_timeout_seconds); |
| 1125 globals.quic_disable_preconnect_if_0rtt.CopyToIfSet( |
| 1126 ¶ms->quic_disable_preconnect_if_0rtt); |
1125 | 1127 |
1126 globals.origin_to_force_quic_on.CopyToIfSet( | 1128 globals.origin_to_force_quic_on.CopyToIfSet( |
1127 ¶ms->origin_to_force_quic_on); | 1129 ¶ms->origin_to_force_quic_on); |
1128 params->enable_user_alternate_protocol_ports = | 1130 params->enable_user_alternate_protocol_ports = |
1129 globals.enable_user_alternate_protocol_ports; | 1131 globals.enable_user_alternate_protocol_ports; |
1130 } | 1132 } |
1131 | 1133 |
1132 base::TimeTicks IOThread::creation_time() const { | 1134 base::TimeTicks IOThread::creation_time() const { |
1133 return creation_time_; | 1135 return creation_time_; |
1134 } | 1136 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 globals->quic_connection_options = | 1254 globals->quic_connection_options = |
1253 GetQuicConnectionOptions(command_line, quic_trial_params); | 1255 GetQuicConnectionOptions(command_line, quic_trial_params); |
1254 globals->quic_close_sessions_on_ip_change.set( | 1256 globals->quic_close_sessions_on_ip_change.set( |
1255 ShouldQuicCloseSessionsOnIpChange(quic_trial_params)); | 1257 ShouldQuicCloseSessionsOnIpChange(quic_trial_params)); |
1256 int idle_connection_timeout_seconds = GetQuicIdleConnectionTimeoutSeconds( | 1258 int idle_connection_timeout_seconds = GetQuicIdleConnectionTimeoutSeconds( |
1257 quic_trial_params); | 1259 quic_trial_params); |
1258 if (idle_connection_timeout_seconds != 0) { | 1260 if (idle_connection_timeout_seconds != 0) { |
1259 globals->quic_idle_connection_timeout_seconds.set( | 1261 globals->quic_idle_connection_timeout_seconds.set( |
1260 idle_connection_timeout_seconds); | 1262 idle_connection_timeout_seconds); |
1261 } | 1263 } |
| 1264 globals->quic_disable_preconnect_if_0rtt.set( |
| 1265 ShouldQuicDisablePreConnectIfZeroRtt(quic_trial_params)); |
1262 } | 1266 } |
1263 | 1267 |
1264 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | 1268 size_t max_packet_length = GetQuicMaxPacketLength(command_line, |
1265 quic_trial_params); | 1269 quic_trial_params); |
1266 if (max_packet_length != 0) { | 1270 if (max_packet_length != 0) { |
1267 globals->quic_max_packet_length.set(max_packet_length); | 1271 globals->quic_max_packet_length.set(max_packet_length); |
1268 } | 1272 } |
1269 | 1273 |
1270 std::string quic_user_agent_id = chrome::GetChannelString(); | 1274 std::string quic_user_agent_id = chrome::GetChannelString(); |
1271 if (!quic_user_agent_id.empty()) | 1275 if (!quic_user_agent_id.empty()) |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 const VariationParameters& quic_trial_params) { | 1508 const VariationParameters& quic_trial_params) { |
1505 int value; | 1509 int value; |
1506 if (base::StringToInt(GetVariationParam(quic_trial_params, | 1510 if (base::StringToInt(GetVariationParam(quic_trial_params, |
1507 "idle_connection_timeout_seconds"), | 1511 "idle_connection_timeout_seconds"), |
1508 &value)) { | 1512 &value)) { |
1509 return value; | 1513 return value; |
1510 } | 1514 } |
1511 return 0; | 1515 return 0; |
1512 } | 1516 } |
1513 | 1517 |
| 1518 bool IOThread::ShouldQuicDisablePreConnectIfZeroRtt( |
| 1519 const VariationParameters& quic_trial_params) { |
| 1520 return base::LowerCaseEqualsASCII( |
| 1521 GetVariationParam(quic_trial_params, "disable_preconnect_if_0rtt"), |
| 1522 "true"); |
| 1523 } |
| 1524 |
1514 size_t IOThread::GetQuicMaxPacketLength( | 1525 size_t IOThread::GetQuicMaxPacketLength( |
1515 const base::CommandLine& command_line, | 1526 const base::CommandLine& command_line, |
1516 const VariationParameters& quic_trial_params) { | 1527 const VariationParameters& quic_trial_params) { |
1517 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | 1528 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { |
1518 unsigned value; | 1529 unsigned value; |
1519 if (!base::StringToUint( | 1530 if (!base::StringToUint( |
1520 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), | 1531 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), |
1521 &value)) { | 1532 &value)) { |
1522 return 0; | 1533 return 0; |
1523 } | 1534 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | 1693 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); |
1683 | 1694 |
1684 context->set_job_factory( | 1695 context->set_job_factory( |
1685 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1696 globals->proxy_script_fetcher_url_request_job_factory.get()); |
1686 | 1697 |
1687 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1698 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
1688 // system URLRequestContext too. There's no reason this should be tied to a | 1699 // system URLRequestContext too. There's no reason this should be tied to a |
1689 // profile. | 1700 // profile. |
1690 return context; | 1701 return context; |
1691 } | 1702 } |
OLD | NEW |