RemoteWorkerParent.h (2093B)
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_RemoteWorkerParent_h 8 #define mozilla_dom_RemoteWorkerParent_h 9 10 #include "mozilla/dom/PRemoteWorkerParent.h" 11 #include "mozilla/dom/UniqueContentParentKeepAlive.h" 12 13 namespace mozilla::dom { 14 15 class RemoteWorkerController; 16 class RemoteWorkerServiceParent; 17 18 /** 19 * PBackground-managed parent actor that is mutually associated with a single 20 * RemoteWorkerController. Relays error/close events to the controller and in 21 * turns is told life-cycle events. 22 */ 23 class RemoteWorkerParent final : public PRemoteWorkerParent { 24 friend class PRemoteWorkerParent; 25 26 public: 27 NS_INLINE_DECL_REFCOUNTING(RemoteWorkerParent, override); 28 29 explicit RemoteWorkerParent( 30 UniqueThreadsafeContentParentKeepAlive&& aKeepAlive); 31 32 void SetController(RemoteWorkerController* aController); 33 34 void MaybeSendDelete(); 35 36 RemoteWorkerServiceParent* Manager() const; 37 38 private: 39 ~RemoteWorkerParent(); 40 41 already_AddRefed<PFetchEventOpProxyParent> AllocPFetchEventOpProxyParent( 42 const ParentToChildServiceWorkerFetchEventOpArgs& aArgs); 43 44 void ActorDestroy(mozilla::ipc::IProtocol::ActorDestroyReason) override; 45 46 mozilla::ipc::IPCResult RecvError(const ErrorValue& aValue); 47 48 mozilla::ipc::IPCResult RecvNotifyLock(const bool& aCreated); 49 50 mozilla::ipc::IPCResult RecvNotifyWebTransport(const bool& aCreated); 51 52 mozilla::ipc::IPCResult RecvClose(); 53 54 mozilla::ipc::IPCResult RecvCreated(const bool& aStatus); 55 56 mozilla::ipc::IPCResult RecvSetServiceWorkerSkipWaitingFlag( 57 SetServiceWorkerSkipWaitingFlagResolver&& aResolve); 58 59 bool mDeleteSent = false; 60 RefPtr<RemoteWorkerController> mController; 61 UniqueThreadsafeContentParentKeepAlive mContentParentKeepAlive; 62 }; 63 64 } // namespace mozilla::dom 65 66 #endif // mozilla_dom_RemoteWorkerParent_h