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 #include <unordered_set> | 8 #include <unordered_set> |
9 | 9 |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 params->quic_user_agent_id = quic_user_agent_id; | 314 params->quic_user_agent_id = quic_user_agent_id; |
315 | 315 |
316 net::QuicVersion version = GetQuicVersion(quic_trial_params); | 316 net::QuicVersion version = GetQuicVersion(quic_trial_params); |
317 if (version != net::QUIC_VERSION_UNSUPPORTED) { | 317 if (version != net::QUIC_VERSION_UNSUPPORTED) { |
318 net::QuicVersionVector supported_versions; | 318 net::QuicVersionVector supported_versions; |
319 supported_versions.push_back(version); | 319 supported_versions.push_back(version); |
320 params->quic_supported_versions = supported_versions; | 320 params->quic_supported_versions = supported_versions; |
321 } | 321 } |
322 } | 322 } |
323 | 323 |
324 void ConfigureOptimizePreconnectsToProxiesParams( | |
325 const std::map<std::string, std::string>& proxy_preconnects_trial_params, | |
326 net::HttpNetworkSession::Params* params) { | |
327 params->restrict_to_one_preconnect_for_proxies = | |
328 GetVariationParam(proxy_preconnects_trial_params, | |
329 "restrict_to_one_preconnect_for_proxies") == "true"; | |
330 } | |
331 | |
332 } // anonymous namespace | 324 } // anonymous namespace |
333 | 325 |
334 namespace network_session_configurator { | 326 namespace network_session_configurator { |
335 | 327 |
336 net::QuicVersion ParseQuicVersion(const std::string& quic_version) { | 328 net::QuicVersion ParseQuicVersion(const std::string& quic_version) { |
337 net::QuicVersionVector supported_versions = net::AllSupportedVersions(); | 329 net::QuicVersionVector supported_versions = net::AllSupportedVersions(); |
338 for (size_t i = 0; i < supported_versions.size(); ++i) { | 330 for (size_t i = 0; i < supported_versions.size(); ++i) { |
339 net::QuicVersion version = supported_versions[i]; | 331 net::QuicVersion version = supported_versions[i]; |
340 if (net::QuicVersionToString(version) == quic_version) { | 332 if (net::QuicVersionToString(version) == quic_version) { |
341 return version; | 333 return version; |
(...skipping 23 matching lines...) Expand all Loading... | |
365 &http2_trial_params)) | 357 &http2_trial_params)) |
366 http2_trial_params.clear(); | 358 http2_trial_params.clear(); |
367 ConfigureHttp2Params(http2_trial_group, http2_trial_params, params); | 359 ConfigureHttp2Params(http2_trial_group, http2_trial_params, params); |
368 | 360 |
369 const std::string tfo_trial_group = | 361 const std::string tfo_trial_group = |
370 base::FieldTrialList::FindFullName(kTCPFastOpenFieldTrialName); | 362 base::FieldTrialList::FindFullName(kTCPFastOpenFieldTrialName); |
371 ConfigureTCPFastOpenParams(tfo_trial_group, params); | 363 ConfigureTCPFastOpenParams(tfo_trial_group, params); |
372 | 364 |
373 std::map<std::string, std::string> proxy_preconnects_trial_params; | 365 std::map<std::string, std::string> proxy_preconnects_trial_params; |
374 variations::GetVariationParams("NetProxyPreconnects", | 366 variations::GetVariationParams("NetProxyPreconnects", |
375 &proxy_preconnects_trial_params); | 367 &proxy_preconnects_trial_params); |
xunjieli
2017/04/28 14:24:30
Can we get rid of line 365 - 367?
tbansal1
2017/04/28 16:36:08
Good catch. Done.
| |
376 ConfigureOptimizePreconnectsToProxiesParams(proxy_preconnects_trial_params, | |
377 params); | |
378 } | 368 } |
379 | 369 |
380 } // namespace network_session_configurator | 370 } // namespace network_session_configurator |
OLD | NEW |