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

Unified Diff: content/browser/cache_storage/cache_storage_dispatcher_host.cc

Issue 1113303003: CacheStorage: Support multiple batch operations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_responses
Patch Set: add comments Created 5 years, 7 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/cache_storage/cache_storage_dispatcher_host.cc
diff --git a/content/browser/cache_storage/cache_storage_dispatcher_host.cc b/content/browser/cache_storage/cache_storage_dispatcher_host.cc
index 025a130bad7dfa6ead3900dc32dfd9676274f524..f8630f6ce7bab5c4b64634edb9ba23efa3479226 100644
--- a/content/browser/cache_storage/cache_storage_dispatcher_host.cc
+++ b/content/browser/cache_storage/cache_storage_dispatcher_host.cc
@@ -244,40 +244,10 @@ void CacheStorageDispatcherHost::OnCacheBatch(
thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound));
return;
}
-
- const CacheStorageBatchOperation& operation = operations[0];
-
scoped_refptr<CacheStorageCache> cache = it->second;
- scoped_ptr<ServiceWorkerFetchRequest> scoped_request(
- new ServiceWorkerFetchRequest(
- operation.request.url, operation.request.method,
- operation.request.headers, operation.request.referrer,
- operation.request.is_reload));
-
- if (operation.operation_type == CACHE_STORAGE_CACHE_OPERATION_TYPE_DELETE) {
- cache->Delete(scoped_request.Pass(),
- base::Bind(&CacheStorageDispatcherHost::OnCacheBatchCallback,
+ cache->BatchOperation(
+ operations, base::Bind(&CacheStorageDispatcherHost::OnCacheBatchCallback,
this, thread_id, request_id, cache));
- return;
- }
-
- if (operation.operation_type == CACHE_STORAGE_CACHE_OPERATION_TYPE_PUT) {
- // We don't support streaming for cache.
- DCHECK(operation.response.stream_url.is_empty());
- scoped_ptr<ServiceWorkerResponse> scoped_response(new ServiceWorkerResponse(
- operation.response.url, operation.response.status_code,
- operation.response.status_text, operation.response.response_type,
- operation.response.headers, operation.response.blob_uuid,
- operation.response.blob_size, operation.response.stream_url));
- cache->Put(scoped_request.Pass(), scoped_response.Pass(),
- base::Bind(&CacheStorageDispatcherHost::OnCacheBatchCallback,
- this, thread_id, request_id, cache));
-
- return;
- }
-
- Send(new CacheStorageMsg_CacheBatchError(
- thread_id, request_id, blink::WebServiceWorkerCacheErrorNotImplemented));
}
void CacheStorageDispatcherHost::OnCacheClosed(int cache_id) {

Powered by Google App Engine
This is Rietveld 408576698