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 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 ¶ms->quic_supported_versions); | 1173 ¶ms->quic_supported_versions); |
1174 params->quic_connection_options = globals.quic_connection_options; | 1174 params->quic_connection_options = globals.quic_connection_options; |
1175 globals.quic_close_sessions_on_ip_change.CopyToIfSet( | 1175 globals.quic_close_sessions_on_ip_change.CopyToIfSet( |
1176 ¶ms->quic_close_sessions_on_ip_change); | 1176 ¶ms->quic_close_sessions_on_ip_change); |
1177 globals.quic_idle_connection_timeout_seconds.CopyToIfSet( | 1177 globals.quic_idle_connection_timeout_seconds.CopyToIfSet( |
1178 ¶ms->quic_idle_connection_timeout_seconds); | 1178 ¶ms->quic_idle_connection_timeout_seconds); |
1179 globals.quic_disable_preconnect_if_0rtt.CopyToIfSet( | 1179 globals.quic_disable_preconnect_if_0rtt.CopyToIfSet( |
1180 ¶ms->quic_disable_preconnect_if_0rtt); | 1180 ¶ms->quic_disable_preconnect_if_0rtt); |
1181 if (!globals.quic_host_whitelist.empty()) | 1181 if (!globals.quic_host_whitelist.empty()) |
1182 params->quic_host_whitelist = globals.quic_host_whitelist; | 1182 params->quic_host_whitelist = globals.quic_host_whitelist; |
1183 | 1183 globals.quic_migrate_sessions_on_network_change.CopyToIfSet( |
| 1184 ¶ms->quic_migrate_sessions_on_network_change); |
1184 globals.origin_to_force_quic_on.CopyToIfSet( | 1185 globals.origin_to_force_quic_on.CopyToIfSet( |
1185 ¶ms->origin_to_force_quic_on); | 1186 ¶ms->origin_to_force_quic_on); |
1186 params->enable_user_alternate_protocol_ports = | 1187 params->enable_user_alternate_protocol_ports = |
1187 globals.enable_user_alternate_protocol_ports; | 1188 globals.enable_user_alternate_protocol_ports; |
1188 } | 1189 } |
1189 | 1190 |
1190 base::TimeTicks IOThread::creation_time() const { | 1191 base::TimeTicks IOThread::creation_time() const { |
1191 return creation_time_; | 1192 return creation_time_; |
1192 } | 1193 } |
1193 | 1194 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 int idle_connection_timeout_seconds = GetQuicIdleConnectionTimeoutSeconds( | 1315 int idle_connection_timeout_seconds = GetQuicIdleConnectionTimeoutSeconds( |
1315 quic_trial_params); | 1316 quic_trial_params); |
1316 if (idle_connection_timeout_seconds != 0) { | 1317 if (idle_connection_timeout_seconds != 0) { |
1317 globals->quic_idle_connection_timeout_seconds.set( | 1318 globals->quic_idle_connection_timeout_seconds.set( |
1318 idle_connection_timeout_seconds); | 1319 idle_connection_timeout_seconds); |
1319 } | 1320 } |
1320 globals->quic_disable_preconnect_if_0rtt.set( | 1321 globals->quic_disable_preconnect_if_0rtt.set( |
1321 ShouldQuicDisablePreConnectIfZeroRtt(quic_trial_params)); | 1322 ShouldQuicDisablePreConnectIfZeroRtt(quic_trial_params)); |
1322 globals->quic_host_whitelist = | 1323 globals->quic_host_whitelist = |
1323 GetQuicHostWhitelist(command_line, quic_trial_params); | 1324 GetQuicHostWhitelist(command_line, quic_trial_params); |
| 1325 globals->quic_migrate_sessions_on_network_change.set( |
| 1326 ShouldQuicMigrateSessionsOnNetworkChange(quic_trial_params)); |
1324 } | 1327 } |
1325 | 1328 |
1326 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | 1329 size_t max_packet_length = GetQuicMaxPacketLength(command_line, |
1327 quic_trial_params); | 1330 quic_trial_params); |
1328 if (max_packet_length != 0) { | 1331 if (max_packet_length != 0) { |
1329 globals->quic_max_packet_length.set(max_packet_length); | 1332 globals->quic_max_packet_length.set(max_packet_length); |
1330 } | 1333 } |
1331 | 1334 |
1332 std::string quic_user_agent_id = chrome::GetChannelString(); | 1335 std::string quic_user_agent_id = chrome::GetChannelString(); |
1333 if (!quic_user_agent_id.empty()) | 1336 if (!quic_user_agent_id.empty()) |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 } | 1594 } |
1592 std::unordered_set<std::string> hosts; | 1595 std::unordered_set<std::string> hosts; |
1593 for (const std::string& host :base::SplitString(whitelist, ",", | 1596 for (const std::string& host :base::SplitString(whitelist, ",", |
1594 base::TRIM_WHITESPACE, | 1597 base::TRIM_WHITESPACE, |
1595 base::SPLIT_WANT_ALL)) { | 1598 base::SPLIT_WANT_ALL)) { |
1596 hosts.insert(host); | 1599 hosts.insert(host); |
1597 } | 1600 } |
1598 return hosts; | 1601 return hosts; |
1599 } | 1602 } |
1600 | 1603 |
| 1604 bool IOThread::ShouldQuicMigrateSessionsOnNetworkChange( |
| 1605 const VariationParameters& quic_trial_params) { |
| 1606 return base::LowerCaseEqualsASCII( |
| 1607 GetVariationParam(quic_trial_params, |
| 1608 "migrate_sessions_on_network_change"), |
| 1609 "true"); |
| 1610 } |
| 1611 |
1601 size_t IOThread::GetQuicMaxPacketLength( | 1612 size_t IOThread::GetQuicMaxPacketLength( |
1602 const base::CommandLine& command_line, | 1613 const base::CommandLine& command_line, |
1603 const VariationParameters& quic_trial_params) { | 1614 const VariationParameters& quic_trial_params) { |
1604 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | 1615 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { |
1605 unsigned value; | 1616 unsigned value; |
1606 if (!base::StringToUint( | 1617 if (!base::StringToUint( |
1607 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), | 1618 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), |
1608 &value)) { | 1619 &value)) { |
1609 return 0; | 1620 return 0; |
1610 } | 1621 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 std::move(job_factory); | 1781 std::move(job_factory); |
1771 | 1782 |
1772 context->set_job_factory( | 1783 context->set_job_factory( |
1773 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1784 globals->proxy_script_fetcher_url_request_job_factory.get()); |
1774 | 1785 |
1775 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1786 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
1776 // system URLRequestContext too. There's no reason this should be tied to a | 1787 // system URLRequestContext too. There's no reason this should be tied to a |
1777 // profile. | 1788 // profile. |
1778 return context; | 1789 return context; |
1779 } | 1790 } |
OLD | NEW |