1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_serviceworkerregistrationchild_h__ 8 #define mozilla_dom_serviceworkerregistrationchild_h__ 9 10 #include "mozilla/dom/PServiceWorkerRegistrationChild.h" 11 12 // XXX Avoid including this here by moving function bodies to the cpp file 13 #include "mozilla/dom/WorkerRef.h" 14 15 namespace mozilla { 16 namespace dom { 17 18 class IPCWorkerRef; 19 class RemoteServiceWorkerRegistrationImpl; 20 21 class ServiceWorkerRegistrationChild final 22 : public PServiceWorkerRegistrationChild { 23 RefPtr<IPCWorkerRef> mIPCWorkerRef; 24 RemoteServiceWorkerRegistrationImpl* mOwner; 25 bool mTeardownStarted; 26 27 ServiceWorkerRegistrationChild(); 28 29 ~ServiceWorkerRegistrationChild() = default; 30 31 // PServiceWorkerRegistrationChild 32 void ActorDestroy(ActorDestroyReason aReason) override; 33 34 mozilla::ipc::IPCResult RecvUpdateState( 35 const IPCServiceWorkerRegistrationDescriptor& aDescriptor) override; 36 37 mozilla::ipc::IPCResult RecvFireUpdateFound() override; 38 39 public: 40 NS_INLINE_DECL_REFCOUNTING(ServiceWorkerRegistrationChild, override); 41 42 static RefPtr<ServiceWorkerRegistrationChild> Create(); 43 44 void SetOwner(RemoteServiceWorkerRegistrationImpl* aOwner); 45 46 void RevokeOwner(RemoteServiceWorkerRegistrationImpl* aOwner); 47 48 void MaybeStartTeardown(); 49 }; 50 51 } // namespace dom 52 } // namespace mozilla 53 54 #endif // mozilla_dom_serviceworkerregistrationchild_h__ 55