Bug 1918268 - updated libwebrtc patch stack
[gecko.git] / dom / messagechannel / MessagePortChild.cpp
blob2c5e270e68b180e960627075e9f4f18b56b9abe1
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/. */
7 #include "MessagePortChild.h"
8 #include "MessagePort.h"
9 #include "mozilla/dom/MessageEvent.h"
10 #include "mozilla/ipc/PBackgroundChild.h"
12 namespace mozilla::dom {
14 MessagePortChild::MessagePortChild() : mPort(nullptr) {}
16 mozilla::ipc::IPCResult MessagePortChild::RecvStopSendingDataConfirmed() {
17 MOZ_ASSERT(mPort);
18 mPort->StopSendingDataConfirmed();
19 MOZ_ASSERT(!mPort);
20 return IPC_OK();
23 mozilla::ipc::IPCResult MessagePortChild::RecvEntangled(
24 nsTArray<MessageData>&& aMessages) {
25 if (mPort) {
26 mPort->Entangled(aMessages);
28 return IPC_OK();
31 mozilla::ipc::IPCResult MessagePortChild::RecvReceiveData(
32 nsTArray<MessageData>&& aMessages) {
33 if (mPort) {
34 mPort->MessagesReceived(aMessages);
36 return IPC_OK();
39 void MessagePortChild::ActorDestroy(ActorDestroyReason aWhy) {
40 if (mPort) {
41 mPort->Closed();
42 MOZ_ASSERT(!mPort);
46 } // namespace mozilla::dom