diff options
author | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-13 20:57:50 +0000 |
---|---|---|
committer | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-13 20:57:50 +0000 |
commit | a84e7b5ec1cbdfe2d6943693d8bd71fcb6c64ce7 (patch) | |
tree | df6dbcf9a6bca8343355ffef01eeed49f6059b83 /webkit/appcache/appcache_response.cc | |
parent | 45699d6054f62173d0cd9df0f43af65047d76d79 (diff) | |
download | chromium_src-a84e7b5ec1cbdfe2d6943693d8bd71fcb6c64ce7.zip chromium_src-a84e7b5ec1cbdfe2d6943693d8bd71fcb6c64ce7.tar.gz chromium_src-a84e7b5ec1cbdfe2d6943693d8bd71fcb6c64ce7.tar.bz2 |
Trigger the deletion of unused responses when caches are updated and made obsolete (deleted).
BUG=none
TEST=not yet
Review URL: http://codereview.chromium.org/542021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36166 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_response.cc')
-rw-r--r-- | webkit/appcache/appcache_response.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/webkit/appcache/appcache_response.cc b/webkit/appcache/appcache_response.cc index 5f92439..c16bd5c 100644 --- a/webkit/appcache/appcache_response.cc +++ b/webkit/appcache/appcache_response.cc @@ -263,8 +263,15 @@ void AppCacheResponseWriter::OnIOComplete(int result) { } bool AppCacheResponseWriter::CreateEntryIfNeeded() { - if (!entry_) - disk_cache_->CreateEntry(response_key(response_id_), &entry_); + if (entry_) + return true; + std::string key(response_key(response_id_)); + if (!disk_cache_->CreateEntry(key, &entry_)) { + // We may try to overrite existing entries. + DCHECK(!entry_); + disk_cache_->DoomEntry(key); + disk_cache_->CreateEntry(key, &entry_); + } return entry_ ? true : false; } |