diff options
author | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 22:57:48 +0000 |
---|---|---|
committer | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 22:57:48 +0000 |
commit | 63f359f721c6f7ddc20c274b8e3e2b5df7b95a88 (patch) | |
tree | 17316cf5369ef8cf0627d2244b05e3948e27d7a7 /webkit/appcache/appcache_update_job.cc | |
parent | 712257e6ca930697de2a5c1d5e0a4311262e5a2c (diff) | |
download | chromium_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/appcache_update_job.cc')
-rw-r--r-- | webkit/appcache/appcache_update_job.cc | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc index b1cf778..7887ee1 100644 --- a/webkit/appcache/appcache_update_job.cc +++ b/webkit/appcache/appcache_update_job.cc @@ -557,17 +557,15 @@ void AppCacheUpdateJob::OnManifestDataWriteComplete(int result) { void AppCacheUpdateJob::CompleteInprogressCache() { inprogress_cache_->set_update_time(base::TimeTicks::Now()); inprogress_cache_->set_complete(true); - - protect_former_newest_cache_ = group_->newest_complete_cache(); - group_->AddCache(inprogress_cache_); + service_->storage()->StoreGroupAndNewestCache(group_, inprogress_cache_, + this); // async protect_new_cache_.swap(inprogress_cache_); - - service_->storage()->StoreGroupAndNewestCache(group_, this); // async } void AppCacheUpdateJob::OnGroupAndNewestCacheStored(AppCacheGroup* group, bool success) { if (success) { + DCHECK_EQ(protect_new_cache_, group->newest_complete_cache()); if (update_type_ == CACHE_ATTEMPT) NotifyAllAssociatedHosts(CACHED_EVENT); else @@ -575,15 +573,11 @@ void AppCacheUpdateJob::OnGroupAndNewestCacheStored(AppCacheGroup* group, internal_state_ = COMPLETED; MaybeCompleteUpdate(); // will definitely complete } else { - // TODO(jennb): Change storage so clients won't need to revert group state? - // Change group back to reflect former newest group. - group_->RestoreCacheAsNewest(protect_former_newest_cache_); protect_new_cache_ = NULL; // Treat storage failure as if manifest refetch failed. HandleManifestRefetchFailure(); } - protect_former_newest_cache_ = NULL; } void AppCacheUpdateJob::HandleManifestRefetchFailure() { |