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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1100 globals.quic_delay_tcp_race.CopyToIfSet(¶ms->quic_delay_tcp_race); | 1100 globals.quic_delay_tcp_race.CopyToIfSet(¶ms->quic_delay_tcp_race); |
1101 globals.enable_quic_port_selection.CopyToIfSet( | 1101 globals.enable_quic_port_selection.CopyToIfSet( |
1102 ¶ms->enable_quic_port_selection); | 1102 ¶ms->enable_quic_port_selection); |
1103 globals.quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); | 1103 globals.quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); |
1104 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); | 1104 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); |
1105 globals.quic_supported_versions.CopyToIfSet( | 1105 globals.quic_supported_versions.CopyToIfSet( |
1106 ¶ms->quic_supported_versions); | 1106 ¶ms->quic_supported_versions); |
1107 params->quic_connection_options = globals.quic_connection_options; | 1107 params->quic_connection_options = globals.quic_connection_options; |
1108 globals.quic_close_sessions_on_ip_change.CopyToIfSet( | 1108 globals.quic_close_sessions_on_ip_change.CopyToIfSet( |
1109 ¶ms->quic_close_sessions_on_ip_change); | 1109 ¶ms->quic_close_sessions_on_ip_change); |
1110 | 1110 globals.quic_migrate_sessions_on_net_change.CopyToIfSet( |
1111 ¶ms->quic_migrate_sessions_on_net_change); | |
1111 globals.origin_to_force_quic_on.CopyToIfSet( | 1112 globals.origin_to_force_quic_on.CopyToIfSet( |
1112 ¶ms->origin_to_force_quic_on); | 1113 ¶ms->origin_to_force_quic_on); |
1113 params->enable_user_alternate_protocol_ports = | 1114 params->enable_user_alternate_protocol_ports = |
1114 globals.enable_user_alternate_protocol_ports; | 1115 globals.enable_user_alternate_protocol_ports; |
1115 } | 1116 } |
1116 | 1117 |
1117 base::TimeTicks IOThread::creation_time() const { | 1118 base::TimeTicks IOThread::creation_time() const { |
1118 return creation_time_; | 1119 return creation_time_; |
1119 } | 1120 } |
1120 | 1121 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1235 } | 1236 } |
1236 float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params); | 1237 float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params); |
1237 if (packet_loss_threshold != 0) | 1238 if (packet_loss_threshold != 0) |
1238 globals->quic_packet_loss_threshold.set(packet_loss_threshold); | 1239 globals->quic_packet_loss_threshold.set(packet_loss_threshold); |
1239 globals->enable_quic_port_selection.set( | 1240 globals->enable_quic_port_selection.set( |
1240 ShouldEnableQuicPortSelection(command_line)); | 1241 ShouldEnableQuicPortSelection(command_line)); |
1241 globals->quic_connection_options = | 1242 globals->quic_connection_options = |
1242 GetQuicConnectionOptions(command_line, quic_trial_params); | 1243 GetQuicConnectionOptions(command_line, quic_trial_params); |
1243 globals->quic_close_sessions_on_ip_change.set( | 1244 globals->quic_close_sessions_on_ip_change.set( |
1244 ShouldQuicCloseSessionsOnIpChange(quic_trial_params)); | 1245 ShouldQuicCloseSessionsOnIpChange(quic_trial_params)); |
1246 globals->quic_migrate_sessions_on_net_change.set( | |
1247 ShouldQuicMigrateSessionsOnNetChange(quic_trial_params)); | |
1245 } | 1248 } |
1246 | 1249 |
1247 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | 1250 size_t max_packet_length = GetQuicMaxPacketLength(command_line, |
1248 quic_trial_params); | 1251 quic_trial_params); |
1249 if (max_packet_length != 0) { | 1252 if (max_packet_length != 0) { |
1250 globals->quic_max_packet_length.set(max_packet_length); | 1253 globals->quic_max_packet_length.set(max_packet_length); |
1251 } | 1254 } |
1252 | 1255 |
1253 std::string quic_user_agent_id = chrome::GetChannelString(); | 1256 std::string quic_user_agent_id = chrome::GetChannelString(); |
1254 if (!quic_user_agent_id.empty()) | 1257 if (!quic_user_agent_id.empty()) |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1476 GetVariationParam(quic_trial_params, "delay_tcp_race"), "true"); | 1479 GetVariationParam(quic_trial_params, "delay_tcp_race"), "true"); |
1477 } | 1480 } |
1478 | 1481 |
1479 bool IOThread::ShouldQuicCloseSessionsOnIpChange( | 1482 bool IOThread::ShouldQuicCloseSessionsOnIpChange( |
1480 const VariationParameters& quic_trial_params) { | 1483 const VariationParameters& quic_trial_params) { |
1481 return base::LowerCaseEqualsASCII( | 1484 return base::LowerCaseEqualsASCII( |
1482 GetVariationParam(quic_trial_params, "close_sessions_on_ip_change"), | 1485 GetVariationParam(quic_trial_params, "close_sessions_on_ip_change"), |
1483 "true"); | 1486 "true"); |
1484 } | 1487 } |
1485 | 1488 |
1489 bool IOThread::ShouldQuicMigrateSessionsOnNetChange( | |
1490 const VariationParameters& quic_trial_params) { | |
1491 #if defined(OS_ANDROID) | |
1492 &&base::android::BuildInfo::GetInstance()->sdk_int() >= | |
1493 base::android::SDK_VERSION_LOLLIPOP | |
1494 // Migration only implemented for Android versions >= L. | |
Ryan Hamilton
2015/11/17 14:37:10
I was thinking about this. This code is here becau
Jana
2015/11/18 04:31:41
Yeah -- I hadn't done that yet. But you're right t
pauljensen
2015/11/18 17:24:23
ya, adding a NetworkChangeNotifier API for this SG
Jana
2015/11/18 21:44:17
Yeah, I think this belongs in the NetworkChangeNot
Ryan Hamilton
2015/11/18 22:23:35
One idea might be to have NetworkChangeNotifier::A
Jana
2015/11/21 02:21:22
Ongoing in https://codereview.chromium.org/1454313
| |
1495 return base::LowerCaseEqualsASCII( | |
1496 GetVariationParam(quic_trial_params, | |
1497 "migrate_sessions_on_net_change"), | |
1498 "true"); | |
1499 #endif | |
1500 return false; | |
1501 } | |
Ryan Hamilton
2015/11/17 04:57:27
Since this code is conditional, I'm surprised the
Jana
2015/11/18 04:31:41
code's not conditional anymore, so tests should be
| |
1502 | |
1486 size_t IOThread::GetQuicMaxPacketLength( | 1503 size_t IOThread::GetQuicMaxPacketLength( |
1487 const base::CommandLine& command_line, | 1504 const base::CommandLine& command_line, |
1488 const VariationParameters& quic_trial_params) { | 1505 const VariationParameters& quic_trial_params) { |
1489 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | 1506 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { |
1490 unsigned value; | 1507 unsigned value; |
1491 if (!base::StringToUint( | 1508 if (!base::StringToUint( |
1492 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), | 1509 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), |
1493 &value)) { | 1510 &value)) { |
1494 return 0; | 1511 return 0; |
1495 } | 1512 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1654 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | 1671 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); |
1655 | 1672 |
1656 context->set_job_factory( | 1673 context->set_job_factory( |
1657 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1674 globals->proxy_script_fetcher_url_request_job_factory.get()); |
1658 | 1675 |
1659 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1676 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
1660 // system URLRequestContext too. There's no reason this should be tied to a | 1677 // system URLRequestContext too. There's no reason this should be tied to a |
1661 // profile. | 1678 // profile. |
1662 return context; | 1679 return context; |
1663 } | 1680 } |
OLD | NEW |