Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(763)

Unified Diff: content/browser/service_worker/service_worker_cache.cc

Issue 649203005: [ServiceWorkerCache] Put should replace an existing entry to meet spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@staticize
Patch Set: Reapply patchset 5 (lost in rebase) Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_cache.cc
diff --git a/content/browser/service_worker/service_worker_cache.cc b/content/browser/service_worker/service_worker_cache.cc
index 6069f1190890b8a53412a7fea249a54525051e2a..977e003c9c229a9d22bc00adce67a1b0b6c8fc13 100644
--- a/content/browser/service_worker/service_worker_cache.cc
+++ b/content/browser/service_worker/service_worker_cache.cc
@@ -887,6 +887,23 @@ void ServiceWorkerCache::PutImpl(scoped_ptr<PutContext> put_context) {
return;
}
+ scoped_ptr<ServiceWorkerFetchRequest> request_copy(
+ new ServiceWorkerFetchRequest(*put_context->request));
+ ServiceWorkerCache* cache_ptr = put_context->cache.get();
+
+ cache_ptr->Delete(request_copy.Pass(),
+ base::Bind(PutDidDelete, base::Passed(put_context.Pass())));
+}
+
+// static
+void ServiceWorkerCache::PutDidDelete(scoped_ptr<PutContext> put_context,
+ ErrorType delete_error) {
+ if (!put_context->cache || !put_context->cache->backend_) {
+ put_context->callback.Run(ErrorTypeStorage,
+ scoped_ptr<ServiceWorkerResponse>(),
+ scoped_ptr<storage::BlobDataHandle>());
+ }
+
disk_cache::Entry** entry_ptr = &put_context->cache_entry;
ServiceWorkerFetchRequest* request_ptr = put_context->request.get();
disk_cache::Backend* backend_ptr = put_context->cache->backend_.get();
« no previous file with comments | « content/browser/service_worker/service_worker_cache.h ('k') | content/browser/service_worker/service_worker_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698