Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1258)

Unified Diff: chrome/browser/net/chrome_url_request_context.cc

Issue 6402002: Simplify HttpCache/HttpNetworkLayer/HttpNetworkSession interaction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/net/connection_tester.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/chrome_url_request_context.cc
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index d3850df10ca460e03c84a6dfce390ee6369accf0..dc6853a305e566b29495a4d542af23d93d9f5d7a 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -281,17 +281,17 @@ ChromeURLRequestContext* FactoryForOriginal::Create() {
net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend(
net::DISK_CACHE, disk_cache_path_, cache_size_,
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE));
- net::HttpCache* cache =
- new net::HttpCache(context->host_resolver(),
- context->cert_verifier(),
- context->dnsrr_resolver(),
- context->dns_cert_checker(),
- context->proxy_service(),
- context->ssl_config_service(),
- context->http_auth_handler_factory(),
- &io_thread_globals->network_delegate,
- io_thread()->net_log(),
- backend);
+ net::HttpCache* cache = new net::HttpCache(
+ context->host_resolver(),
+ context->cert_verifier(),
+ context->dnsrr_resolver(),
+ context->dns_cert_checker(),
+ context->proxy_service(),
+ context->ssl_config_service(),
+ context->http_auth_handler_factory(),
+ &io_thread_globals->network_delegate,
+ io_thread()->net_log(),
+ backend);
bool record_mode = chrome::kRecordModeEnabled &&
command_line.HasSwitch(switches::kRecordMode);
@@ -491,35 +491,8 @@ ChromeURLRequestContext* FactoryForMedia::Create() {
net::HttpCache* main_cache =
main_context->http_transaction_factory()->GetCache();
- net::HttpCache* cache;
- if (main_cache) {
- // Try to reuse HttpNetworkSession in the main context, assuming that
- // HttpTransactionFactory (network_layer()) of HttpCache is implemented
- // by HttpNetworkLayer so we can reuse HttpNetworkSession within it. This
- // assumption will be invalid if the original HttpCache is constructed with
- // HttpCache(HttpTransactionFactory*, BackendFactory*) constructor.
- net::HttpNetworkLayer* main_network_layer =
- static_cast<net::HttpNetworkLayer*>(main_cache->network_layer());
- cache = new net::HttpCache(main_network_layer->GetSession(), backend);
- // TODO(eroman): Since this is poaching the session from the main
- // context, it should hold a reference to that context preventing the
- // session from getting deleted.
- } else {
- // If original HttpCache doesn't exist, simply construct one with a whole
- // new set of network stack.
- cache = new net::HttpCache(
- io_thread_globals->host_resolver.get(),
- io_thread_globals->cert_verifier.get(),
- io_thread_globals->dnsrr_resolver.get(),
- NULL /* dns_cert_checker */,
- main_context->proxy_service(),
- main_context->ssl_config_service(),
- io_thread_globals->http_auth_handler_factory.get(),
- &io_thread_globals->network_delegate,
- io_thread()->net_log(),
- backend);
- }
-
+ net::HttpNetworkSession* network_session = main_cache->GetSession();
+ net::HttpCache* cache = new net::HttpCache(network_session, backend);
context->set_http_transaction_factory(cache);
context->set_net_log(io_thread()->net_log());
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/net/connection_tester.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698