From e2fc3d25fe020a7e7518af1aea31085adc1002a1 Mon Sep 17 00:00:00 2001 From: "michaeln@google.com" Date: Tue, 22 Sep 2009 19:50:31 +0000 Subject: Fix appcache_service and request_context referencing. There is one appcache service per profile and several request context per profile. The profile holds a reference to the appcache service. Those request contexts which are subject to retrieval from appcaches hold a reference to the appcache service too. The appcache service is provided with a pointer back to the 'main' request context, this context is used when updating appcaches. Initialization is a little tricky because profiles can't be used on the IO thread and request contexts can't be used on the UI thread. BUG=22597,22125 TEST=many existing tests exercise profile/context creation Review URL: http://codereview.chromium.org/215024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26844 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/net/chrome_url_request_context.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'chrome/browser/net/chrome_url_request_context.h') diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h index b78e0a7..9eb3c90 100644 --- a/chrome/browser/net/chrome_url_request_context.h +++ b/chrome/browser/net/chrome_url_request_context.h @@ -32,13 +32,15 @@ class ChromeURLRequestContext : public URLRequestContext, // expected to get called on the UI thread. static ChromeURLRequestContext* CreateOriginal( Profile* profile, const FilePath& cookie_store_path, - const FilePath& disk_cache_path, int cache_size); + const FilePath& disk_cache_path, int cache_size, + ChromeAppCacheService* appcache_service); // Create an instance for an original profile for media. This is expected to // get called on UI thread. This method takes a profile and reuses the // 'original' URLRequestContext for common files. static ChromeURLRequestContext* CreateOriginalForMedia(Profile *profile, - const FilePath& disk_cache_path, int cache_size); + const FilePath& disk_cache_path, int cache_size, + ChromeAppCacheService* appcache_service); // Create an instance for an original profile for extensions. This is expected // to get called on UI thread. @@ -47,7 +49,8 @@ class ChromeURLRequestContext : public URLRequestContext, // Create an instance for use with an OTR profile. This is expected to get // called on the UI thread. - static ChromeURLRequestContext* CreateOffTheRecord(Profile* profile); + static ChromeURLRequestContext* CreateOffTheRecord(Profile* profile, + ChromeAppCacheService* appcache_service); // Create an instance of request context for OTR profile for extensions. static ChromeURLRequestContext* CreateOffTheRecordForExtensions( @@ -81,16 +84,18 @@ class ChromeURLRequestContext : public URLRequestContext, const Blacklist* blacklist() const { return blacklist_; } protected: - // Private constructor, use the static factory methods instead. This is + // Private constructors, use the static factory methods instead. This is // expected to be called on the UI thread. - ChromeURLRequestContext(Profile* profile); + ChromeURLRequestContext( + Profile* profile, ChromeAppCacheService* appcache_service); ChromeURLRequestContext(ChromeURLRequestContext* other); // Create a request context for media resources from a regular request // context. This helper method is called from CreateOriginalForMedia and // CreateOffTheRecordForMedia. static ChromeURLRequestContext* CreateRequestContextForMedia(Profile* profile, - const FilePath& disk_cache_path, int cache_size, bool off_the_record); + const FilePath& disk_cache_path, int cache_size, bool off_the_record, + ChromeAppCacheService* appache_service); // NotificationObserver implementation. virtual void Observe(NotificationType type, -- cgit v1.1