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

Unified Diff: content/child/service_worker/service_worker_dispatcher.cc

Issue 517493002: ServiceWorker: Update the install sequence as per the latest spec (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment fix (+rebase) Created 6 years, 4 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/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));
+ 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();
}
}
« no previous file with comments | « content/child/service_worker/service_worker_dispatcher.h ('k') | content/child/service_worker/service_worker_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698