Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#include "MessagePortChild.h"
8
#include "MessagePort.h"
9
#include "mozilla/dom/MessageEvent.h"
10
#include "mozilla/ipc/PBackgroundChild.h"
11
12
namespace mozilla {
13
namespace dom {
14
15
MessagePortChild::MessagePortChild() : mPort(nullptr) {}
16
17
mozilla::ipc::IPCResult MessagePortChild::RecvStopSendingDataConfirmed() {
18
MOZ_ASSERT(mPort);
19
mPort->StopSendingDataConfirmed();
20
MOZ_ASSERT(!mPort);
21
return IPC_OK();
22
}
23
24
mozilla::ipc::IPCResult MessagePortChild::RecvEntangled(
25
nsTArray<ClonedMessageData>&& aMessages) {
26
if (mPort) {
27
mPort->Entangled(aMessages);
28
}
29
return IPC_OK();
30
}
31
32
mozilla::ipc::IPCResult MessagePortChild::RecvReceiveData(
33
nsTArray<ClonedMessageData>&& aMessages) {
34
if (mPort) {
35
mPort->MessagesReceived(aMessages);
36
}
37
return IPC_OK();
38
}
39
40
void MessagePortChild::ActorDestroy(ActorDestroyReason aWhy) {
41
if (mPort) {
42
mPort->Closed();
43
MOZ_ASSERT(!mPort);
44
}
45
}
46
47
} // namespace dom
48
} // namespace mozilla