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/. */
7 #ifndef mozilla_dom_RemoteWorkerServiceParent_h
8 #define mozilla_dom_RemoteWorkerServiceParent_h
10 #include "mozilla/dom/PRemoteWorkerServiceParent.h"
11 #include "mozilla/dom/RemoteType.h"
13 namespace mozilla::dom
{
16 class RemoteWorkerManager
;
17 class ThreadsafeContentParentHandle
;
20 * PBackground-thread parent actor that registers with the PBackground
21 * RemoteWorkerManager and used to relay spawn requests.
23 class RemoteWorkerServiceParent final
: public PRemoteWorkerServiceParent
{
25 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RemoteWorkerServiceParent
, override
);
27 static RefPtr
<RemoteWorkerServiceParent
> CreateForProcess(
28 ContentParent
* aProcess
, Endpoint
<PRemoteWorkerServiceChild
>* aChildEp
);
30 void ActorDestroy(mozilla::ipc::IProtocol::ActorDestroyReason
) override
;
32 bool IsOtherProcessActor() const { return mProcess
!= nullptr; }
34 ThreadsafeContentParentHandle
* GetContentParentHandle() const {
38 nsCString
GetRemoteType() const;
41 explicit RemoteWorkerServiceParent(ThreadsafeContentParentHandle
* aProcess
);
42 ~RemoteWorkerServiceParent();
44 void InitializeOnThread(Endpoint
<PRemoteWorkerServiceParent
> aEndpoint
);
46 const RefPtr
<ThreadsafeContentParentHandle
> mProcess
;
47 RefPtr
<RemoteWorkerManager
> mManager
;
50 } // namespace mozilla::dom
52 #endif // mozilla_dom_RemoteWorkerServiceParent_h