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_JSOracleParent
8 #define mozilla_dom_JSOracleParent
10 #include "mozilla/MozPromise.h"
11 #include "mozilla/ProcInfo.h"
12 #include "mozilla/dom/PJSOracleParent.h"
14 namespace mozilla::ipc
{
15 class UtilityProcessParent
;
18 namespace mozilla::dom
{
20 class JSOracleParent final
: public PJSOracleParent
{
22 JSOracleParent() = default;
24 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(JSOracleParent
, override
);
26 static void WithJSOracle(
27 const std::function
<void(JSOracleParent
* aParent
)>& aCallback
);
29 UtilityActorName
GetActorName() { return UtilityActorName::JSOracle
; }
31 void ActorDestroy(ActorDestroyReason aReason
) override
;
33 nsresult
BindToUtilityProcess(
34 const RefPtr
<mozilla::ipc::UtilityProcessParent
>& aUtilityParent
);
36 void Bind(Endpoint
<PJSOracleParent
>&& aEndpoint
);
39 ~JSOracleParent() = default;
41 static JSOracleParent
* GetSingleton();
43 using JSOraclePromise
= GenericNonExclusivePromise
;
44 RefPtr
<JSOraclePromise
> StartJSOracle();
46 } // namespace mozilla::dom
48 #endif // defined(mozilla_dom_JSOracleParent)