Bug 1882457 - Update the release process docs for the monorepo migration. r=ahal...
[gecko.git] / ipc / testshell / TestShellParent.h
blobde4f73a94b9651fd5fc5a552f6eee2240f024a4a
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=8 et :
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef ipc_testshell_TestShellParent_h
9 #define ipc_testshell_TestShellParent_h 1
11 #include "mozilla/ipc/PTestShellParent.h"
12 #include "mozilla/ipc/PTestShellCommandParent.h"
14 #include "js/RootingAPI.h"
15 #include "js/Value.h"
16 #include "nsString.h"
18 namespace mozilla {
20 namespace ipc {
22 class TestShellCommandParent;
24 class TestShellParent : public PTestShellParent {
25 friend class PTestShellParent;
27 public:
28 NS_INLINE_DECL_REFCOUNTING(TestShellParent, override)
30 virtual void ActorDestroy(ActorDestroyReason aWhy) override;
32 PTestShellCommandParent* AllocPTestShellCommandParent(
33 const nsAString& aCommand);
35 bool DeallocPTestShellCommandParent(PTestShellCommandParent* aActor);
37 bool CommandDone(TestShellCommandParent* aActor, const nsAString& aResponse);
39 private:
40 ~TestShellParent() = default;
43 class TestShellCommandParent : public PTestShellCommandParent {
44 friend class PTestShellCommandParent;
46 public:
47 TestShellCommandParent() = default;
49 bool SetCallback(JSContext* aCx, const JS::Value& aCallback);
51 bool RunCallback(const nsAString& aResponse);
53 void ReleaseCallback();
55 protected:
56 bool ExecuteCallback(const nsAString& aResponse);
58 void ActorDestroy(ActorDestroyReason why) override;
60 mozilla::ipc::IPCResult Recv__delete__(const nsAString& aResponse) {
61 if (!ExecuteCallback(aResponse)) {
62 return IPC_FAIL_NO_REASON(this);
64 return IPC_OK();
67 private:
68 JS::PersistentRooted<JS::Value> mCallback;
71 } /* namespace ipc */
72 } /* namespace mozilla */
74 #endif /* ipc_testshell_TestShellParent_h */