summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_service.cc
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 03:25:51 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 03:25:51 +0000
commite7dff7bae2779884b62dc3c7f8bd40a4987627f1 (patch)
treecfc42a36432847e42eabf716cc56bc2365ed10a4 /webkit/appcache/appcache_service.cc
parent55e9c25f48d8d99cc0433258b44f6e96011a63cd (diff)
downloadchromium_src-e7dff7bae2779884b62dc3c7f8bd40a4987627f1.zip
chromium_src-e7dff7bae2779884b62dc3c7f8bd40a4987627f1.tar.gz
chromium_src-e7dff7bae2779884b62dc3c7f8bd40a4987627f1.tar.bz2
AppCache StorageAPIs
TEST=none yet, these are just API definitions stubbed out for now BUG=none Review URL: http://codereview.chromium.org/209071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28513 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_service.cc')
-rw-r--r--webkit/appcache/appcache_service.cc75
1 files changed, 6 insertions, 69 deletions
diff --git a/webkit/appcache/appcache_service.cc b/webkit/appcache/appcache_service.cc
index c36ad1e..f0c8784 100644
--- a/webkit/appcache/appcache_service.cc
+++ b/webkit/appcache/appcache_service.cc
@@ -5,30 +5,24 @@
#include "webkit/appcache/appcache_service.h"
#include "base/logging.h"
-#include "base/ref_counted.h"
-#include "webkit/appcache/appcache.h"
#include "webkit/appcache/appcache_backend_impl.h"
-#include "webkit/appcache/appcache_entry.h"
-#include "webkit/appcache/appcache_group.h"
+#include "webkit/appcache/appcache_storage_impl.h"
namespace appcache {
AppCacheService::AppCacheService()
- : last_cache_id_(0), last_group_id_(0),
- last_entry_id_(0), last_response_id_(0),
- request_context_(NULL) {
+ : request_context_(NULL) {
}
AppCacheService::~AppCacheService() {
DCHECK(backends_.empty());
- DCHECK(caches_.empty());
- DCHECK(groups_.empty());
}
void AppCacheService::Initialize(const FilePath& cache_directory) {
- // An empty cache directory indicates chrome incognito.
- cache_directory_ = cache_directory;
- // TODO(michaeln): load last_<foo>_ids from storage
+ DCHECK(!storage_.get());
+ AppCacheStorageImpl* storage = new AppCacheStorageImpl(this);
+ storage->Initialize(cache_directory);
+ storage_.reset(storage);
}
void AppCacheService::RegisterBackend(
@@ -43,61 +37,4 @@ void AppCacheService::UnregisterBackend(
backends_.erase(backend_impl->process_id());
}
-void AppCacheService::AddCache(AppCache* cache) {
- int64 cache_id = cache->cache_id();
- DCHECK(caches_.find(cache_id) == caches_.end());
- caches_.insert(CacheMap::value_type(cache_id, cache));
-}
-
-void AppCacheService::RemoveCache(AppCache* cache) {
- caches_.erase(cache->cache_id());
-}
-
-void AppCacheService::AddGroup(AppCacheGroup* group) {
- const GURL& url = group->manifest_url();
- DCHECK(groups_.find(url) == groups_.end());
- groups_.insert(GroupMap::value_type(url, group));
-}
-
-void AppCacheService::RemoveGroup(AppCacheGroup* group) {
- groups_.erase(group->manifest_url());
-
- // TODO(jennb): if group is obsolete, delete from storage.
-}
-
-void AppCacheService::LoadCache(int64 id, LoadClient* client) {
- // TODO(michaeln): actually retrieve from storage if needed
- client->CacheLoadedCallback(GetCache(id), id);
-}
-
-void AppCacheService::LoadOrCreateGroup(const GURL& manifest_url,
- LoadClient* client) {
- // TODO(michaeln): actually retrieve from storage
- scoped_refptr<AppCacheGroup> group = GetGroup(manifest_url);
- if (!group.get()) {
- group = new AppCacheGroup(this, manifest_url);
- DCHECK(GetGroup(manifest_url));
- }
- client->GroupLoadedCallback(group.get(), manifest_url);
-}
-
-void AppCacheService::CancelLoads(LoadClient* client) {
- // TODO(michaeln): remove client from loading lists
-}
-
-void AppCacheService::MarkAsForeignEntry(const GURL& entry_url,
- int64 cache_id) {
- // Update the in-memory cache.
- AppCache* cache = GetCache(cache_id);
- if (cache) {
- AppCacheEntry* entry = cache->GetEntry(entry_url);
- DCHECK(entry);
- if (entry)
- entry->add_types(AppCacheEntry::FOREIGN);
- }
-
- // TODO(michaeln): actually update in storage, and if this cache is
- // being loaded be sure to update the memory cache upon load completion.
-}
-
} // namespace appcache