diff options
Diffstat (limited to 'webkit/appcache/appcache_service.h')
-rw-r--r-- | webkit/appcache/appcache_service.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/webkit/appcache/appcache_service.h b/webkit/appcache/appcache_service.h index 3eaa43d..bc8bee8 100644 --- a/webkit/appcache/appcache_service.h +++ b/webkit/appcache/appcache_service.h @@ -10,6 +10,7 @@ #include <vector> #include "base/hash_tables.h" +#include "base/file_path.h" #include "googleurl/src/gurl.h" namespace appcache { @@ -24,17 +25,34 @@ class AppCacheService { public: virtual ~AppCacheService(); + void Initialize(const FilePath& cache_directory); + // TODO(jennb): API to set service settings, like file paths for storage // track which processes are using this appcache service - void RegisterBackendImpl(AppCacheBackendImpl* backend_impl); - void UnregisterBackendImpl(AppCacheBackendImpl* backend_impl); + void RegisterBackend(AppCacheBackendImpl* backend_impl); + void UnregisterBackend(AppCacheBackendImpl* backend_impl); void AddCache(AppCache* cache); void RemoveCache(AppCache* cache); void AddGroup(AppCacheGroup* group); void RemoveGroup(AppCacheGroup* group); + AppCacheBackendImpl* GetBackend(int id) { + BackendMap::iterator it = backends_.find(id); + return (it != backends_.end()) ? it->second : NULL; + } + + AppCache* GetCache(int64 id) { + CacheMap::iterator it = caches_.find(id); + return (it != caches_.end()) ? it->second : NULL; + } + + AppCacheGroup* GetGroup(const GURL& manifest_url) { + GroupMap::iterator it = groups_.find(manifest_url); + return (it != groups_.end()) ? it->second : NULL; + } + private: // In-memory representation of stored appcache data. Represents a subset // of the appcache database currently in use. @@ -44,9 +62,10 @@ class AppCacheService { GroupMap groups_; // Track current processes. One 'backend' per child process. - typedef std::set<AppCacheBackendImpl*> BackendSet; - BackendSet backends_; + typedef std::map<int, AppCacheBackendImpl*> BackendMap; + BackendMap backends_; + FilePath cache_directory_; // TODO(jennb): info about appcache storage // AppCacheDatabase db_; // DiskCache response_storage_; |