Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/url_request/url_request_context_builder.h" | 5 #include "net/url_request/url_request_context_builder.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 #endif | 203 #endif |
| 204 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) | 204 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) |
| 205 ftp_enabled_(false), | 205 ftp_enabled_(false), |
| 206 #endif | 206 #endif |
| 207 http_cache_enabled_(true), | 207 http_cache_enabled_(true), |
| 208 throttling_enabled_(false), | 208 throttling_enabled_(false), |
| 209 sdch_enabled_(false), | 209 sdch_enabled_(false), |
| 210 cookie_store_set_by_client_(false), | 210 cookie_store_set_by_client_(false), |
| 211 net_log_(nullptr), | 211 net_log_(nullptr), |
| 212 pac_quick_check_enabled_(true), | 212 pac_quick_check_enabled_(true), |
| 213 pac_sanitize_url_policy_(ProxyService::SanitizeUrlPolicy::SAFE), | 213 pac_sanitize_url_policy_(ProxyService::SanitizeUrlPolicy::SAFE) { |
| 214 socket_performance_watcher_factory_(nullptr) { | |
| 215 } | 214 } |
| 216 | 215 |
| 217 URLRequestContextBuilder::~URLRequestContextBuilder() {} | 216 URLRequestContextBuilder::~URLRequestContextBuilder() {} |
| 218 | 217 |
| 219 void URLRequestContextBuilder::SetHttpNetworkSessionComponents( | 218 void URLRequestContextBuilder::SetHttpNetworkSessionComponents( |
| 220 const URLRequestContext* request_context, | 219 const URLRequestContext* request_context, |
| 221 HttpNetworkSession::Context* session_context) { | 220 HttpNetworkSession::Context* session_context) { |
| 222 session_context->host_resolver = request_context->host_resolver(); | 221 session_context->host_resolver = request_context->host_resolver(); |
| 223 session_context->cert_verifier = request_context->cert_verifier(); | 222 session_context->cert_verifier = request_context->cert_verifier(); |
| 224 session_context->transport_security_state = | 223 session_context->transport_security_state = |
| 225 request_context->transport_security_state(); | 224 request_context->transport_security_state(); |
| 226 session_context->cert_transparency_verifier = | 225 session_context->cert_transparency_verifier = |
| 227 request_context->cert_transparency_verifier(); | 226 request_context->cert_transparency_verifier(); |
| 228 session_context->ct_policy_enforcer = request_context->ct_policy_enforcer(); | 227 session_context->ct_policy_enforcer = request_context->ct_policy_enforcer(); |
| 229 session_context->proxy_service = request_context->proxy_service(); | 228 session_context->proxy_service = request_context->proxy_service(); |
| 230 session_context->ssl_config_service = request_context->ssl_config_service(); | 229 session_context->ssl_config_service = request_context->ssl_config_service(); |
| 231 session_context->http_auth_handler_factory = | 230 session_context->http_auth_handler_factory = |
| 232 request_context->http_auth_handler_factory(); | 231 request_context->http_auth_handler_factory(); |
| 233 session_context->http_server_properties = | 232 session_context->http_server_properties = |
| 234 request_context->http_server_properties(); | 233 request_context->http_server_properties(); |
| 235 session_context->net_log = request_context->net_log(); | 234 session_context->net_log = request_context->net_log(); |
| 236 session_context->channel_id_service = request_context->channel_id_service(); | 235 session_context->channel_id_service = request_context->channel_id_service(); |
| 237 session_context->network_quality_provider = | 236 session_context->network_quality_provider = |
| 238 request_context->network_quality_estimator(); | 237 request_context->network_quality_estimator(); |
| 238 if (request_context->network_quality_estimator()) { | |
| 239 session_context->socket_performance_watcher_factory = | |
| 240 request_context->network_quality_estimator() | |
| 241 ->GetSocketPerformanceWatcherFactory(); | |
|
mmenke
2017/06/09 16:32:13
The "session_context.socket_performance_watcher_fa
mmenke
2017/06/09 16:32:13
Also, it looks like socket_performance_watcher_fac
tbansal1
2017/06/09 16:45:06
Yes, for some contexts (e.g., off the record), SPW
tbansal1
2017/06/09 16:45:06
Done.
| |
| 242 } | |
| 239 } | 243 } |
| 240 | 244 |
| 241 void URLRequestContextBuilder::EnableHttpCache(const HttpCacheParams& params) { | 245 void URLRequestContextBuilder::EnableHttpCache(const HttpCacheParams& params) { |
| 242 http_cache_enabled_ = true; | 246 http_cache_enabled_ = true; |
| 243 http_cache_params_ = params; | 247 http_cache_params_ = params; |
| 244 } | 248 } |
| 245 | 249 |
| 246 void URLRequestContextBuilder::DisableHttpCache() { | 250 void URLRequestContextBuilder::DisableHttpCache() { |
| 247 http_cache_enabled_ = false; | 251 http_cache_enabled_ = false; |
| 248 http_cache_params_ = HttpCacheParams(); | 252 http_cache_params_ = HttpCacheParams(); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 } | 421 } |
| 418 storage->set_proxy_service(std::move(proxy_service_)); | 422 storage->set_proxy_service(std::move(proxy_service_)); |
| 419 | 423 |
| 420 HttpNetworkSession::Context network_session_context; | 424 HttpNetworkSession::Context network_session_context; |
| 421 SetHttpNetworkSessionComponents(context.get(), &network_session_context); | 425 SetHttpNetworkSessionComponents(context.get(), &network_session_context); |
| 422 | 426 |
| 423 if (proxy_delegate_) { | 427 if (proxy_delegate_) { |
| 424 network_session_context.proxy_delegate = proxy_delegate_.get(); | 428 network_session_context.proxy_delegate = proxy_delegate_.get(); |
| 425 storage->set_proxy_delegate(std::move(proxy_delegate_)); | 429 storage->set_proxy_delegate(std::move(proxy_delegate_)); |
| 426 } | 430 } |
| 427 if (socket_performance_watcher_factory_) { | |
| 428 network_session_context.socket_performance_watcher_factory = | |
| 429 socket_performance_watcher_factory_; | |
| 430 DCHECK(network_session_context.network_quality_provider); | |
| 431 } | |
| 432 | 431 |
| 433 storage->set_http_network_session(base::MakeUnique<HttpNetworkSession>( | 432 storage->set_http_network_session(base::MakeUnique<HttpNetworkSession>( |
| 434 http_network_session_params_, network_session_context)); | 433 http_network_session_params_, network_session_context)); |
| 435 | 434 |
| 436 std::unique_ptr<HttpTransactionFactory> http_transaction_factory; | 435 std::unique_ptr<HttpTransactionFactory> http_transaction_factory; |
| 437 if (http_cache_enabled_) { | 436 if (http_cache_enabled_) { |
| 438 std::unique_ptr<HttpCache::BackendFactory> http_cache_backend; | 437 std::unique_ptr<HttpCache::BackendFactory> http_cache_backend; |
| 439 if (http_cache_params_.type != HttpCacheParams::IN_MEMORY) { | 438 if (http_cache_params_.type != HttpCacheParams::IN_MEMORY) { |
| 440 BackendType backend_type = | 439 BackendType backend_type = |
| 441 http_cache_params_.type == HttpCacheParams::DISK | 440 http_cache_params_.type == HttpCacheParams::DISK |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 std::unique_ptr<ProxyConfigService> proxy_config_service, | 505 std::unique_ptr<ProxyConfigService> proxy_config_service, |
| 507 URLRequestContext* url_request_context, | 506 URLRequestContext* url_request_context, |
| 508 HostResolver* host_resolver, | 507 HostResolver* host_resolver, |
| 509 NetworkDelegate* network_delegate, | 508 NetworkDelegate* network_delegate, |
| 510 NetLog* net_log) { | 509 NetLog* net_log) { |
| 511 return ProxyService::CreateUsingSystemProxyResolver( | 510 return ProxyService::CreateUsingSystemProxyResolver( |
| 512 std::move(proxy_config_service), net_log); | 511 std::move(proxy_config_service), net_log); |
| 513 } | 512 } |
| 514 | 513 |
| 515 } // namespace net | 514 } // namespace net |
| OLD | NEW |