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..032dfa2921d3ae5f4d6e83c25e0ee6bc49733a5d 100644 |
| --- a/content/child/service_worker/service_worker_dispatcher.cc |
| +++ b/content/child/service_worker/service_worker_dispatcher.cc |
| @@ -62,6 +62,8 @@ void ServiceWorkerDispatcher::OnMessageReceived(const IPC::Message& msg) { |
| OnServiceWorkerStateChanged) |
| IPC_MESSAGE_HANDLER(ServiceWorkerMsg_SetVersionAttributes, |
| OnSetVersionAttributes) |
| + IPC_MESSAGE_HANDLER(ServiceWorkerMsg_UpdateFound, |
| + OnUpdateFound) |
| IPC_MESSAGE_HANDLER(ServiceWorkerMsg_SetControllerServiceWorker, |
| OnSetControllerServiceWorker) |
| IPC_MESSAGE_HANDLER(ServiceWorkerMsg_MessageToDocument, |
| @@ -238,14 +240,21 @@ ServiceWorkerDispatcher::GetServiceWorkerRegistration( |
| void ServiceWorkerDispatcher::OnRegistered( |
| int thread_id, |
| int request_id, |
| - const ServiceWorkerRegistrationObjectInfo& info) { |
| + const ServiceWorkerRegistrationObjectInfo& info, |
| + const ServiceWorkerVersionAttributes& attrs) { |
| WebServiceWorkerRegistrationCallbacks* callbacks = |
| pending_callbacks_.Lookup(request_id); |
| DCHECK(callbacks); |
| if (!callbacks) |
| return; |
| - callbacks->onSuccess(GetServiceWorkerRegistration(info, true)); |
| + WebServiceWorkerRegistrationImpl* registration = |
| + GetServiceWorkerRegistration(info, true); |
| + registration->SetInstalling(GetServiceWorker(attrs.installing, true)); |
|
nasko
2014/08/29 21:17:37
nit: Can you point to the CL that changes those me
nhiroki
2014/09/01 03:46:41
Those are existing methods introduced by the diffe
|
| + registration->SetWaiting(GetServiceWorker(attrs.waiting, true)); |
| + registration->SetActive(GetServiceWorker(attrs.active, true)); |
| + |
| + callbacks->onSuccess(registration); |
| pending_callbacks_.Remove(request_id); |
| } |
| @@ -316,6 +325,14 @@ void ServiceWorkerDispatcher::OnSetVersionAttributes( |
| } |
| } |
| +void ServiceWorkerDispatcher::OnUpdateFound( |
| + int thread_id, |
| + const ServiceWorkerRegistrationObjectInfo& info) { |
| + RegistrationObjectMap::iterator found = registrations_.find(info.handle_id); |
| + if (found != registrations_.end()) |
| + found->second->OnUpdateFound(); |
| +} |
| + |
| void ServiceWorkerDispatcher::SetInstallingServiceWorker( |
| int provider_id, |
| int registration_handle_id, |
| @@ -341,8 +358,6 @@ void ServiceWorkerDispatcher::SetInstallingServiceWorker( |
| if (found != registrations_.end()) { |
| // Populate the .installing field with the new worker object. |
| found->second->SetInstalling(GetServiceWorker(info, false)); |
| - if (info.handle_id != kInvalidServiceWorkerHandleId) |
| - found->second->OnUpdateFound(); |
| } |
| } |