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

Unified Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 849163002: ServiceWorker: Expose registration within ServiceWorkerGlobalScope [2/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove dcheck Created 5 years, 11 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 | « no previous file | content/child/service_worker/service_worker_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_dispatcher_host.cc
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc
index a8b77c3f23a8c5708c356b801b63219be60a77ce..20615b6d1f67510c56f560b689276ed2982bb075 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -552,6 +552,22 @@ void ServiceWorkerDispatcherHost::OnSetHostedVersionId(
return;
if (!provider_host->SetHostedVersionId(version_id))
BadMessageReceived();
+
+ // Retrieve the registration associated with |version_id|.
+ ServiceWorkerVersion* version = GetContext()->GetLiveVersion(version_id);
+ if (!version)
+ return;
+ ServiceWorkerRegistration* registration =
+ GetContext()->GetLiveRegistration(version->registration_id());
+ DCHECK(registration);
+
+ ServiceWorkerRegistrationObjectInfo info;
+ ServiceWorkerVersionAttributes attrs;
+ GetRegistrationObjectInfoAndVersionAttributes(
+ provider_host->AsWeakPtr(), registration, &info, &attrs);
+
+ Send(new ServiceWorkerMsg_AssociateRegistrationWithServiceWorker(
+ kDocumentMainThreadId, provider_id, info, attrs));
}
ServiceWorkerRegistrationHandle*
« no previous file with comments | « no previous file | content/child/service_worker/service_worker_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698