Chromium Code Reviews| Index: content/browser/service_worker/service_worker_cache_listener.cc |
| diff --git a/content/browser/service_worker/service_worker_cache_listener.cc b/content/browser/service_worker/service_worker_cache_listener.cc |
| index ffd55a4880edb472cb11a69a1bed697b4e63e5c4..a03f4478c48c756aa486a5521b0671185dbc7de3 100644 |
| --- a/content/browser/service_worker/service_worker_cache_listener.cc |
| +++ b/content/browser/service_worker/service_worker_cache_listener.cc |
| @@ -10,15 +10,15 @@ |
| namespace content { |
| -ServiceWorkerStoresListener::ServiceWorkerStoresListener( |
| +ServiceWorkerCacheListener::ServiceWorkerCacheListener( |
| ServiceWorkerVersion* version) : version_(version) {} |
| -ServiceWorkerStoresListener::~ServiceWorkerStoresListener() {} |
| +ServiceWorkerCacheListener::~ServiceWorkerCacheListener() {} |
| -bool ServiceWorkerStoresListener::OnMessageReceived( |
| +bool ServiceWorkerCacheListener::OnMessageReceived( |
| const IPC::Message& message) { |
| bool handled = true; |
| - IPC_BEGIN_MESSAGE_MAP(ServiceWorkerStoresListener, message) |
| + IPC_BEGIN_MESSAGE_MAP(ServiceWorkerCacheListener, message) |
| IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_CacheStorageGet, |
| OnCacheStorageGet) |
| IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_CacheStorageHas, |
| @@ -29,13 +29,21 @@ bool ServiceWorkerStoresListener::OnMessageReceived( |
| OnCacheStorageDelete) |
| IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_CacheStorageKeys, |
| OnCacheStorageKeys) |
| + IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_CacheMatch, |
| + OnCacheMatch) |
| + IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_CacheMatchAll, |
| + OnCacheMatchAll) |
| + IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_CacheKeys, |
| + OnCacheKeys) |
| + IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_CacheBatch, |
| + OnCacheBatch) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| return handled; |
| } |
| -void ServiceWorkerStoresListener::OnCacheStorageGet( |
| +void ServiceWorkerCacheListener::OnCacheStorageGet( |
| int request_id, |
| const base::string16& fetch_store_name) { |
| // TODO(gavinp,jkarlin): Implement this method. |
| @@ -44,7 +52,7 @@ void ServiceWorkerStoresListener::OnCacheStorageGet( |
| blink::WebServiceWorkerCacheErrorNotImplemented)); |
| } |
| -void ServiceWorkerStoresListener::OnCacheStorageHas( |
| +void ServiceWorkerCacheListener::OnCacheStorageHas( |
| int request_id, |
| const base::string16& fetch_store_name) { |
| // TODO(gavinp,jkarlin): Implement this method. |
| @@ -53,16 +61,15 @@ void ServiceWorkerStoresListener::OnCacheStorageHas( |
| blink::WebServiceWorkerCacheErrorNotImplemented)); |
| } |
| -void ServiceWorkerStoresListener::OnCacheStorageCreate( |
| +void ServiceWorkerCacheListener::OnCacheStorageCreate( |
|
dominicc (has gone to gerrit)
2014/08/15 06:48:34
Can you privatize some of these? Or is this a Chro
gavinp
2014/09/03 18:35:24
Done.
|
| int request_id, |
| const base::string16& fetch_store_name) { |
| - // TODO(gavinp,jkarlin): Implement this method. |
| - Send(ServiceWorkerMsg_CacheStorageCreateError( |
| - request_id, |
| - blink::WebServiceWorkerCacheErrorNotImplemented)); |
| + static int next_cache_id = 0; |
| + |
| + Send(ServiceWorkerMsg_CacheStorageCreateSuccess(request_id, next_cache_id++)); |
|
dominicc (has gone to gerrit)
2014/08/15 06:48:34
Since zero is a default value, might be nice to no
gavinp
2014/09/03 18:35:24
Moot, that was test code that shouldn't have been
|
| } |
| -void ServiceWorkerStoresListener::OnCacheStorageDelete( |
| +void ServiceWorkerCacheListener::OnCacheStorageDelete( |
| int request_id, |
| const base::string16& fetch_store_name) { |
| // TODO(gavinp,jkarlin): Implement this method. |
| @@ -70,14 +77,54 @@ void ServiceWorkerStoresListener::OnCacheStorageDelete( |
| request_id, blink::WebServiceWorkerCacheErrorNotImplemented)); |
| } |
| -void ServiceWorkerStoresListener::OnCacheStorageKeys( |
| +void ServiceWorkerCacheListener::OnCacheStorageKeys( |
| int request_id) { |
| // TODO(gavinp,jkarlin): Implement this method. |
| Send(ServiceWorkerMsg_CacheStorageKeysError( |
| request_id, blink::WebServiceWorkerCacheErrorNotImplemented)); |
| } |
| -void ServiceWorkerStoresListener::Send(const IPC::Message& message) { |
| +void ServiceWorkerCacheListener::OnCacheMatch( |
| + int request_id, |
| + int cache_id, |
| + const ServiceWorkerFetchRequest& request, |
| + const ServiceWorkerCacheQueryParams& match_params) { |
| + // TODO(gavinp,jkarlin): Implement this method. |
| + Send(ServiceWorkerMsg_CacheMatchError( |
| + request_id, blink::WebServiceWorkerCacheErrorNotImplemented)); |
| +} |
| + |
| +void ServiceWorkerCacheListener::OnCacheMatchAll( |
| + int request_id, |
| + int cache_id, |
| + const ServiceWorkerFetchRequest& request, |
| + const ServiceWorkerCacheQueryParams& match_params) { |
| + // TODO(gavinp,jkarlin): Implement this method. |
| + Send(ServiceWorkerMsg_CacheMatchAllError( |
| + request_id, blink::WebServiceWorkerCacheErrorNotImplemented)); |
| +} |
| + |
| +void ServiceWorkerCacheListener::OnCacheKeys( |
| + int request_id, |
| + int cache_id, |
| + const ServiceWorkerFetchRequest& request, |
| + const ServiceWorkerCacheQueryParams& match_params) { |
| + // TODO(gavinp,jkarlin): Implement this method. |
| + Send(ServiceWorkerMsg_CacheKeysError( |
| + request_id, blink::WebServiceWorkerCacheErrorNotImplemented)); |
| +} |
| + |
| +void ServiceWorkerCacheListener::OnCacheBatch( |
| + int request_id, |
| + int cache_id, |
| + const std::vector<ServiceWorkerBatchOperation>& operations) { |
| + // TODO(gavinp,jkarlin): Implement this method. |
| + Send(ServiceWorkerMsg_CacheBatchError( |
| + request_id, blink::WebServiceWorkerCacheErrorNotImplemented)); |
| +} |
| + |
| + |
| +void ServiceWorkerCacheListener::Send(const IPC::Message& message) { |
| version_->embedded_worker()->SendMessage(message); |
| } |