summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/mock_appcache_storage.cc
diff options
context:
space:
mode:
authorjennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 22:57:48 +0000
committerjennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 22:57:48 +0000
commit63f359f721c6f7ddc20c274b8e3e2b5df7b95a88 (patch)
tree17316cf5369ef8cf0627d2244b05e3948e27d7a7 /webkit/appcache/mock_appcache_storage.cc
parent712257e6ca930697de2a5c1d5e0a4311262e5a2c (diff)
downloadchromium_src-63f359f721c6f7ddc20c274b8e3e2b5df7b95a88.zip
chromium_src-63f359f721c6f7ddc20c274b8e3e2b5df7b95a88.tar.gz
chromium_src-63f359f721c6f7ddc20c274b8e3e2b5df7b95a88.tar.bz2
Change store group and newest cache API so that storage failure does not require storage clients to revert changes to group and so it's not racey.TEST=existing tests updatedBUG=none
Review URL: http://codereview.chromium.org/384029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31730 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/mock_appcache_storage.cc')
-rw-r--r--webkit/appcache/mock_appcache_storage.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/webkit/appcache/mock_appcache_storage.cc b/webkit/appcache/mock_appcache_storage.cc
index d9c63b0..919e5f1 100644
--- a/webkit/appcache/mock_appcache_storage.cc
+++ b/webkit/appcache/mock_appcache_storage.cc
@@ -71,15 +71,14 @@ void MockAppCacheStorage::LoadOrCreateGroup(
}
void MockAppCacheStorage::StoreGroupAndNewestCache(
- AppCacheGroup* group, Delegate* delegate) {
+ AppCacheGroup* group, AppCache* newest_cache, Delegate* delegate) {
DCHECK(group && delegate);
- DCHECK(group->newest_complete_cache());
+ DCHECK(newest_cache && newest_cache->is_complete());
// Always make this operation look async.
ScheduleTask(method_factory_.NewRunnableMethod(
&MockAppCacheStorage::ProcessStoreGroupAndNewestCache,
- group, group->newest_complete_cache(),
- GetOrCreateDelegateReference(delegate)));
+ group, newest_cache, GetOrCreateDelegateReference(delegate)));
}
void MockAppCacheStorage::FindResponseForMainRequest(
@@ -179,8 +178,6 @@ void MockAppCacheStorage::ProcessStoreGroupAndNewestCache(
scoped_refptr<AppCacheGroup> group,
scoped_refptr<AppCache> newest_cache,
scoped_refptr<DelegateReference> delegate_ref) {
- DCHECK(group->newest_complete_cache() == newest_cache.get());
-
if (simulate_store_group_and_newest_cache_failure_) {
if (delegate_ref->delegate)
delegate_ref->delegate->OnGroupAndNewestCacheStored(group, false);
@@ -188,7 +185,8 @@ void MockAppCacheStorage::ProcessStoreGroupAndNewestCache(
}
AddStoredGroup(group);
- AddStoredCache(group->newest_complete_cache());
+ AddStoredCache(newest_cache);
+ group->AddCache(newest_cache);
// Copy the collection prior to removal, on final release
// of a cache the group's collection will change.