diff options
author | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 01:26:10 +0000 |
---|---|---|
committer | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 01:26:10 +0000 |
commit | 4f32303e4491c3b2358825e0b26f8c5db3b28b33 (patch) | |
tree | eeb15549ae8540ddc6e1be0a5400247d5f771844 /webkit/appcache/appcache.cc | |
parent | e07dfdab975039ea0719e8dc7e7f5faaf0887a91 (diff) | |
download | chromium_src-4f32303e4491c3b2358825e0b26f8c5db3b28b33.zip chromium_src-4f32303e4491c3b2358825e0b26f8c5db3b28b33.tar.gz chromium_src-4f32303e4491c3b2358825e0b26f8c5db3b28b33.tar.bz2 |
Undo in memory changes made by an update job if the commit to disk fails. Provide a more clear error message when the commit fails due to exceeding the quota.
TEST=MasterEntryFailStoreNewestCacheTest
BUG=50985
Review URL: http://codereview.chromium.org/2836075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54667 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache.cc')
-rw-r--r-- | webkit/appcache/appcache.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/webkit/appcache/appcache.cc b/webkit/appcache/appcache.cc index 4bc7294..de25b15 100644 --- a/webkit/appcache/appcache.cc +++ b/webkit/appcache/appcache.cc @@ -43,6 +43,7 @@ void AppCache::UnassociateHost(AppCacheHost* host) { void AppCache::AddEntry(const GURL& url, const AppCacheEntry& entry) { DCHECK(entries_.find(url) == entries_.end()); entries_.insert(EntryMap::value_type(url, entry)); + cache_size_ += entry.response_size(); } bool AppCache::AddOrModifyEntry(const GURL& url, const AppCacheEntry& entry) { @@ -57,6 +58,13 @@ bool AppCache::AddOrModifyEntry(const GURL& url, const AppCacheEntry& entry) { return ret.second; } +void AppCache::RemoveEntry(const GURL& url) { + EntryMap::iterator found = entries_.find(url); + DCHECK(found != entries_.end()); + cache_size_ -= found->second.response_size(); + entries_.erase(found); +} + AppCacheEntry* AppCache::GetEntry(const GURL& url) { EntryMap::iterator it = entries_.find(url); return (it != entries_.end()) ? &(it->second) : NULL; @@ -95,6 +103,7 @@ void AppCache::InitializeWithDatabaseRecords( AddEntry(entry.url, AppCacheEntry(entry.flags, entry.response_id, entry.response_size)); } + DCHECK(cache_size_ == cache_record.cache_size); for (size_t i = 0; i < fallbacks.size(); ++i) { const AppCacheDatabase::FallbackNameSpaceRecord& fallback = fallbacks.at(i); |