OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/network_session_configurator/network_session_configurator.h
" | 5 #include "components/network_session_configurator/network_session_configurator.h
" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 "migrate_sessions_on_network_change"), | 277 "migrate_sessions_on_network_change"), |
278 "true"); | 278 "true"); |
279 } | 279 } |
280 | 280 |
281 bool ShouldQuicMigrateSessionsEarly( | 281 bool ShouldQuicMigrateSessionsEarly( |
282 const VariationParameters& quic_trial_params) { | 282 const VariationParameters& quic_trial_params) { |
283 return base::LowerCaseEqualsASCII( | 283 return base::LowerCaseEqualsASCII( |
284 GetVariationParam(quic_trial_params, "migrate_sessions_early"), "true"); | 284 GetVariationParam(quic_trial_params, "migrate_sessions_early"), "true"); |
285 } | 285 } |
286 | 286 |
| 287 bool ShouldQuicAllowServerMigration( |
| 288 const VariationParameters& quic_trial_params) { |
| 289 return base::LowerCaseEqualsASCII( |
| 290 GetVariationParam(quic_trial_params, |
| 291 "allow_server_migration"), |
| 292 "true"); |
| 293 } |
| 294 |
287 size_t GetQuicMaxPacketLength(const base::CommandLine& command_line, | 295 size_t GetQuicMaxPacketLength(const base::CommandLine& command_line, |
288 const VariationParameters& quic_trial_params) { | 296 const VariationParameters& quic_trial_params) { |
289 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | 297 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { |
290 unsigned value; | 298 unsigned value; |
291 if (!base::StringToUint( | 299 if (!base::StringToUint( |
292 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), | 300 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), |
293 &value)) { | 301 &value)) { |
294 return 0; | 302 return 0; |
295 } | 303 } |
296 return value; | 304 return value; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 idle_connection_timeout_seconds; | 395 idle_connection_timeout_seconds; |
388 } | 396 } |
389 params->quic_disable_preconnect_if_0rtt = | 397 params->quic_disable_preconnect_if_0rtt = |
390 ShouldQuicDisablePreConnectIfZeroRtt(quic_trial_params); | 398 ShouldQuicDisablePreConnectIfZeroRtt(quic_trial_params); |
391 params->quic_host_whitelist = | 399 params->quic_host_whitelist = |
392 GetQuicHostWhitelist(command_line, quic_trial_params); | 400 GetQuicHostWhitelist(command_line, quic_trial_params); |
393 params->quic_migrate_sessions_on_network_change = | 401 params->quic_migrate_sessions_on_network_change = |
394 ShouldQuicMigrateSessionsOnNetworkChange(quic_trial_params); | 402 ShouldQuicMigrateSessionsOnNetworkChange(quic_trial_params); |
395 params->quic_migrate_sessions_early = | 403 params->quic_migrate_sessions_early = |
396 ShouldQuicMigrateSessionsEarly(quic_trial_params); | 404 ShouldQuicMigrateSessionsEarly(quic_trial_params); |
| 405 params->quic_allow_server_migration = |
| 406 ShouldQuicAllowServerMigration(quic_trial_params); |
397 } | 407 } |
398 | 408 |
399 size_t max_packet_length = | 409 size_t max_packet_length = |
400 GetQuicMaxPacketLength(command_line, quic_trial_params); | 410 GetQuicMaxPacketLength(command_line, quic_trial_params); |
401 if (max_packet_length != 0) { | 411 if (max_packet_length != 0) { |
402 params->quic_max_packet_length = max_packet_length; | 412 params->quic_max_packet_length = max_packet_length; |
403 } | 413 } |
404 | 414 |
405 params->quic_user_agent_id = quic_user_agent_id; | 415 params->quic_user_agent_id = quic_user_agent_id; |
406 | 416 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 void ParseFieldTrialsAndCommandLine(bool is_quic_allowed_by_policy, | 488 void ParseFieldTrialsAndCommandLine(bool is_quic_allowed_by_policy, |
479 const std::string& quic_user_agent_id, | 489 const std::string& quic_user_agent_id, |
480 net::HttpNetworkSession::Params* params) { | 490 net::HttpNetworkSession::Params* params) { |
481 const base::CommandLine& command_line = | 491 const base::CommandLine& command_line = |
482 *base::CommandLine::ForCurrentProcess(); | 492 *base::CommandLine::ForCurrentProcess(); |
483 ParseFieldTrialsAndCommandLineInternal( | 493 ParseFieldTrialsAndCommandLineInternal( |
484 command_line, is_quic_allowed_by_policy, quic_user_agent_id, params); | 494 command_line, is_quic_allowed_by_policy, quic_user_agent_id, params); |
485 } | 495 } |
486 | 496 |
487 } // namespace network_session_configurator | 497 } // namespace network_session_configurator |
OLD | NEW |