| 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 23 matching lines...) Expand all Loading... |
| 34 // Name of disk cache directory. | 34 // Name of disk cache directory. |
| 35 const char kDiskCacheDirectoryName[] = "disk_cache"; | 35 const char kDiskCacheDirectoryName[] = "disk_cache"; |
| 36 // TODO(xunjieli): Refactor constants in io_thread.cc. | 36 // TODO(xunjieli): Refactor constants in io_thread.cc. |
| 37 const char kQuicFieldTrialName[] = "QUIC"; | 37 const char kQuicFieldTrialName[] = "QUIC"; |
| 38 const char kQuicConnectionOptions[] = "connection_options"; | 38 const char kQuicConnectionOptions[] = "connection_options"; |
| 39 const char kQuicStoreServerConfigsInProperties[] = | 39 const char kQuicStoreServerConfigsInProperties[] = |
| 40 "store_server_configs_in_properties"; | 40 "store_server_configs_in_properties"; |
| 41 const char kQuicMaxServerConfigsStoredInProperties[] = | 41 const char kQuicMaxServerConfigsStoredInProperties[] = |
| 42 "max_server_configs_stored_in_properties"; | 42 "max_server_configs_stored_in_properties"; |
| 43 const char kQuicDelayTcpRace[] = "delay_tcp_race"; | 43 const char kQuicDelayTcpRace[] = "delay_tcp_race"; |
| 44 const char kQuicMaxNumberOfLossyConnections[] = | |
| 45 "max_number_of_lossy_connections"; | |
| 46 const char kQuicPacketLossThreshold[] = "packet_loss_threshold"; | |
| 47 const char kQuicIdleConnectionTimeoutSeconds[] = | 44 const char kQuicIdleConnectionTimeoutSeconds[] = |
| 48 "idle_connection_timeout_seconds"; | 45 "idle_connection_timeout_seconds"; |
| 49 const char kQuicHostWhitelist[] = "host_whitelist"; | 46 const char kQuicHostWhitelist[] = "host_whitelist"; |
| 50 const char kQuicCloseSessionsOnIpChange[] = "close_sessions_on_ip_change"; | 47 const char kQuicCloseSessionsOnIpChange[] = "close_sessions_on_ip_change"; |
| 51 const char kQuicMigrateSessionsOnNetworkChange[] = | 48 const char kQuicMigrateSessionsOnNetworkChange[] = |
| 52 "migrate_sessions_on_network_change"; | 49 "migrate_sessions_on_network_change"; |
| 53 const char kQuicPreferAes[] = "prefer_aes"; | 50 const char kQuicPreferAes[] = "prefer_aes"; |
| 54 const char kQuicUserAgentId[] = "user_agent_id"; | 51 const char kQuicUserAgentId[] = "user_agent_id"; |
| 55 const char kQuicMigrateSessionsEarly[] = "migrate_sessions_early"; | 52 const char kQuicMigrateSessionsEarly[] = "migrate_sessions_early"; |
| 56 const char kQuicDisableBidirectionalStreams[] = | 53 const char kQuicDisableBidirectionalStreams[] = |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 &quic_max_server_configs_stored_in_properties)) { | 135 &quic_max_server_configs_stored_in_properties)) { |
| 139 context_builder->set_quic_max_server_configs_stored_in_properties( | 136 context_builder->set_quic_max_server_configs_stored_in_properties( |
| 140 static_cast<size_t>(quic_max_server_configs_stored_in_properties)); | 137 static_cast<size_t>(quic_max_server_configs_stored_in_properties)); |
| 141 } | 138 } |
| 142 | 139 |
| 143 bool quic_delay_tcp_race = false; | 140 bool quic_delay_tcp_race = false; |
| 144 if (quic_args->GetBoolean(kQuicDelayTcpRace, &quic_delay_tcp_race)) { | 141 if (quic_args->GetBoolean(kQuicDelayTcpRace, &quic_delay_tcp_race)) { |
| 145 context_builder->set_quic_delay_tcp_race(quic_delay_tcp_race); | 142 context_builder->set_quic_delay_tcp_race(quic_delay_tcp_race); |
| 146 } | 143 } |
| 147 | 144 |
| 148 int quic_max_number_of_lossy_connections = 0; | |
| 149 if (quic_args->GetInteger(kQuicMaxNumberOfLossyConnections, | |
| 150 &quic_max_number_of_lossy_connections)) { | |
| 151 context_builder->set_quic_max_number_of_lossy_connections( | |
| 152 quic_max_number_of_lossy_connections); | |
| 153 } | |
| 154 | |
| 155 double quic_packet_loss_threshold = 0.0; | |
| 156 if (quic_args->GetDouble(kQuicPacketLossThreshold, | |
| 157 &quic_packet_loss_threshold)) { | |
| 158 context_builder->set_quic_packet_loss_threshold( | |
| 159 quic_packet_loss_threshold); | |
| 160 } | |
| 161 | |
| 162 int quic_idle_connection_timeout_seconds = 0; | 145 int quic_idle_connection_timeout_seconds = 0; |
| 163 if (quic_args->GetInteger(kQuicIdleConnectionTimeoutSeconds, | 146 if (quic_args->GetInteger(kQuicIdleConnectionTimeoutSeconds, |
| 164 &quic_idle_connection_timeout_seconds)) { | 147 &quic_idle_connection_timeout_seconds)) { |
| 165 context_builder->set_quic_idle_connection_timeout_seconds( | 148 context_builder->set_quic_idle_connection_timeout_seconds( |
| 166 quic_idle_connection_timeout_seconds); | 149 quic_idle_connection_timeout_seconds); |
| 167 } | 150 } |
| 168 | 151 |
| 169 std::string quic_host_whitelist; | 152 std::string quic_host_whitelist; |
| 170 if (quic_args->GetString(kQuicHostWhitelist, &quic_host_whitelist)) { | 153 if (quic_args->GetString(kQuicHostWhitelist, &quic_host_whitelist)) { |
| 171 std::unordered_set<std::string> hosts; | 154 std::unordered_set<std::string> hosts; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 std::move(mock_cert_verifier)); | 386 std::move(mock_cert_verifier)); |
| 404 } else { | 387 } else { |
| 405 // net::CertVerifier::CreateDefault() returns a CachingCertVerifier. | 388 // net::CertVerifier::CreateDefault() returns a CachingCertVerifier. |
| 406 cert_verifier = net::CertVerifier::CreateDefault(); | 389 cert_verifier = net::CertVerifier::CreateDefault(); |
| 407 } | 390 } |
| 408 context_builder->SetCertVerifier(std::move(cert_verifier)); | 391 context_builder->SetCertVerifier(std::move(cert_verifier)); |
| 409 // TODO(mef): Use |config| to set cookies. | 392 // TODO(mef): Use |config| to set cookies. |
| 410 } | 393 } |
| 411 | 394 |
| 412 } // namespace cronet | 395 } // namespace cronet |
| OLD | NEW |