diff options
author | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-04 23:20:25 +0000 |
---|---|---|
committer | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-04 23:20:25 +0000 |
commit | 0b28f3b07cf243d582fcc2ed4a59dceb3e3378ce (patch) | |
tree | 9029d0ad8fd76fba12c3a2398f124455fc770004 /webkit/appcache | |
parent | ab2d6f997f12dbc5c182e1c1462df5daa8eaa748 (diff) | |
download | chromium_src-0b28f3b07cf243d582fcc2ed4a59dceb3e3378ce.zip chromium_src-0b28f3b07cf243d582fcc2ed4a59dceb3e3378ce.tar.gz chromium_src-0b28f3b07cf243d582fcc2ed4a59dceb3e3378ce.tar.bz2 |
When an update job doesn't complete successfully, doom all responses created by that job.
TEST=existing tests apply
BUG=none
Review URL: http://codereview.chromium.org/523039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35489 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r-- | webkit/appcache/appcache_storage_impl.cc | 5 | ||||
-rw-r--r-- | webkit/appcache/appcache_update_job.cc | 7 | ||||
-rw-r--r-- | webkit/appcache/appcache_update_job.h | 4 |
3 files changed, 12 insertions, 4 deletions
diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc index cfa3be9..06e88db 100644 --- a/webkit/appcache/appcache_storage_impl.cc +++ b/webkit/appcache/appcache_storage_impl.cc @@ -816,7 +816,10 @@ AppCacheResponseWriter* AppCacheStorageImpl::CreateResponseWriter( void AppCacheStorageImpl::DoomResponses( const GURL& manifest_url, const std::vector<int64>& response_ids) { - // TODO(michaeln): do something here when deleting responses + for (std::vector<int64>::const_iterator it = response_ids.begin(); + it != response_ids.end(); ++it) { + disk_cache()->DoomEntry(Int64ToString(*it)); + } } AppCacheStorageImpl::CacheLoadTask* diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc index fbe79ff..04c409e 100644 --- a/webkit/appcache/appcache_update_job.cc +++ b/webkit/appcache/appcache_update_job.cc @@ -265,6 +265,7 @@ void AppCacheUpdateJob::OnResponseStarted(URLRequest *request) { info->SetUpResponseWriter( service_->storage()->CreateResponseWriter(manifest_url_), this, request); + stored_response_ids_.push_back(info->response_writer_->response_id()); scoped_refptr<HttpResponseInfoIOBuffer> io_buffer = new HttpResponseInfoIOBuffer( new net::HttpResponseInfo(request->response_info())); @@ -671,6 +672,7 @@ void AppCacheUpdateJob::HandleManifestRefetchCompleted(URLRequest* request) { } else { manifest_response_writer_.reset( service_->storage()->CreateResponseWriter(manifest_url_)); + stored_response_ids_.push_back(manifest_response_writer_->response_id()); scoped_refptr<HttpResponseInfoIOBuffer> io_buffer = new HttpResponseInfoIOBuffer(manifest_response_info_.release()); manifest_response_writer_->WriteInfo(io_buffer, @@ -1210,6 +1212,8 @@ void AppCacheUpdateJob::ClearPendingMasterEntries() { } void AppCacheUpdateJob::DiscardInprogressCache() { + service_->storage()->DoomResponses(manifest_url_, stored_response_ids_); + if (!inprogress_cache_) return; @@ -1217,9 +1221,6 @@ void AppCacheUpdateJob::DiscardInprogressCache() { while (!hosts.empty()) (*hosts.begin())->AssociateCache(NULL); - // TODO(jennb): Cleanup stored responses for entries in the cache? - // May not be necessary if handled automatically by storage layer. - inprogress_cache_ = NULL; } diff --git a/webkit/appcache/appcache_update_job.h b/webkit/appcache/appcache_update_job.h index 0d343f0..e4d50ca 100644 --- a/webkit/appcache/appcache_update_job.h +++ b/webkit/appcache/appcache_update_job.h @@ -236,6 +236,10 @@ class AppCacheUpdateJob : public URLRequest::Delegate, std::string loaded_manifest_data_; scoped_ptr<AppCacheResponseReader> manifest_response_reader_; + // Response ids stored by this update job, used to cleanup in + // error conditions. + std::vector<int64> stored_response_ids_; + net::CompletionCallbackImpl<AppCacheUpdateJob> manifest_info_write_callback_; net::CompletionCallbackImpl<AppCacheUpdateJob> manifest_data_write_callback_; net::CompletionCallbackImpl<AppCacheUpdateJob> manifest_data_read_callback_; |