Backed out changeset 9d8b4c0b99ed (bug 1945683) for causing btime failures. CLOSED...
[gecko.git] / dom / workers / remoteworkers / RemoteWorkerServiceParent.h
blob322b77e667b9a2bd0bdc086eff1078c5d593f5d0
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 {
15 class ContentParent;
16 class RemoteWorkerManager;
17 class ThreadsafeContentParentHandle;
19 /**
20 * PBackground-thread parent actor that registers with the PBackground
21 * RemoteWorkerManager and used to relay spawn requests.
23 class RemoteWorkerServiceParent final : public PRemoteWorkerServiceParent {
24 public:
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 {
35 return mProcess;
38 nsCString GetRemoteType() const;
40 private:
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