Bug 1508381 - remove now-unnecessary TASKCLUSTER_* variables r=tomprince
[gecko.git] / ipc / testshell / TestShellParent.h
blobf40e43e498523f77c6a627e8dc9c454c751a2373
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/TypeDecls.h"
15 #include "js/RootingAPI.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 virtual void ActorDestroy(ActorDestroyReason aWhy) override;
30 PTestShellCommandParent* AllocPTestShellCommandParent(
31 const nsString& aCommand);
33 bool DeallocPTestShellCommandParent(PTestShellCommandParent* aActor);
35 bool CommandDone(TestShellCommandParent* aActor, const nsString& aResponse);
38 class TestShellCommandParent : public PTestShellCommandParent {
39 friend class PTestShellCommandParent;
41 public:
42 TestShellCommandParent() {}
44 bool SetCallback(JSContext* aCx, const JS::Value& aCallback);
46 bool RunCallback(const nsString& aResponse);
48 void ReleaseCallback();
50 protected:
51 bool ExecuteCallback(const nsString& aResponse);
53 void ActorDestroy(ActorDestroyReason why) override;
55 mozilla::ipc::IPCResult Recv__delete__(const nsString& aResponse) override {
56 if (!ExecuteCallback(aResponse)) {
57 return IPC_FAIL_NO_REASON(this);
59 return IPC_OK();
62 private:
63 JS::PersistentRooted<JS::Value> mCallback;
66 } /* namespace ipc */
67 } /* namespace mozilla */
69 #endif /* ipc_testshell_TestShellParent_h */