| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cronet/url_request_context_config.h" | 5 #include "components/cronet/url_request_context_config.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 const char kQuicPacketLossThreshold[] = "packet_loss_threshold"; | 37 const char kQuicPacketLossThreshold[] = "packet_loss_threshold"; |
| 38 const char kQuicIdleConnectionTimeoutSeconds[] = | 38 const char kQuicIdleConnectionTimeoutSeconds[] = |
| 39 "idle_connection_timeout_seconds"; | 39 "idle_connection_timeout_seconds"; |
| 40 const char kQuicHostWhitelist[] = "host_whitelist"; | 40 const char kQuicHostWhitelist[] = "host_whitelist"; |
| 41 const char kQuicCloseSessionsOnIpChange[] = "close_sessions_on_ip_change"; | 41 const char kQuicCloseSessionsOnIpChange[] = "close_sessions_on_ip_change"; |
| 42 const char kQuicMigrateSessionsOnNetworkChange[] = | 42 const char kQuicMigrateSessionsOnNetworkChange[] = |
| 43 "migrate_sessions_on_network_change"; | 43 "migrate_sessions_on_network_change"; |
| 44 const char kQuicPreferAes[] = "prefer_aes"; | 44 const char kQuicPreferAes[] = "prefer_aes"; |
| 45 const char kQuicUserAgentId[] = "user_agent_id"; | 45 const char kQuicUserAgentId[] = "user_agent_id"; |
| 46 const char kQuicMigrateSessionsEarly[] = "migrate_sessions_early"; | 46 const char kQuicMigrateSessionsEarly[] = "migrate_sessions_early"; |
| 47 // Disable QUIC when using net::BidirectionalStream. |
| 48 const char kDisableBidirectionalStreamQuicImpl[] = |
| 49 "disable_bidirectional_stream_quic_impl"; |
| 47 | 50 |
| 48 // AsyncDNS experiment dictionary name. | 51 // AsyncDNS experiment dictionary name. |
| 49 const char kAsyncDnsFieldTrialName[] = "AsyncDNS"; | 52 const char kAsyncDnsFieldTrialName[] = "AsyncDNS"; |
| 50 // Name of boolean to enable AsyncDNS experiment. | 53 // Name of boolean to enable AsyncDNS experiment. |
| 51 const char kAsyncDnsEnable[] = "enable"; | 54 const char kAsyncDnsEnable[] = "enable"; |
| 52 | 55 |
| 53 void ParseAndSetExperimentalOptions( | 56 void ParseAndSetExperimentalOptions( |
| 54 const std::string& experimental_options, | 57 const std::string& experimental_options, |
| 55 net::URLRequestContextBuilder* context_builder, | 58 net::URLRequestContextBuilder* context_builder, |
| 56 net::NetLog* net_log) { | 59 net::NetLog* net_log) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 if (quic_args->GetString(kQuicUserAgentId, &quic_user_agent_id)) { | 164 if (quic_args->GetString(kQuicUserAgentId, &quic_user_agent_id)) { |
| 162 context_builder->set_quic_user_agent_id(quic_user_agent_id); | 165 context_builder->set_quic_user_agent_id(quic_user_agent_id); |
| 163 } | 166 } |
| 164 | 167 |
| 165 bool quic_migrate_sessions_early = false; | 168 bool quic_migrate_sessions_early = false; |
| 166 if (quic_args->GetBoolean(kQuicMigrateSessionsEarly, | 169 if (quic_args->GetBoolean(kQuicMigrateSessionsEarly, |
| 167 &quic_migrate_sessions_early)) { | 170 &quic_migrate_sessions_early)) { |
| 168 context_builder->set_quic_migrate_sessions_early( | 171 context_builder->set_quic_migrate_sessions_early( |
| 169 quic_migrate_sessions_early); | 172 quic_migrate_sessions_early); |
| 170 } | 173 } |
| 174 |
| 175 bool disable_bidirectional_stream_quic_impl = false; |
| 176 if (quic_args->GetBoolean(kDisableBidirectionalStreamQuicImpl, |
| 177 &disable_bidirectional_stream_quic_impl)) { |
| 178 context_builder->set_disable_bidirectional_stream_quic_impl( |
| 179 disable_bidirectional_stream_quic_impl); |
| 180 } |
| 171 } | 181 } |
| 172 | 182 |
| 173 const base::DictionaryValue* async_dns_args = nullptr; | 183 const base::DictionaryValue* async_dns_args = nullptr; |
| 174 if (dict->GetDictionary(kAsyncDnsFieldTrialName, &async_dns_args)) { | 184 if (dict->GetDictionary(kAsyncDnsFieldTrialName, &async_dns_args)) { |
| 175 bool async_dns_enable = false; | 185 bool async_dns_enable = false; |
| 176 if (async_dns_args->GetBoolean(kAsyncDnsEnable, &async_dns_enable) && | 186 if (async_dns_args->GetBoolean(kAsyncDnsEnable, &async_dns_enable) && |
| 177 async_dns_enable) { | 187 async_dns_enable) { |
| 178 if (net_log == nullptr) { | 188 if (net_log == nullptr) { |
| 179 DCHECK(false) << "AsyncDNS experiment requires NetLog."; | 189 DCHECK(false) << "AsyncDNS experiment requires NetLog."; |
| 180 } else { | 190 } else { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 276 |
| 267 ParseAndSetExperimentalOptions(experimental_options, context_builder, | 277 ParseAndSetExperimentalOptions(experimental_options, context_builder, |
| 268 net_log); | 278 net_log); |
| 269 | 279 |
| 270 if (mock_cert_verifier) | 280 if (mock_cert_verifier) |
| 271 context_builder->SetCertVerifier(std::move(mock_cert_verifier)); | 281 context_builder->SetCertVerifier(std::move(mock_cert_verifier)); |
| 272 // TODO(mef): Use |config| to set cookies. | 282 // TODO(mef): Use |config| to set cookies. |
| 273 } | 283 } |
| 274 | 284 |
| 275 } // namespace cronet | 285 } // namespace cronet |
| OLD | NEW |