2009-12-03 00:16:14 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-07-10 23:33:10 -07:00
|
|
|
|
2009-09-09 15:00:14 -07:00
|
|
|
#ifndef ipc_testshell_TestShellParent_h
|
|
|
|
#define ipc_testshell_TestShellParent_h 1
|
2009-07-10 23:33:10 -07:00
|
|
|
|
2009-09-09 15:59:06 -07:00
|
|
|
#include "mozilla/ipc/PTestShellParent.h"
|
|
|
|
#include "mozilla/ipc/PTestShellCommandParent.h"
|
2009-08-25 16:07:22 -07:00
|
|
|
|
2013-08-27 19:59:14 -07:00
|
|
|
#include "js/TypeDecls.h"
|
2009-08-25 16:07:22 -07:00
|
|
|
#include "nsAutoJSValHolder.h"
|
2013-09-23 10:25:00 -07:00
|
|
|
#include "nsString.h"
|
2009-07-10 23:33:10 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
2009-11-06 12:43:39 -08:00
|
|
|
|
2009-07-10 23:33:10 -07:00
|
|
|
namespace ipc {
|
|
|
|
|
2009-12-03 00:16:14 -08:00
|
|
|
class TestShellCommandParent;
|
|
|
|
|
|
|
|
class TestShellParent : public PTestShellParent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PTestShellCommandParent*
|
2013-07-08 08:48:39 -07:00
|
|
|
AllocPTestShellCommandParent(const nsString& aCommand);
|
2009-12-03 00:16:14 -08:00
|
|
|
|
|
|
|
bool
|
2013-07-08 08:48:39 -07:00
|
|
|
DeallocPTestShellCommandParent(PTestShellCommandParent* aActor);
|
2009-12-03 00:16:14 -08:00
|
|
|
|
|
|
|
bool
|
|
|
|
CommandDone(TestShellCommandParent* aActor, const nsString& aResponse);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-09-09 15:59:06 -07:00
|
|
|
class TestShellCommandParent : public PTestShellCommandParent
|
2009-08-25 16:07:22 -07:00
|
|
|
{
|
|
|
|
public:
|
2013-08-23 12:51:44 -07:00
|
|
|
TestShellCommandParent() : mCx(nullptr) { }
|
2009-08-25 16:07:22 -07:00
|
|
|
|
2013-08-08 15:53:04 -07:00
|
|
|
bool SetCallback(JSContext* aCx, JS::Value aCallback);
|
2009-08-25 16:07:22 -07:00
|
|
|
|
2013-08-08 15:53:04 -07:00
|
|
|
bool RunCallback(const nsString& aResponse);
|
2009-08-25 16:07:22 -07:00
|
|
|
|
|
|
|
void ReleaseCallback();
|
|
|
|
|
2009-12-03 00:16:14 -08:00
|
|
|
protected:
|
2011-06-23 16:31:58 -07:00
|
|
|
bool ExecuteCallback(const nsString& aResponse);
|
|
|
|
|
|
|
|
void ActorDestroy(ActorDestroyReason why);
|
2013-07-08 08:48:39 -07:00
|
|
|
|
2009-12-03 00:16:14 -08:00
|
|
|
bool Recv__delete__(const nsString& aResponse) {
|
2011-06-23 16:31:58 -07:00
|
|
|
return ExecuteCallback(aResponse);
|
2009-12-03 00:16:14 -08:00
|
|
|
}
|
|
|
|
|
2009-08-25 16:07:22 -07:00
|
|
|
private:
|
|
|
|
JSContext* mCx;
|
|
|
|
nsAutoJSValHolder mCallback;
|
|
|
|
};
|
|
|
|
|
2009-07-10 23:33:10 -07:00
|
|
|
|
|
|
|
} /* namespace ipc */
|
|
|
|
} /* namespace mozilla */
|
|
|
|
|
2009-09-09 15:00:14 -07:00
|
|
|
#endif /* ipc_testshell_TestShellParent_h */
|