Bug 1858509 add thread-safety annotations around MediaSourceDemuxer::mMonitor r=alwu
[gecko.git] / ipc / testshell / TestShellChild.cpp
blob6af5630d2da023e49ae6eb023ba0b84f95aa3487
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "TestShellChild.h"
7 using mozilla::ipc::PTestShellCommandChild;
8 using mozilla::ipc::TestShellChild;
9 using mozilla::ipc::XPCShellEnvironment;
11 TestShellChild::TestShellChild()
12 : mXPCShell(XPCShellEnvironment::CreateEnvironment()) {}
14 mozilla::ipc::IPCResult TestShellChild::RecvExecuteCommand(
15 const nsAString& aCommand) {
16 if (mXPCShell->IsQuitting()) {
17 NS_WARNING("Commands sent after quit command issued!");
18 return IPC_FAIL_NO_REASON(this);
21 if (!mXPCShell->EvaluateString(aCommand)) {
22 return IPC_FAIL_NO_REASON(this);
24 return IPC_OK();
27 PTestShellCommandChild* TestShellChild::AllocPTestShellCommandChild(
28 const nsAString& aCommand) {
29 return new PTestShellCommandChild();
32 bool TestShellChild::DeallocPTestShellCommandChild(
33 PTestShellCommandChild* aCommand) {
34 delete aCommand;
35 return true;
38 mozilla::ipc::IPCResult TestShellChild::RecvPTestShellCommandConstructor(
39 PTestShellCommandChild* aActor, const nsAString& aCommand) {
40 if (mXPCShell->IsQuitting()) {
41 NS_WARNING("Commands sent after quit command issued!");
42 return IPC_FAIL_NO_REASON(this);
45 nsString response;
46 if (!mXPCShell->EvaluateString(aCommand, &response)) {
47 return IPC_FAIL_NO_REASON(this);
50 if (!PTestShellCommandChild::Send__delete__(aActor, response)) {
51 return IPC_FAIL_NO_REASON(this);
53 return IPC_OK();