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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 params->quic_user_agent_id = quic_user_agent_id; | 361 params->quic_user_agent_id = quic_user_agent_id; |
362 | 362 |
363 net::QuicVersion version = GetQuicVersion(quic_trial_params); | 363 net::QuicVersion version = GetQuicVersion(quic_trial_params); |
364 if (version != net::QUIC_VERSION_UNSUPPORTED) { | 364 if (version != net::QUIC_VERSION_UNSUPPORTED) { |
365 net::QuicVersionVector supported_versions; | 365 net::QuicVersionVector supported_versions; |
366 supported_versions.push_back(version); | 366 supported_versions.push_back(version); |
367 params->quic_supported_versions = supported_versions; | 367 params->quic_supported_versions = supported_versions; |
368 } | 368 } |
369 } | 369 } |
370 | 370 |
| 371 void ConfigureOptimizePreconnectsToProxiesParams( |
| 372 const std::map<std::string, std::string>& proxy_preconnects_trial_params, |
| 373 net::HttpNetworkSession::Params* params) { |
| 374 params->restrict_to_one_preconnect_for_proxies = |
| 375 GetVariationParam(proxy_preconnects_trial_params, |
| 376 "restrict_to_one_preconnect_for_proxies") == "true"; |
| 377 } |
| 378 |
371 } // anonymous namespace | 379 } // anonymous namespace |
372 | 380 |
373 namespace network_session_configurator { | 381 namespace network_session_configurator { |
374 | 382 |
375 net::QuicVersion ParseQuicVersion(const std::string& quic_version) { | 383 net::QuicVersion ParseQuicVersion(const std::string& quic_version) { |
376 net::QuicVersionVector supported_versions = net::AllSupportedVersions(); | 384 net::QuicVersionVector supported_versions = net::AllSupportedVersions(); |
377 for (size_t i = 0; i < supported_versions.size(); ++i) { | 385 for (size_t i = 0; i < supported_versions.size(); ++i) { |
378 net::QuicVersion version = supported_versions[i]; | 386 net::QuicVersion version = supported_versions[i]; |
379 if (net::QuicVersionToString(version) == quic_version) { | 387 if (net::QuicVersionToString(version) == quic_version) { |
380 return version; | 388 return version; |
(...skipping 16 matching lines...) Expand all Loading... |
397 is_quic_force_disabled, is_quic_force_enabled, | 405 is_quic_force_disabled, is_quic_force_enabled, |
398 quic_user_agent_id, params); | 406 quic_user_agent_id, params); |
399 | 407 |
400 std::string http2_trial_group = | 408 std::string http2_trial_group = |
401 base::FieldTrialList::FindFullName(kHttp2FieldTrialName); | 409 base::FieldTrialList::FindFullName(kHttp2FieldTrialName); |
402 ConfigureHttp2Params(http2_trial_group, params); | 410 ConfigureHttp2Params(http2_trial_group, params); |
403 | 411 |
404 const std::string tfo_trial_group = | 412 const std::string tfo_trial_group = |
405 base::FieldTrialList::FindFullName(kTCPFastOpenFieldTrialName); | 413 base::FieldTrialList::FindFullName(kTCPFastOpenFieldTrialName); |
406 ConfigureTCPFastOpenParams(tfo_trial_group, params); | 414 ConfigureTCPFastOpenParams(tfo_trial_group, params); |
| 415 |
| 416 std::map<std::string, std::string> proxy_preconnects_trial_params; |
| 417 variations::GetVariationParams("NetProxyPreconnects", |
| 418 &proxy_preconnects_trial_params); |
| 419 ConfigureOptimizePreconnectsToProxiesParams(proxy_preconnects_trial_params, |
| 420 params); |
407 } | 421 } |
408 | 422 |
409 } // namespace network_session_configurator | 423 } // namespace network_session_configurator |
OLD | NEW |