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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); | 1165 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); |
1166 globals.quic_supported_versions.CopyToIfSet( | 1166 globals.quic_supported_versions.CopyToIfSet( |
1167 ¶ms->quic_supported_versions); | 1167 ¶ms->quic_supported_versions); |
1168 params->quic_connection_options = globals.quic_connection_options; | 1168 params->quic_connection_options = globals.quic_connection_options; |
1169 globals.quic_close_sessions_on_ip_change.CopyToIfSet( | 1169 globals.quic_close_sessions_on_ip_change.CopyToIfSet( |
1170 ¶ms->quic_close_sessions_on_ip_change); | 1170 ¶ms->quic_close_sessions_on_ip_change); |
1171 globals.quic_idle_connection_timeout_seconds.CopyToIfSet( | 1171 globals.quic_idle_connection_timeout_seconds.CopyToIfSet( |
1172 ¶ms->quic_idle_connection_timeout_seconds); | 1172 ¶ms->quic_idle_connection_timeout_seconds); |
1173 globals.quic_disable_preconnect_if_0rtt.CopyToIfSet( | 1173 globals.quic_disable_preconnect_if_0rtt.CopyToIfSet( |
1174 ¶ms->quic_disable_preconnect_if_0rtt); | 1174 ¶ms->quic_disable_preconnect_if_0rtt); |
1175 | 1175 globals.quic_migrate_sessions_on_network_change.CopyToIfSet( |
| 1176 ¶ms->quic_migrate_sessions_on_network_change); |
1176 globals.origin_to_force_quic_on.CopyToIfSet( | 1177 globals.origin_to_force_quic_on.CopyToIfSet( |
1177 ¶ms->origin_to_force_quic_on); | 1178 ¶ms->origin_to_force_quic_on); |
1178 params->enable_user_alternate_protocol_ports = | 1179 params->enable_user_alternate_protocol_ports = |
1179 globals.enable_user_alternate_protocol_ports; | 1180 globals.enable_user_alternate_protocol_ports; |
1180 } | 1181 } |
1181 | 1182 |
1182 base::TimeTicks IOThread::creation_time() const { | 1183 base::TimeTicks IOThread::creation_time() const { |
1183 return creation_time_; | 1184 return creation_time_; |
1184 } | 1185 } |
1185 | 1186 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 globals->quic_close_sessions_on_ip_change.set( | 1305 globals->quic_close_sessions_on_ip_change.set( |
1305 ShouldQuicCloseSessionsOnIpChange(quic_trial_params)); | 1306 ShouldQuicCloseSessionsOnIpChange(quic_trial_params)); |
1306 int idle_connection_timeout_seconds = GetQuicIdleConnectionTimeoutSeconds( | 1307 int idle_connection_timeout_seconds = GetQuicIdleConnectionTimeoutSeconds( |
1307 quic_trial_params); | 1308 quic_trial_params); |
1308 if (idle_connection_timeout_seconds != 0) { | 1309 if (idle_connection_timeout_seconds != 0) { |
1309 globals->quic_idle_connection_timeout_seconds.set( | 1310 globals->quic_idle_connection_timeout_seconds.set( |
1310 idle_connection_timeout_seconds); | 1311 idle_connection_timeout_seconds); |
1311 } | 1312 } |
1312 globals->quic_disable_preconnect_if_0rtt.set( | 1313 globals->quic_disable_preconnect_if_0rtt.set( |
1313 ShouldQuicDisablePreConnectIfZeroRtt(quic_trial_params)); | 1314 ShouldQuicDisablePreConnectIfZeroRtt(quic_trial_params)); |
| 1315 globals->quic_migrate_sessions_on_network_change.set( |
| 1316 ShouldQuicMigrateSessionsOnNetworkChange(quic_trial_params)); |
1314 } | 1317 } |
1315 | 1318 |
1316 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | 1319 size_t max_packet_length = GetQuicMaxPacketLength(command_line, |
1317 quic_trial_params); | 1320 quic_trial_params); |
1318 if (max_packet_length != 0) { | 1321 if (max_packet_length != 0) { |
1319 globals->quic_max_packet_length.set(max_packet_length); | 1322 globals->quic_max_packet_length.set(max_packet_length); |
1320 } | 1323 } |
1321 | 1324 |
1322 std::string quic_user_agent_id = chrome::GetChannelString(); | 1325 std::string quic_user_agent_id = chrome::GetChannelString(); |
1323 if (!quic_user_agent_id.empty()) | 1326 if (!quic_user_agent_id.empty()) |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 return value; | 1564 return value; |
1562 } | 1565 } |
1563 return 0; | 1566 return 0; |
1564 } | 1567 } |
1565 | 1568 |
1566 bool IOThread::ShouldQuicDisablePreConnectIfZeroRtt( | 1569 bool IOThread::ShouldQuicDisablePreConnectIfZeroRtt( |
1567 const VariationParameters& quic_trial_params) { | 1570 const VariationParameters& quic_trial_params) { |
1568 return base::LowerCaseEqualsASCII( | 1571 return base::LowerCaseEqualsASCII( |
1569 GetVariationParam(quic_trial_params, "disable_preconnect_if_0rtt"), | 1572 GetVariationParam(quic_trial_params, "disable_preconnect_if_0rtt"), |
1570 "true"); | 1573 "true"); |
| 1574 |
| 1575 bool IOThread::ShouldQuicMigrateSessionsOnNetworkChange( |
| 1576 const VariationParameters& quic_trial_params) { |
| 1577 return base::LowerCaseEqualsASCII( |
| 1578 GetVariationParam(quic_trial_params, |
| 1579 "migrate_sessions_on_network_change"), |
| 1580 "true"); |
| 1581 return false; |
1571 } | 1582 } |
1572 | 1583 |
1573 size_t IOThread::GetQuicMaxPacketLength( | 1584 size_t IOThread::GetQuicMaxPacketLength( |
1574 const base::CommandLine& command_line, | 1585 const base::CommandLine& command_line, |
1575 const VariationParameters& quic_trial_params) { | 1586 const VariationParameters& quic_trial_params) { |
1576 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | 1587 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { |
1577 unsigned value; | 1588 unsigned value; |
1578 if (!base::StringToUint( | 1589 if (!base::StringToUint( |
1579 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), | 1590 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), |
1580 &value)) { | 1591 &value)) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | 1752 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); |
1742 | 1753 |
1743 context->set_job_factory( | 1754 context->set_job_factory( |
1744 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1755 globals->proxy_script_fetcher_url_request_job_factory.get()); |
1745 | 1756 |
1746 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1757 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
1747 // system URLRequestContext too. There's no reason this should be tied to a | 1758 // system URLRequestContext too. There's no reason this should be tied to a |
1748 // profile. | 1759 // profile. |
1749 return context; | 1760 return context; |
1750 } | 1761 } |
OLD | NEW |