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

Unified Diff: content/browser/service_worker/service_worker_registration_handle.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/browser/service_worker/service_worker_registration_handle.cc
diff --git a/content/browser/service_worker/service_worker_registration_handle.cc b/content/browser/service_worker/service_worker_registration_handle.cc
index b32f5a92b9fe3f3a70bbc72674c686eb612632dd..21aa31ef16924f90d6e1900d484cd4a7fa5d169f 100644
--- a/content/browser/service_worker/service_worker_registration_handle.cc
+++ b/content/browser/service_worker/service_worker_registration_handle.cc
@@ -45,6 +45,23 @@ ServiceWorkerRegistrationHandle::GetObjectInfo() {
return info;
}
+ServiceWorkerObjectInfo
+ServiceWorkerRegistrationHandle::CreateServiceWorkerHandleAndPass(
+ ServiceWorkerVersion* version) {
+ ServiceWorkerObjectInfo info;
+ if (context_ && version) {
+ scoped_ptr<ServiceWorkerHandle> handle =
+ ServiceWorkerHandle::Create(context_,
+ dispatcher_host_,
+ kDocumentMainThreadId,
+ provider_id_,
+ version);
+ info = handle->GetObjectInfo();
+ dispatcher_host_->RegisterServiceWorkerHandle(handle.Pass());
+ }
+ return info;
+}
+
void ServiceWorkerRegistrationHandle::IncrementRefCount() {
DCHECK_GT(ref_count_, 0);
++ref_count_;
@@ -71,6 +88,14 @@ void ServiceWorkerRegistrationHandle::OnRegistrationFailed(
ClearVersionAttributes();
}
+void ServiceWorkerRegistrationHandle::OnUpdateFound(
+ ServiceWorkerRegistration* registration) {
+ if (!dispatcher_host_)
+ return; // Could be NULL in some tests.
+ dispatcher_host_->Send(new ServiceWorkerMsg_UpdateFound(
+ kDocumentMainThreadId, GetObjectInfo()));
+}
+
void ServiceWorkerRegistrationHandle::SetVersionAttributes(
ServiceWorkerVersion* installing_version,
ServiceWorkerVersion* waiting_version,
@@ -118,21 +143,4 @@ void ServiceWorkerRegistrationHandle::ClearVersionAttributes() {
SetVersionAttributes(NULL, NULL, NULL);
}
-ServiceWorkerObjectInfo
-ServiceWorkerRegistrationHandle::CreateServiceWorkerHandleAndPass(
- ServiceWorkerVersion* version) {
- ServiceWorkerObjectInfo info;
- if (context_ && version) {
- scoped_ptr<ServiceWorkerHandle> handle =
- ServiceWorkerHandle::Create(context_,
- dispatcher_host_,
- kDocumentMainThreadId,
- provider_id_,
- version);
- info = handle->GetObjectInfo();
- dispatcher_host_->RegisterServiceWorkerHandle(handle.Pass());
- }
- return info;
-}
-
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698