| 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 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 globals.quic_delay_tcp_race.CopyToIfSet(¶ms->quic_delay_tcp_race); | 1075 globals.quic_delay_tcp_race.CopyToIfSet(¶ms->quic_delay_tcp_race); |
| 1076 globals.enable_quic_port_selection.CopyToIfSet( | 1076 globals.enable_quic_port_selection.CopyToIfSet( |
| 1077 ¶ms->enable_quic_port_selection); | 1077 ¶ms->enable_quic_port_selection); |
| 1078 globals.quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); | 1078 globals.quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); |
| 1079 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); | 1079 globals.quic_user_agent_id.CopyToIfSet(¶ms->quic_user_agent_id); |
| 1080 globals.quic_supported_versions.CopyToIfSet( | 1080 globals.quic_supported_versions.CopyToIfSet( |
| 1081 ¶ms->quic_supported_versions); | 1081 ¶ms->quic_supported_versions); |
| 1082 params->quic_connection_options = globals.quic_connection_options; | 1082 params->quic_connection_options = globals.quic_connection_options; |
| 1083 globals.quic_close_sessions_on_ip_change.CopyToIfSet( | 1083 globals.quic_close_sessions_on_ip_change.CopyToIfSet( |
| 1084 ¶ms->quic_close_sessions_on_ip_change); | 1084 ¶ms->quic_close_sessions_on_ip_change); |
| 1085 globals.quic_migrate_sessions_on_net_change.CopyToIfSet( |
| 1086 ¶ms->quic_migrate_sessions_on_net_change); |
| 1085 | 1087 |
| 1086 globals.origin_to_force_quic_on.CopyToIfSet( | 1088 globals.origin_to_force_quic_on.CopyToIfSet( |
| 1087 ¶ms->origin_to_force_quic_on); | 1089 ¶ms->origin_to_force_quic_on); |
| 1088 params->enable_user_alternate_protocol_ports = | 1090 params->enable_user_alternate_protocol_ports = |
| 1089 globals.enable_user_alternate_protocol_ports; | 1091 globals.enable_user_alternate_protocol_ports; |
| 1090 } | 1092 } |
| 1091 | 1093 |
| 1092 base::TimeTicks IOThread::creation_time() const { | 1094 base::TimeTicks IOThread::creation_time() const { |
| 1093 return creation_time_; | 1095 return creation_time_; |
| 1094 } | 1096 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 } | 1214 } |
| 1213 float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params); | 1215 float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params); |
| 1214 if (packet_loss_threshold != 0) | 1216 if (packet_loss_threshold != 0) |
| 1215 globals->quic_packet_loss_threshold.set(packet_loss_threshold); | 1217 globals->quic_packet_loss_threshold.set(packet_loss_threshold); |
| 1216 globals->enable_quic_port_selection.set( | 1218 globals->enable_quic_port_selection.set( |
| 1217 ShouldEnableQuicPortSelection(command_line)); | 1219 ShouldEnableQuicPortSelection(command_line)); |
| 1218 globals->quic_connection_options = | 1220 globals->quic_connection_options = |
| 1219 GetQuicConnectionOptions(command_line, quic_trial_params); | 1221 GetQuicConnectionOptions(command_line, quic_trial_params); |
| 1220 globals->quic_close_sessions_on_ip_change.set( | 1222 globals->quic_close_sessions_on_ip_change.set( |
| 1221 ShouldQuicCloseSessionsOnIpChange(quic_trial_params)); | 1223 ShouldQuicCloseSessionsOnIpChange(quic_trial_params)); |
| 1224 globals->quic_migrate_sessions_on_net_change.set( |
| 1225 ShouldQuicMigrateSessionsOnNetChange(quic_trial_params)); |
| 1222 } | 1226 } |
| 1223 | 1227 |
| 1224 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | 1228 size_t max_packet_length = GetQuicMaxPacketLength(command_line, |
| 1225 quic_trial_params); | 1229 quic_trial_params); |
| 1226 if (max_packet_length != 0) { | 1230 if (max_packet_length != 0) { |
| 1227 globals->quic_max_packet_length.set(max_packet_length); | 1231 globals->quic_max_packet_length.set(max_packet_length); |
| 1228 } | 1232 } |
| 1229 | 1233 |
| 1230 std::string quic_user_agent_id = chrome::GetChannelString(); | 1234 std::string quic_user_agent_id = chrome::GetChannelString(); |
| 1231 if (!quic_user_agent_id.empty()) | 1235 if (!quic_user_agent_id.empty()) |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 GetVariationParam(quic_trial_params, "delay_tcp_race"), "true"); | 1468 GetVariationParam(quic_trial_params, "delay_tcp_race"), "true"); |
| 1465 } | 1469 } |
| 1466 | 1470 |
| 1467 bool IOThread::ShouldQuicCloseSessionsOnIpChange( | 1471 bool IOThread::ShouldQuicCloseSessionsOnIpChange( |
| 1468 const VariationParameters& quic_trial_params) { | 1472 const VariationParameters& quic_trial_params) { |
| 1469 return base::LowerCaseEqualsASCII( | 1473 return base::LowerCaseEqualsASCII( |
| 1470 GetVariationParam(quic_trial_params, "close_sessions_on_ip_change"), | 1474 GetVariationParam(quic_trial_params, "close_sessions_on_ip_change"), |
| 1471 "true"); | 1475 "true"); |
| 1472 } | 1476 } |
| 1473 | 1477 |
| 1478 bool IOThread::ShouldQuicMigrateSessionsOnNetChange( |
| 1479 const VariationParameters& quic_trial_params) { |
| 1480 #if defined(OS_ANDROID) |
| 1481 && base::android::BuildInfo::GetInstance()->sdk_int() >= |
| 1482 base::android::SDK_VERSION_LOLLIPOP |
| 1483 // Migration only implemented for Android versions >= L. |
| 1484 return base::LowerCaseEqualsASCII( |
| 1485 GetVariationParam(quic_trial_params, "migrate_sessions_on_net_change"), |
| 1486 "true"); |
| 1487 #endif |
| 1488 return false; |
| 1489 } |
| 1490 |
| 1474 size_t IOThread::GetQuicMaxPacketLength( | 1491 size_t IOThread::GetQuicMaxPacketLength( |
| 1475 const base::CommandLine& command_line, | 1492 const base::CommandLine& command_line, |
| 1476 const VariationParameters& quic_trial_params) { | 1493 const VariationParameters& quic_trial_params) { |
| 1477 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | 1494 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { |
| 1478 unsigned value; | 1495 unsigned value; |
| 1479 if (!base::StringToUint( | 1496 if (!base::StringToUint( |
| 1480 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), | 1497 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), |
| 1481 &value)) { | 1498 &value)) { |
| 1482 return 0; | 1499 return 0; |
| 1483 } | 1500 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | 1659 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); |
| 1643 | 1660 |
| 1644 context->set_job_factory( | 1661 context->set_job_factory( |
| 1645 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1662 globals->proxy_script_fetcher_url_request_job_factory.get()); |
| 1646 | 1663 |
| 1647 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1664 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 1648 // system URLRequestContext too. There's no reason this should be tied to a | 1665 // system URLRequestContext too. There's no reason this should be tied to a |
| 1649 // profile. | 1666 // profile. |
| 1650 return context; | 1667 return context; |
| 1651 } | 1668 } |
| OLD | NEW |