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

Unified Diff: content/browser/resource_context_impl.cc

Issue 10878041: Remove silly uses of ResourceContext that unnecessarily violate the Law of Demeter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix 80-cols Created 8 years, 4 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 | « content/browser/browser_context.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/resource_context_impl.cc
diff --git a/content/browser/resource_context_impl.cc b/content/browser/resource_context_impl.cc
index 7e3555d28d323d08894fb2c8c5032333f9a6cd4e..e59692f3aaf417d5c8f56ad4b0c96c87e1ad1949 100644
--- a/content/browser/resource_context_impl.cc
+++ b/content/browser/resource_context_impl.cc
@@ -154,8 +154,11 @@ class DeveloperProtocolHandler
};
void InitializeRequestContext(
- ResourceContext* resource_context,
- scoped_refptr<net::URLRequestContextGetter> context_getter) {
+ scoped_refptr<net::URLRequestContextGetter> context_getter,
+ AppCacheService* appcache_service,
+ FileSystemContext* file_system_context,
+ ChromeBlobStorageContext* blob_storage_context) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (!context_getter)
return; // tests.
net::URLRequestContext* context = context_getter->GetURLRequestContext();
@@ -167,18 +170,17 @@ void InitializeRequestContext(
bool set_protocol = job_factory->SetProtocolHandler(
chrome::kBlobScheme,
new BlobProtocolHandler(
- GetBlobStorageControllerForResourceContext(resource_context),
+ blob_storage_context->controller(),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
DCHECK(set_protocol);
set_protocol = job_factory->SetProtocolHandler(
chrome::kFileSystemScheme,
- CreateFileSystemProtocolHandler(
- GetFileSystemContextForResourceContext(resource_context)));
+ CreateFileSystemProtocolHandler(file_system_context));
DCHECK(set_protocol);
- job_factory->AddInterceptor(new DeveloperProtocolHandler(
- ResourceContext::GetAppCacheService(resource_context),
- GetBlobStorageControllerForResourceContext(resource_context)));
+ job_factory->AddInterceptor(
+ new DeveloperProtocolHandler(appcache_service,
+ blob_storage_context->controller()));
// TODO(jam): Add the ProtocolHandlerRegistryIntercepter here!
}
@@ -284,17 +286,35 @@ void InitializeResourceContext(BrowserContext* browser_context) {
// TODO(creis): Do equivalent initializations for isolated app and isolated
// media request contexts.
if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) {
+ // TODO(ajwong): Move this whole block into
+ // StoragePartitionImplMap::PostCreateInitialization after we're certain
+ // this is safe to happen before InitializeResourceContext, and after we've
+ // found the right URLRequestContext for a storage partition. Otherwise,
+ // our isolated URLRequestContext getters will do the wrong thing for blobs,
+ // and FileSystemContext.
+ //
+ // http://crbug.com/85121
+
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- base::Bind(&InitializeRequestContext,
- resource_context,
- make_scoped_refptr(browser_context->GetRequestContext())));
+ base::Bind(
+ &InitializeRequestContext,
+ make_scoped_refptr(browser_context->GetRequestContext()),
+ BrowserContext::GetAppCacheService(browser_context),
+ make_scoped_refptr(
+ BrowserContext::GetFileSystemContext(browser_context)),
+ make_scoped_refptr(
+ ChromeBlobStorageContext::GetFor(browser_context))));
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- base::Bind(&InitializeRequestContext,
- resource_context,
- make_scoped_refptr(
- browser_context->GetMediaRequestContext())));
+ base::Bind(
+ &InitializeRequestContext,
+ make_scoped_refptr(browser_context->GetMediaRequestContext()),
+ BrowserContext::GetAppCacheService(browser_context),
+ make_scoped_refptr(
+ BrowserContext::GetFileSystemContext(browser_context)),
+ make_scoped_refptr(
+ ChromeBlobStorageContext::GetFor(browser_context))));
}
}
« no previous file with comments | « content/browser/browser_context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698