diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-22 19:50:31 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-22 19:50:31 +0000 |
commit | e2fc3d25fe020a7e7518af1aea31085adc1002a1 (patch) | |
tree | fc64854da0b8cc3ac30df1bb6a399885365fb092 /webkit/appcache/appcache_service.h | |
parent | f09ef6740a2d3342dd41796e01916957d20b6586 (diff) | |
download | chromium_src-e2fc3d25fe020a7e7518af1aea31085adc1002a1.zip chromium_src-e2fc3d25fe020a7e7518af1aea31085adc1002a1.tar.gz chromium_src-e2fc3d25fe020a7e7518af1aea31085adc1002a1.tar.bz2 |
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
Diffstat (limited to 'webkit/appcache/appcache_service.h')
-rw-r--r-- | webkit/appcache/appcache_service.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/webkit/appcache/appcache_service.h b/webkit/appcache/appcache_service.h index 0d7609d..9a504d9 100644 --- a/webkit/appcache/appcache_service.h +++ b/webkit/appcache/appcache_service.h @@ -13,9 +13,10 @@ #include "base/file_path.h" #include "base/ref_counted.h" #include "base/task.h" -#include "net/url_request/url_request_context.h" #include "googleurl/src/gurl.h" +class URLRequestContext; + namespace appcache { class AppCache; @@ -34,7 +35,7 @@ class AppCacheService { // If a load fails the object pointer will be NULL. virtual void CacheLoadedCallback(AppCache* cache, int64 cache_id) = 0; - virtual void GroupLoadedCallback(AppCacheGroup* cache, + virtual void GroupLoadedCallback(AppCacheGroup* group, const GURL& manifest_url) = 0; }; @@ -44,12 +45,12 @@ class AppCacheService { void Initialize(const FilePath& cache_directory); // Context for use during cache updates, should only be accessed - // on the IO thread. - URLRequestContext* request_context() { return request_context_.get(); } + // on the IO thread. We do NOT add a reference to the request context, + // it is the callers responsibility to ensure that the pointer + // remains valid while set. + URLRequestContext* request_context() const { return request_context_; } void set_request_context(URLRequestContext* context) { - // TODO(michaeln): need to look into test failures that occur - // when we take this reference? Stubbing out for now. - // request_context_ = context; + request_context_ = context; } // TODO(jennb): API to set service settings, like file paths for storage @@ -62,7 +63,7 @@ class AppCacheService { return (it != backends_.end()) ? it->second : NULL; } - // Track what we have in or in-memory cache. + // Track what we have in our in-memory cache. void AddCache(AppCache* cache); void RemoveCache(AppCache* cache); void AddGroup(AppCacheGroup* group); @@ -117,7 +118,7 @@ class AppCacheService { FilePath cache_directory_; // Context for use during cache updates. - scoped_refptr<URLRequestContext> request_context_; + URLRequestContext* request_context_; // TODO(michaeln): cache and group loading book keeping. // TODO(michaeln): database and response storage |