ipc/testshell/TestShellParent.h

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     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 "nsAutoJSValHolder.h"
    16 #include "nsString.h"
    18 namespace mozilla {
    20 namespace ipc {
    22 class TestShellCommandParent;
    24 class TestShellParent : public PTestShellParent
    25 {
    26 public:
    27   PTestShellCommandParent*
    28   AllocPTestShellCommandParent(const nsString& aCommand);
    30   bool
    31   DeallocPTestShellCommandParent(PTestShellCommandParent* aActor);
    33   bool
    34   CommandDone(TestShellCommandParent* aActor, const nsString& aResponse);
    35 };
    38 class TestShellCommandParent : public PTestShellCommandParent
    39 {
    40 public:
    41   TestShellCommandParent() : mCx(nullptr) { }
    43   bool SetCallback(JSContext* aCx, JS::Value aCallback);
    45   bool RunCallback(const nsString& aResponse);
    47   void ReleaseCallback();
    49 protected:
    50   bool ExecuteCallback(const nsString& aResponse);
    52   void ActorDestroy(ActorDestroyReason why);
    54   bool Recv__delete__(const nsString& aResponse) {
    55     return ExecuteCallback(aResponse);
    56   }
    58 private:
    59   JSContext* mCx;
    60   nsAutoJSValHolder mCallback;
    61 };
    64 } /* namespace ipc */
    65 } /* namespace mozilla */
    67 #endif /* ipc_testshell_TestShellParent_h */

mercurial