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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 globals_->enable_spdy_ping_based_connection_checking.CopyToIfSet( | 1009 globals_->enable_spdy_ping_based_connection_checking.CopyToIfSet( |
1010 ¶ms->enable_spdy_ping_based_connection_checking); | 1010 ¶ms->enable_spdy_ping_based_connection_checking); |
1011 globals_->spdy_default_protocol.CopyToIfSet( | 1011 globals_->spdy_default_protocol.CopyToIfSet( |
1012 ¶ms->spdy_default_protocol); | 1012 ¶ms->spdy_default_protocol); |
1013 globals_->trusted_spdy_proxy.CopyToIfSet( | 1013 globals_->trusted_spdy_proxy.CopyToIfSet( |
1014 ¶ms->trusted_spdy_proxy); | 1014 ¶ms->trusted_spdy_proxy); |
1015 globals_->enable_quic.CopyToIfSet(¶ms->enable_quic); | 1015 globals_->enable_quic.CopyToIfSet(¶ms->enable_quic); |
1016 globals_->enable_quic_https.CopyToIfSet(¶ms->enable_quic_https); | 1016 globals_->enable_quic_https.CopyToIfSet(¶ms->enable_quic_https); |
1017 globals_->enable_quic_pacing.CopyToIfSet( | 1017 globals_->enable_quic_pacing.CopyToIfSet( |
1018 ¶ms->enable_quic_pacing); | 1018 ¶ms->enable_quic_pacing); |
| 1019 globals_->enable_quic_persist_server_info.CopyToIfSet( |
| 1020 ¶ms->enable_quic_persist_server_info); |
1019 globals_->enable_quic_port_selection.CopyToIfSet( | 1021 globals_->enable_quic_port_selection.CopyToIfSet( |
1020 ¶ms->enable_quic_port_selection); | 1022 ¶ms->enable_quic_port_selection); |
1021 globals_->quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); | 1023 globals_->quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); |
1022 globals_->quic_supported_versions.CopyToIfSet( | 1024 globals_->quic_supported_versions.CopyToIfSet( |
1023 ¶ms->quic_supported_versions); | 1025 ¶ms->quic_supported_versions); |
1024 globals_->origin_to_force_quic_on.CopyToIfSet( | 1026 globals_->origin_to_force_quic_on.CopyToIfSet( |
1025 ¶ms->origin_to_force_quic_on); | 1027 ¶ms->origin_to_force_quic_on); |
1026 params->enable_user_alternate_protocol_ports = | 1028 params->enable_user_alternate_protocol_ports = |
1027 globals_->enable_user_alternate_protocol_ports; | 1029 globals_->enable_user_alternate_protocol_ports; |
1028 } | 1030 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 std::string quic_trial_group = | 1102 std::string quic_trial_group = |
1101 base::FieldTrialList::FindFullName(kQuicFieldTrialName); | 1103 base::FieldTrialList::FindFullName(kQuicFieldTrialName); |
1102 | 1104 |
1103 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group); | 1105 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group); |
1104 globals_->enable_quic.set(enable_quic); | 1106 globals_->enable_quic.set(enable_quic); |
1105 if (enable_quic) { | 1107 if (enable_quic) { |
1106 globals_->enable_quic_https.set( | 1108 globals_->enable_quic_https.set( |
1107 ShouldEnableQuicHttps(command_line, quic_trial_group)); | 1109 ShouldEnableQuicHttps(command_line, quic_trial_group)); |
1108 globals_->enable_quic_pacing.set( | 1110 globals_->enable_quic_pacing.set( |
1109 ShouldEnableQuicPacing(command_line, quic_trial_group)); | 1111 ShouldEnableQuicPacing(command_line, quic_trial_group)); |
| 1112 globals_->enable_quic_persist_server_info.set( |
| 1113 ShouldEnableQuicPersistServerInfo(command_line)); |
1110 globals_->enable_quic_port_selection.set( | 1114 globals_->enable_quic_port_selection.set( |
1111 ShouldEnableQuicPortSelection(command_line)); | 1115 ShouldEnableQuicPortSelection(command_line)); |
1112 } | 1116 } |
1113 | 1117 |
1114 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | 1118 size_t max_packet_length = GetQuicMaxPacketLength(command_line, |
1115 quic_trial_group); | 1119 quic_trial_group); |
1116 if (max_packet_length != 0) { | 1120 if (max_packet_length != 0) { |
1117 globals_->quic_max_packet_length.set(max_packet_length); | 1121 globals_->quic_max_packet_length.set(max_packet_length); |
1118 } | 1122 } |
1119 | 1123 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 base::StringPiece quic_trial_group) { | 1193 base::StringPiece quic_trial_group) { |
1190 if (command_line.HasSwitch(switches::kEnableQuicPacing)) | 1194 if (command_line.HasSwitch(switches::kEnableQuicPacing)) |
1191 return true; | 1195 return true; |
1192 | 1196 |
1193 if (command_line.HasSwitch(switches::kDisableQuicPacing)) | 1197 if (command_line.HasSwitch(switches::kDisableQuicPacing)) |
1194 return false; | 1198 return false; |
1195 | 1199 |
1196 return quic_trial_group.ends_with(kQuicFieldTrialPacingSuffix); | 1200 return quic_trial_group.ends_with(kQuicFieldTrialPacingSuffix); |
1197 } | 1201 } |
1198 | 1202 |
| 1203 bool IOThread::ShouldEnableQuicPersistServerInfo( |
| 1204 const CommandLine& command_line) { |
| 1205 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
| 1206 // Avoid persisting of Quic server config information to disk cache when we |
| 1207 // have a beta or stable release. Allow in all other cases, including when we |
| 1208 // do a developer build (CHANNEL_UNKNOWN). |
| 1209 if (channel == chrome::VersionInfo::CHANNEL_STABLE || |
| 1210 channel == chrome::VersionInfo::CHANNEL_BETA) { |
| 1211 return false; |
| 1212 } |
| 1213 return true; |
| 1214 } |
| 1215 |
1199 size_t IOThread::GetQuicMaxPacketLength(const CommandLine& command_line, | 1216 size_t IOThread::GetQuicMaxPacketLength(const CommandLine& command_line, |
1200 base::StringPiece quic_trial_group) { | 1217 base::StringPiece quic_trial_group) { |
1201 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | 1218 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { |
1202 unsigned value; | 1219 unsigned value; |
1203 if (!base::StringToUint( | 1220 if (!base::StringToUint( |
1204 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), | 1221 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), |
1205 &value)) { | 1222 &value)) { |
1206 return 0; | 1223 return 0; |
1207 } | 1224 } |
1208 return value; | 1225 return value; |
(...skipping 28 matching lines...) Expand all Loading... |
1237 std::string version_flag = | 1254 std::string version_flag = |
1238 command_line.GetSwitchValueASCII(switches::kQuicVersion); | 1255 command_line.GetSwitchValueASCII(switches::kQuicVersion); |
1239 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1256 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1240 net::QuicVersion version = supported_versions[i]; | 1257 net::QuicVersion version = supported_versions[i]; |
1241 if (net::QuicVersionToString(version) == version_flag) { | 1258 if (net::QuicVersionToString(version) == version_flag) { |
1242 return version; | 1259 return version; |
1243 } | 1260 } |
1244 } | 1261 } |
1245 return net::QUIC_VERSION_UNSUPPORTED; | 1262 return net::QUIC_VERSION_UNSUPPORTED; |
1246 } | 1263 } |
OLD | NEW |