diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-15 22:07:15 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-15 22:07:15 +0000 |
commit | 97e3edc23314c476859c22c8db601f9b3dec552d (patch) | |
tree | 9c589f47545b88c1453c2481a7844a921636485c /webkit/appcache/appcache_service.cc | |
parent | 34fce2a5030cb53a1e2decb37b5f7517f98457f7 (diff) | |
download | chromium_src-97e3edc23314c476859c22c8db601f9b3dec552d.zip chromium_src-97e3edc23314c476859c22c8db601f9b3dec552d.tar.gz chromium_src-97e3edc23314c476859c22c8db601f9b3dec552d.tar.bz2 |
* Fleshed out AppCacheHost class a fair amount, in particular the cache selection algorithm.
* Added some AppCacheHost unit tests.
* Introduced AppCacheRequestHandler class, which replaces the clunkyApp
CacheInterceptor::ExtraInfo struct. This impl is entirely skeletal
stubs for now.
TEST=appcache_unittest.cc, but really needs more
BUG=none
Review URL: http://codereview.chromium.org/192043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26275 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_service.cc')
-rw-r--r-- | webkit/appcache/appcache_service.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/webkit/appcache/appcache_service.cc b/webkit/appcache/appcache_service.cc index 029c4ef..6de7332 100644 --- a/webkit/appcache/appcache_service.cc +++ b/webkit/appcache/appcache_service.cc @@ -5,8 +5,10 @@ #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" namespace appcache { @@ -60,4 +62,39 @@ void AppCacheService::RemoveGroup(AppCacheGroup* group) { groups_.erase(group->manifest_url()); } +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 |