diff options
author | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 18:52:21 +0000 |
---|---|---|
committer | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 18:52:21 +0000 |
commit | 9fb8cf6994d2c87644f5819b360bfa4d4a5af820 (patch) | |
tree | 03aa196ce0f5217a5c2a569cd013c9c44087ca93 /webkit/appcache/appcache_group.cc | |
parent | 5d4cd6254ffb1a1f6720803adb8ef611d89df2c3 (diff) | |
download | chromium_src-9fb8cf6994d2c87644f5819b360bfa4d4a5af820.zip chromium_src-9fb8cf6994d2c87644f5819b360bfa4d4a5af820.tar.gz chromium_src-9fb8cf6994d2c87644f5819b360bfa4d4a5af820.tar.bz2 |
Add storage code to appcache update process.
Add storage API for simulating storage errors.
TEST=verify appcache update wrote to storage correctly
BUG=none
Review URL: http://codereview.chromium.org/326002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30612 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_group.cc')
-rw-r--r-- | webkit/appcache/appcache_group.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/webkit/appcache/appcache_group.cc b/webkit/appcache/appcache_group.cc index 8d7571c..9efd8ca2 100644 --- a/webkit/appcache/appcache_group.cc +++ b/webkit/appcache/appcache_group.cc @@ -75,20 +75,32 @@ void AppCacheGroup::AddCache(AppCache* complete_cache) { void AppCacheGroup::RemoveCache(AppCache* cache) { DCHECK(cache->associated_hosts().empty()); if (cache == newest_complete_cache_) { - AppCache* cache = newest_complete_cache_; + AppCache* tmp_cache = newest_complete_cache_; newest_complete_cache_ = NULL; - cache->set_owning_group(NULL); // may cause this group to be deleted + tmp_cache->set_owning_group(NULL); // may cause this group to be deleted } else { Caches::iterator it = std::find(old_caches_.begin(), old_caches_.end(), cache); if (it != old_caches_.end()) { - AppCache* cache = *it; + AppCache* tmp_cache = *it; old_caches_.erase(it); - cache->set_owning_group(NULL); // may cause group to be deleted + tmp_cache->set_owning_group(NULL); // may cause group to be deleted } } } +void AppCacheGroup::RestoreCacheAsNewest(AppCache* former_newest_cache) { + newest_complete_cache_->set_owning_group(NULL); + newest_complete_cache_ = former_newest_cache; + if (former_newest_cache) { + DCHECK(former_newest_cache->owning_group() == this); + Caches::iterator it = + std::find(old_caches_.begin(), old_caches_.end(), former_newest_cache); + DCHECK(it != old_caches_.end()); + old_caches_.erase(it); + } +} + void AppCacheGroup::StartUpdateWithNewMasterEntry( AppCacheHost* host, const GURL& new_master_resource) { if (!update_job_) |