| 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 "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // TODO(xunjieli): Refactor constants in io_thread.cc. | 23 // TODO(xunjieli): Refactor constants in io_thread.cc. |
| 24 const char kQuicFieldTrialName[] = "QUIC"; | 24 const char kQuicFieldTrialName[] = "QUIC"; |
| 25 const char kQuicConnectionOptions[] = "connection_options"; | 25 const char kQuicConnectionOptions[] = "connection_options"; |
| 26 const char kQuicStoreServerConfigsInProperties[] = | 26 const char kQuicStoreServerConfigsInProperties[] = |
| 27 "store_server_configs_in_properties"; | 27 "store_server_configs_in_properties"; |
| 28 const char kQuicDelayTcpRace[] = "delay_tcp_race"; | 28 const char kQuicDelayTcpRace[] = "delay_tcp_race"; |
| 29 const char kQuicMaxNumberOfLossyConnections[] = | 29 const char kQuicMaxNumberOfLossyConnections[] = |
| 30 "max_number_of_lossy_connections"; | 30 "max_number_of_lossy_connections"; |
| 31 const char kQuicPacketLossThreshold[] = "packet_loss_threshold"; | 31 const char kQuicPacketLossThreshold[] = "packet_loss_threshold"; |
| 32 const char kQuicIdleConnectionTimeoutSeconds[] = |
| 33 "idle_connection_timeout_seconds"; |
| 32 | 34 |
| 33 // AsyncDNS experiment dictionary name. | 35 // AsyncDNS experiment dictionary name. |
| 34 const char kAsyncDnsFieldTrialName[] = "AsyncDNS"; | 36 const char kAsyncDnsFieldTrialName[] = "AsyncDNS"; |
| 35 // Name of boolean to enable AsyncDNS experiment. | 37 // Name of boolean to enable AsyncDNS experiment. |
| 36 const char kAsyncDnsEnable[] = "enable"; | 38 const char kAsyncDnsEnable[] = "enable"; |
| 37 | 39 |
| 38 void ParseAndSetExperimentalOptions( | 40 void ParseAndSetExperimentalOptions( |
| 39 const std::string& experimental_options, | 41 const std::string& experimental_options, |
| 40 net::URLRequestContextBuilder* context_builder, | 42 net::URLRequestContextBuilder* context_builder, |
| 41 net::NetLog* net_log) { | 43 net::NetLog* net_log) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 context_builder->set_quic_max_number_of_lossy_connections( | 90 context_builder->set_quic_max_number_of_lossy_connections( |
| 89 quic_max_number_of_lossy_connections); | 91 quic_max_number_of_lossy_connections); |
| 90 } | 92 } |
| 91 | 93 |
| 92 double quic_packet_loss_threshold = 0.0; | 94 double quic_packet_loss_threshold = 0.0; |
| 93 if (quic_args->GetDouble(kQuicPacketLossThreshold, | 95 if (quic_args->GetDouble(kQuicPacketLossThreshold, |
| 94 &quic_packet_loss_threshold)) { | 96 &quic_packet_loss_threshold)) { |
| 95 context_builder->set_quic_packet_loss_threshold( | 97 context_builder->set_quic_packet_loss_threshold( |
| 96 quic_packet_loss_threshold); | 98 quic_packet_loss_threshold); |
| 97 } | 99 } |
| 100 |
| 101 int quic_idle_connection_timeout_seconds = 0; |
| 102 if (quic_args->GetInteger(kQuicIdleConnectionTimeoutSeconds, |
| 103 &quic_idle_connection_timeout_seconds)) { |
| 104 context_builder->set_quic_idle_connection_timeout_seconds( |
| 105 quic_idle_connection_timeout_seconds); |
| 106 } |
| 98 } | 107 } |
| 99 | 108 |
| 100 const base::DictionaryValue* async_dns_args = nullptr; | 109 const base::DictionaryValue* async_dns_args = nullptr; |
| 101 if (dict->GetDictionary(kAsyncDnsFieldTrialName, &async_dns_args)) { | 110 if (dict->GetDictionary(kAsyncDnsFieldTrialName, &async_dns_args)) { |
| 102 bool async_dns_enable = false; | 111 bool async_dns_enable = false; |
| 103 if (async_dns_args->GetBoolean(kAsyncDnsEnable, &async_dns_enable) && | 112 if (async_dns_args->GetBoolean(kAsyncDnsEnable, &async_dns_enable) && |
| 104 async_dns_enable) { | 113 async_dns_enable) { |
| 105 if (net_log == nullptr) { | 114 if (net_log == nullptr) { |
| 106 DCHECK(false) << "AsyncDNS experiment requires NetLog."; | 115 DCHECK(false) << "AsyncDNS experiment requires NetLog."; |
| 107 } else { | 116 } else { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 198 |
| 190 ParseAndSetExperimentalOptions(experimental_options, context_builder, | 199 ParseAndSetExperimentalOptions(experimental_options, context_builder, |
| 191 net_log); | 200 net_log); |
| 192 | 201 |
| 193 if (mock_cert_verifier) | 202 if (mock_cert_verifier) |
| 194 context_builder->SetCertVerifier(mock_cert_verifier.Pass()); | 203 context_builder->SetCertVerifier(mock_cert_verifier.Pass()); |
| 195 // TODO(mef): Use |config| to set cookies. | 204 // TODO(mef): Use |config| to set cookies. |
| 196 } | 205 } |
| 197 | 206 |
| 198 } // namespace cronet | 207 } // namespace cronet |
| OLD | NEW |