| 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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); | 1171 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); |
| 1172 globals.quic_supported_versions.CopyToIfSet( | 1172 globals.quic_supported_versions.CopyToIfSet( |
| 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()) |
| 1182 params->quic_host_whitelist = globals.quic_host_whitelist; |
| 1181 | 1183 |
| 1182 globals.origin_to_force_quic_on.CopyToIfSet( | 1184 globals.origin_to_force_quic_on.CopyToIfSet( |
| 1183 ¶ms->origin_to_force_quic_on); | 1185 ¶ms->origin_to_force_quic_on); |
| 1184 params->enable_user_alternate_protocol_ports = | 1186 params->enable_user_alternate_protocol_ports = |
| 1185 globals.enable_user_alternate_protocol_ports; | 1187 globals.enable_user_alternate_protocol_ports; |
| 1186 } | 1188 } |
| 1187 | 1189 |
| 1188 base::TimeTicks IOThread::creation_time() const { | 1190 base::TimeTicks IOThread::creation_time() const { |
| 1189 return creation_time_; | 1191 return creation_time_; |
| 1190 } | 1192 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 globals->quic_close_sessions_on_ip_change.set( | 1312 globals->quic_close_sessions_on_ip_change.set( |
| 1311 ShouldQuicCloseSessionsOnIpChange(quic_trial_params)); | 1313 ShouldQuicCloseSessionsOnIpChange(quic_trial_params)); |
| 1312 int idle_connection_timeout_seconds = GetQuicIdleConnectionTimeoutSeconds( | 1314 int idle_connection_timeout_seconds = GetQuicIdleConnectionTimeoutSeconds( |
| 1313 quic_trial_params); | 1315 quic_trial_params); |
| 1314 if (idle_connection_timeout_seconds != 0) { | 1316 if (idle_connection_timeout_seconds != 0) { |
| 1315 globals->quic_idle_connection_timeout_seconds.set( | 1317 globals->quic_idle_connection_timeout_seconds.set( |
| 1316 idle_connection_timeout_seconds); | 1318 idle_connection_timeout_seconds); |
| 1317 } | 1319 } |
| 1318 globals->quic_disable_preconnect_if_0rtt.set( | 1320 globals->quic_disable_preconnect_if_0rtt.set( |
| 1319 ShouldQuicDisablePreConnectIfZeroRtt(quic_trial_params)); | 1321 ShouldQuicDisablePreConnectIfZeroRtt(quic_trial_params)); |
| 1322 globals->quic_host_whitelist = |
| 1323 GetQuicHostWhitelist(command_line, quic_trial_params); |
| 1320 } | 1324 } |
| 1321 | 1325 |
| 1322 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | 1326 size_t max_packet_length = GetQuicMaxPacketLength(command_line, |
| 1323 quic_trial_params); | 1327 quic_trial_params); |
| 1324 if (max_packet_length != 0) { | 1328 if (max_packet_length != 0) { |
| 1325 globals->quic_max_packet_length.set(max_packet_length); | 1329 globals->quic_max_packet_length.set(max_packet_length); |
| 1326 } | 1330 } |
| 1327 | 1331 |
| 1328 std::string quic_user_agent_id = chrome::GetChannelString(); | 1332 std::string quic_user_agent_id = chrome::GetChannelString(); |
| 1329 if (!quic_user_agent_id.empty()) | 1333 if (!quic_user_agent_id.empty()) |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1569 return 0; | 1573 return 0; |
| 1570 } | 1574 } |
| 1571 | 1575 |
| 1572 bool IOThread::ShouldQuicDisablePreConnectIfZeroRtt( | 1576 bool IOThread::ShouldQuicDisablePreConnectIfZeroRtt( |
| 1573 const VariationParameters& quic_trial_params) { | 1577 const VariationParameters& quic_trial_params) { |
| 1574 return base::LowerCaseEqualsASCII( | 1578 return base::LowerCaseEqualsASCII( |
| 1575 GetVariationParam(quic_trial_params, "disable_preconnect_if_0rtt"), | 1579 GetVariationParam(quic_trial_params, "disable_preconnect_if_0rtt"), |
| 1576 "true"); | 1580 "true"); |
| 1577 } | 1581 } |
| 1578 | 1582 |
| 1583 std::unordered_set<std::string> IOThread::GetQuicHostWhitelist( |
| 1584 const base::CommandLine& command_line, |
| 1585 const VariationParameters& quic_trial_params) { |
| 1586 std::string whitelist; |
| 1587 if (command_line.HasSwitch(switches::kQuicHostWhitelist)) { |
| 1588 whitelist = command_line.GetSwitchValueASCII(switches::kQuicHostWhitelist); |
| 1589 } else { |
| 1590 whitelist = GetVariationParam(quic_trial_params, "quic_host_whitelist"); |
| 1591 } |
| 1592 std::unordered_set<std::string> hosts; |
| 1593 for (const std::string& host :base::SplitString(whitelist, ",", |
| 1594 base::TRIM_WHITESPACE, |
| 1595 base::SPLIT_WANT_ALL)) { |
| 1596 hosts.insert(host); |
| 1597 } |
| 1598 return hosts; |
| 1599 } |
| 1600 |
| 1579 size_t IOThread::GetQuicMaxPacketLength( | 1601 size_t IOThread::GetQuicMaxPacketLength( |
| 1580 const base::CommandLine& command_line, | 1602 const base::CommandLine& command_line, |
| 1581 const VariationParameters& quic_trial_params) { | 1603 const VariationParameters& quic_trial_params) { |
| 1582 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | 1604 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { |
| 1583 unsigned value; | 1605 unsigned value; |
| 1584 if (!base::StringToUint( | 1606 if (!base::StringToUint( |
| 1585 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), | 1607 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), |
| 1586 &value)) { | 1608 &value)) { |
| 1587 return 0; | 1609 return 0; |
| 1588 } | 1610 } |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1748 std::move(job_factory); | 1770 std::move(job_factory); |
| 1749 | 1771 |
| 1750 context->set_job_factory( | 1772 context->set_job_factory( |
| 1751 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1773 globals->proxy_script_fetcher_url_request_job_factory.get()); |
| 1752 | 1774 |
| 1753 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1775 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 1754 // system URLRequestContext too. There's no reason this should be tied to a | 1776 // system URLRequestContext too. There's no reason this should be tied to a |
| 1755 // profile. | 1777 // profile. |
| 1756 return context; | 1778 return context; |
| 1757 } | 1779 } |
| OLD | NEW |