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

Unified Diff: content/renderer/service_worker/service_worker_cache_storage_dispatcher.cc

Issue 664433003: [ServiceWorkerCacheStorage] Add support for new Open method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dispatch the response 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
« no previous file with comments | « content/renderer/service_worker/service_worker_cache_storage_dispatcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/service_worker/service_worker_cache_storage_dispatcher.cc
diff --git a/content/renderer/service_worker/service_worker_cache_storage_dispatcher.cc b/content/renderer/service_worker/service_worker_cache_storage_dispatcher.cc
index bc37b31796e32b3e3f3fa234b839ce73a98c0b01..596d7c562e90f691fe615d253591aa159379952f 100644
--- a/content/renderer/service_worker/service_worker_cache_storage_dispatcher.cc
+++ b/content/renderer/service_worker/service_worker_cache_storage_dispatcher.cc
@@ -207,6 +207,7 @@ ServiceWorkerCacheStorageDispatcher::~ServiceWorkerCacheStorageDispatcher() {
ClearCallbacksMapWithErrors(&get_callbacks_);
ClearCallbacksMapWithErrors(&has_callbacks_);
ClearCallbacksMapWithErrors(&create_callbacks_);
+ ClearCallbacksMapWithErrors(&open_callbacks_);
ClearCallbacksMapWithErrors(&delete_callbacks_);
ClearCallbacksMapWithErrors(&keys_callbacks_);
@@ -226,6 +227,8 @@ bool ServiceWorkerCacheStorageDispatcher::OnMessageReceived(
OnCacheStorageHasSuccess)
IPC_MESSAGE_HANDLER(ServiceWorkerMsg_CacheStorageCreateSuccess,
OnCacheStorageCreateSuccess)
+ IPC_MESSAGE_HANDLER(ServiceWorkerMsg_CacheStorageOpenSuccess,
+ OnCacheStorageOpenSuccess)
IPC_MESSAGE_HANDLER(ServiceWorkerMsg_CacheStorageDeleteSuccess,
OnCacheStorageDeleteSuccess)
IPC_MESSAGE_HANDLER(ServiceWorkerMsg_CacheStorageKeysSuccess,
@@ -236,6 +239,8 @@ bool ServiceWorkerCacheStorageDispatcher::OnMessageReceived(
OnCacheStorageHasError)
IPC_MESSAGE_HANDLER(ServiceWorkerMsg_CacheStorageCreateError,
OnCacheStorageCreateError)
+ IPC_MESSAGE_HANDLER(ServiceWorkerMsg_CacheStorageOpenError,
+ OnCacheStorageOpenError)
IPC_MESSAGE_HANDLER(ServiceWorkerMsg_CacheStorageDeleteError,
OnCacheStorageDeleteError)
IPC_MESSAGE_HANDLER(ServiceWorkerMsg_CacheStorageKeysError,
@@ -290,6 +295,17 @@ void ServiceWorkerCacheStorageDispatcher::OnCacheStorageCreateSuccess(
create_callbacks_.Remove(request_id);
}
+void ServiceWorkerCacheStorageDispatcher::OnCacheStorageOpenSuccess(
+ int request_id,
+ int cache_id) {
+ WebCache* web_cache = new WebCache(weak_factory_.GetWeakPtr(), cache_id);
+ web_caches_.AddWithID(web_cache, cache_id);
+ CacheStorageWithCacheCallbacks* callbacks =
+ open_callbacks_.Lookup(request_id);
+ callbacks->onSuccess(web_cache);
+ open_callbacks_.Remove(request_id);
+}
+
void ServiceWorkerCacheStorageDispatcher::OnCacheStorageDeleteSuccess(
int request_id) {
CacheStorageCallbacks* callbacks = delete_callbacks_.Lookup(request_id);
@@ -335,6 +351,15 @@ void ServiceWorkerCacheStorageDispatcher::OnCacheStorageCreateError(
create_callbacks_.Remove(request_id);
}
+void ServiceWorkerCacheStorageDispatcher::OnCacheStorageOpenError(
+ int request_id,
+ blink::WebServiceWorkerCacheError reason) {
+ CacheStorageWithCacheCallbacks* callbacks =
+ open_callbacks_.Lookup(request_id);
+ callbacks->onError(&reason);
+ open_callbacks_.Remove(request_id);
+}
+
void ServiceWorkerCacheStorageDispatcher::OnCacheStorageDeleteError(
int request_id,
blink::WebServiceWorkerCacheError reason) {
@@ -460,6 +485,14 @@ void ServiceWorkerCacheStorageDispatcher::dispatchCreate(
script_context_->GetRoutingID(), request_id, cacheName));
}
+void ServiceWorkerCacheStorageDispatcher::dispatchOpen(
+ CacheStorageWithCacheCallbacks* callbacks,
+ const blink::WebString& cacheName) {
+ int request_id = open_callbacks_.Add(callbacks);
+ script_context_->Send(new ServiceWorkerHostMsg_CacheStorageOpen(
+ script_context_->GetRoutingID(), request_id, cacheName));
+}
+
void ServiceWorkerCacheStorageDispatcher::dispatchDelete(
CacheStorageCallbacks* callbacks,
const blink::WebString& cacheName) {
« no previous file with comments | « content/renderer/service_worker/service_worker_cache_storage_dispatcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698