From 74bf5d1616078374ca5b2946a6bc838c29418896 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Wed, 14 Feb 2018 14:23:15 -0500 Subject: [PATCH] Bug 1434701 P4 Move ServiceWorkerRegistrationListener into its own header. r=asuth --- dom/serviceworkers/ServiceWorkerManager.cpp | 1 + .../ServiceWorkerRegistration.cpp | 3 ++ .../ServiceWorkerRegistration.h | 26 +----------- .../ServiceWorkerRegistrationListener.h | 42 +++++++++++++++++++ 4 files changed, 47 insertions(+), 25 deletions(-) create mode 100644 dom/serviceworkers/ServiceWorkerRegistrationListener.h diff --git a/dom/serviceworkers/ServiceWorkerManager.cpp b/dom/serviceworkers/ServiceWorkerManager.cpp index c0ad5505d62d..66d20323b640 100644 --- a/dom/serviceworkers/ServiceWorkerManager.cpp +++ b/dom/serviceworkers/ServiceWorkerManager.cpp @@ -80,6 +80,7 @@ #include "ServiceWorkerRegisterJob.h" #include "ServiceWorkerRegistrar.h" #include "ServiceWorkerRegistration.h" +#include "ServiceWorkerRegistrationListener.h" #include "ServiceWorkerScriptCache.h" #include "ServiceWorkerEvents.h" #include "ServiceWorkerUnregisterJob.h" diff --git a/dom/serviceworkers/ServiceWorkerRegistration.cpp b/dom/serviceworkers/ServiceWorkerRegistration.cpp index 217ad773b7a4..83fb72640ada 100644 --- a/dom/serviceworkers/ServiceWorkerRegistration.cpp +++ b/dom/serviceworkers/ServiceWorkerRegistration.cpp @@ -25,6 +25,7 @@ #include "nsServiceManagerUtils.h" #include "ServiceWorker.h" #include "ServiceWorkerManager.h" +#include "ServiceWorkerRegistrationListener.h" #include "nsIDocument.h" #include "nsIServiceWorkerManager.h" @@ -886,6 +887,8 @@ ServiceWorkerRegistrationMainThread::GetPushManager(JSContext* aCx, //////////////////////////////////////////////////// // Worker Thread implementation +class WorkerListener; + class ServiceWorkerRegistrationWorkerThread final : public ServiceWorkerRegistration , public WorkerHolder { diff --git a/dom/serviceworkers/ServiceWorkerRegistration.h b/dom/serviceworkers/ServiceWorkerRegistration.h index d42ba4a92723..dfbb8c093ce9 100644 --- a/dom/serviceworkers/ServiceWorkerRegistration.h +++ b/dom/serviceworkers/ServiceWorkerRegistration.h @@ -12,7 +12,6 @@ #include "mozilla/dom/ServiceWorkerBinding.h" #include "mozilla/dom/ServiceWorkerCommon.h" #include "mozilla/dom/ServiceWorkerRegistrationBinding.h" -#include "mozilla/dom/WorkerHolder.h" // Support for Notification API extension. #include "mozilla/dom/NotificationBinding.h" @@ -25,30 +24,7 @@ namespace dom { class Promise; class PushManager; class ServiceWorkerRegistrationDescriptor; -class WorkerListener; - -// Used by ServiceWorkerManager to notify ServiceWorkerRegistrations of -// updatefound event and invalidating ServiceWorker instances. -class ServiceWorkerRegistrationListener -{ -public: - NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING - - virtual void - UpdateFound() = 0; - - virtual void - InvalidateWorkers(WhichServiceWorker aWhichOnes) = 0; - - virtual void - TransitionWorker(WhichServiceWorker aWhichOne) = 0; - - virtual void - RegistrationRemoved() = 0; - - virtual void - GetScope(nsAString& aScope) const = 0; -}; +class WorkerPrivate; class ServiceWorkerRegistration : public DOMEventTargetHelper { diff --git a/dom/serviceworkers/ServiceWorkerRegistrationListener.h b/dom/serviceworkers/ServiceWorkerRegistrationListener.h new file mode 100644 index 000000000000..360cad355806 --- /dev/null +++ b/dom/serviceworkers/ServiceWorkerRegistrationListener.h @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_dom_ServiceWorkerRegistrationListener_h +#define mozilla_dom_ServiceWorkerRegistrationListener_h + +#include "mozilla/dom/ServiceWorkerCommon.h" + +namespace mozilla { +namespace dom { + +// Used by ServiceWorkerManager to notify ServiceWorkerRegistrations of +// updatefound event and invalidating ServiceWorker instances. +class ServiceWorkerRegistrationListener +{ +public: + NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING + + virtual void + UpdateFound() = 0; + + virtual void + InvalidateWorkers(WhichServiceWorker aWhichOnes) = 0; + + virtual void + TransitionWorker(WhichServiceWorker aWhichOne) = 0; + + virtual void + RegistrationRemoved() = 0; + + virtual void + GetScope(nsAString& aScope) const = 0; +}; + + +} // namespace dom +} // namespace mozilla + +#endif /* mozilla_dom_ServiceWorkerRegistrationListener_h */