Chromium Code Reviews| Index: content/child/service_worker/service_worker_dispatcher.cc |
| diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc |
| index 74ec956efc857173f7ee24cf789b0fe598de44e5..bfe4075621b3e16e887ca81b777e92c1d962ed60 100644 |
| --- a/content/child/service_worker/service_worker_dispatcher.cc |
| +++ b/content/child/service_worker/service_worker_dispatcher.cc |
| @@ -92,7 +92,7 @@ void ServiceWorkerDispatcher::RegisterServiceWorker( |
| return; |
| } |
| - int request_id = pending_callbacks_.Add(callbacks); |
| + int request_id = pending_registration_callbacks_.Add(callbacks); |
| thread_safe_sender_->Send(new ServiceWorkerHostMsg_RegisterServiceWorker( |
| CurrentWorkerId(), request_id, provider_id, pattern, script_url)); |
| } |
| @@ -100,11 +100,11 @@ void ServiceWorkerDispatcher::RegisterServiceWorker( |
| void ServiceWorkerDispatcher::UnregisterServiceWorker( |
| int provider_id, |
| const GURL& pattern, |
| - WebServiceWorkerRegistrationCallbacks* callbacks) { |
| + WebServiceWorkerUnregistrationCallbacks* callbacks) { |
| DCHECK(callbacks); |
| if (pattern.possibly_invalid_spec().size() > GetMaxURLChars()) { |
| - scoped_ptr<WebServiceWorkerRegistrationCallbacks> |
| + scoped_ptr<WebServiceWorkerUnregistrationCallbacks> |
| owned_callbacks(callbacks); |
| scoped_ptr<WebServiceWorkerError> error(new WebServiceWorkerError( |
| WebServiceWorkerError::ErrorTypeSecurity, "URL too long")); |
| @@ -112,7 +112,7 @@ void ServiceWorkerDispatcher::UnregisterServiceWorker( |
| return; |
| } |
| - int request_id = pending_callbacks_.Add(callbacks); |
| + int request_id = pending_unregistration_callbacks_.Add(callbacks); |
| thread_safe_sender_->Send(new ServiceWorkerHostMsg_UnregisterServiceWorker( |
| CurrentWorkerId(), request_id, provider_id, pattern)); |
| } |
| @@ -240,26 +240,30 @@ void ServiceWorkerDispatcher::OnRegistered( |
| int request_id, |
| const ServiceWorkerRegistrationObjectInfo& info) { |
| WebServiceWorkerRegistrationCallbacks* callbacks = |
| - pending_callbacks_.Lookup(request_id); |
| + pending_registration_callbacks_.Lookup(request_id); |
| DCHECK(callbacks); |
| if (!callbacks) |
| return; |
| callbacks->onSuccess(GetServiceWorkerRegistration(info, true)); |
| - pending_callbacks_.Remove(request_id); |
| + pending_registration_callbacks_.Remove(request_id); |
| } |
| void ServiceWorkerDispatcher::OnUnregistered( |
| int thread_id, |
| int request_id) { |
| - WebServiceWorkerRegistrationCallbacks* callbacks = |
| - pending_callbacks_.Lookup(request_id); |
| + WebServiceWorkerUnregistrationCallbacks* callbacks = |
| + pending_unregistration_callbacks_.Lookup(request_id); |
| DCHECK(callbacks); |
| if (!callbacks) |
| return; |
| - |
| +#ifdef DISABLE_SERVICEWORKER_UNREGISTER_RESOLVE_TO_BOOLEAN |
| callbacks->onSuccess(NULL); |
| - pending_callbacks_.Remove(request_id); |
| +#else |
| + bool is_success = true; |
| + callbacks->onSuccess(&is_success); |
| +#endif |
| + pending_unregistration_callbacks_.Remove(request_id); |
| } |
| void ServiceWorkerDispatcher::OnRegistrationError( |
| @@ -268,7 +272,7 @@ void ServiceWorkerDispatcher::OnRegistrationError( |
| WebServiceWorkerError::ErrorType error_type, |
| const base::string16& message) { |
| WebServiceWorkerRegistrationCallbacks* callbacks = |
| - pending_callbacks_.Lookup(request_id); |
| + pending_registration_callbacks_.Lookup(request_id); |
|
nhiroki
2014/08/29 07:27:29
Probably we can reach here when the unregisteratio
shimazu
2014/09/01 05:35:34
Done.
|
| DCHECK(callbacks); |
| if (!callbacks) |
| return; |
| @@ -276,7 +280,7 @@ void ServiceWorkerDispatcher::OnRegistrationError( |
| scoped_ptr<WebServiceWorkerError> error( |
| new WebServiceWorkerError(error_type, message)); |
| callbacks->onError(error.release()); |
| - pending_callbacks_.Remove(request_id); |
| + pending_registration_callbacks_.Remove(request_id); |
| } |
| void ServiceWorkerDispatcher::OnServiceWorkerStateChanged( |