| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | 165 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
| 166 | 166 |
| 167 URLRequestContextStorage storage_; | 167 URLRequestContextStorage storage_; |
| 168 std::unique_ptr<TransportSecurityPersister> transport_security_persister_; | 168 std::unique_ptr<TransportSecurityPersister> transport_security_persister_; |
| 169 | 169 |
| 170 DISALLOW_COPY_AND_ASSIGN(ContainerURLRequestContext); | 170 DISALLOW_COPY_AND_ASSIGN(ContainerURLRequestContext); |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 } // namespace | 173 } // namespace |
| 174 | 174 |
| 175 URLRequestContextBuilder::HttpCacheParams::HttpCacheParams() | 175 URLRequestContextBuilder::HttpCacheParams::HttpCacheParams() : max_size(0) {} |
| 176 : type(IN_MEMORY), | |
| 177 max_size(0) {} | |
| 178 URLRequestContextBuilder::HttpCacheParams::~HttpCacheParams() {} | 176 URLRequestContextBuilder::HttpCacheParams::~HttpCacheParams() {} |
| 179 | 177 |
| 180 URLRequestContextBuilder::HttpNetworkSessionParams::HttpNetworkSessionParams() | 178 URLRequestContextBuilder::HttpNetworkSessionParams::HttpNetworkSessionParams() |
| 181 : ignore_certificate_errors(false), | 179 : ignore_certificate_errors(false), |
| 182 host_mapping_rules(NULL), | 180 host_mapping_rules(NULL), |
| 183 testing_fixed_http_port(0), | 181 testing_fixed_http_port(0), |
| 184 testing_fixed_https_port(0), | 182 testing_fixed_https_port(0), |
| 185 enable_spdy31(false), | 183 enable_spdy31(false), |
| 186 enable_http2(true), | 184 enable_http2(true), |
| 187 enable_quic(false), | 185 enable_quic(false), |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 network_session_params.socket_performance_watcher_factory = | 451 network_session_params.socket_performance_watcher_factory = |
| 454 socket_performance_watcher_factory_; | 452 socket_performance_watcher_factory_; |
| 455 } | 453 } |
| 456 | 454 |
| 457 storage->set_http_network_session( | 455 storage->set_http_network_session( |
| 458 base::WrapUnique(new HttpNetworkSession(network_session_params))); | 456 base::WrapUnique(new HttpNetworkSession(network_session_params))); |
| 459 | 457 |
| 460 std::unique_ptr<HttpTransactionFactory> http_transaction_factory; | 458 std::unique_ptr<HttpTransactionFactory> http_transaction_factory; |
| 461 if (http_cache_enabled_) { | 459 if (http_cache_enabled_) { |
| 462 std::unique_ptr<HttpCache::BackendFactory> http_cache_backend; | 460 std::unique_ptr<HttpCache::BackendFactory> http_cache_backend; |
| 463 if (http_cache_params_.type != HttpCacheParams::IN_MEMORY) { | 461 http_cache_backend = |
| 464 BackendType backend_type = | 462 HttpCache::DefaultBackend::InMemory(http_cache_params_.max_size); |
| 465 http_cache_params_.type == HttpCacheParams::DISK | |
| 466 ? CACHE_BACKEND_DEFAULT | |
| 467 : CACHE_BACKEND_SIMPLE; | |
| 468 http_cache_backend.reset(new HttpCache::DefaultBackend( | |
| 469 DISK_CACHE, backend_type, http_cache_params_.path, | |
| 470 http_cache_params_.max_size, context->GetFileTaskRunner())); | |
| 471 } else { | |
| 472 http_cache_backend = | |
| 473 HttpCache::DefaultBackend::InMemory(http_cache_params_.max_size); | |
| 474 } | |
| 475 | 463 |
| 476 http_transaction_factory.reset(new HttpCache( | 464 http_transaction_factory.reset(new HttpCache( |
| 477 storage->http_network_session(), std::move(http_cache_backend), true)); | 465 storage->http_network_session(), std::move(http_cache_backend), true)); |
| 478 } else { | 466 } else { |
| 479 http_transaction_factory.reset( | 467 http_transaction_factory.reset( |
| 480 new HttpNetworkLayer(storage->http_network_session())); | 468 new HttpNetworkLayer(storage->http_network_session())); |
| 481 } | 469 } |
| 482 storage->set_http_transaction_factory(std::move(http_transaction_factory)); | 470 storage->set_http_transaction_factory(std::move(http_transaction_factory)); |
| 483 | 471 |
| 484 URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl; | 472 URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 } | 511 } |
| 524 url_request_interceptors_.clear(); | 512 url_request_interceptors_.clear(); |
| 525 } | 513 } |
| 526 storage->set_job_factory(std::move(top_job_factory)); | 514 storage->set_job_factory(std::move(top_job_factory)); |
| 527 // TODO(willchan): Support sdch. | 515 // TODO(willchan): Support sdch. |
| 528 | 516 |
| 529 return std::move(context); | 517 return std::move(context); |
| 530 } | 518 } |
| 531 | 519 |
| 532 } // namespace net | 520 } // namespace net |
| OLD | NEW |