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 file,
5
* You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef mozilla_dom_MessagePortParent_h
8
#define mozilla_dom_MessagePortParent_h
9
10
#include "mozilla/dom/PMessagePortParent.h"
11
12
namespace mozilla {
13
namespace dom {
14
15
class MessagePortService;
16
17
class MessagePortParent final : public PMessagePortParent {
18
friend class PMessagePortParent;
19
20
public:
21
explicit MessagePortParent(const nsID& aUUID);
22
~MessagePortParent();
23
24
bool Entangle(const nsID& aDestinationUUID, const uint32_t& aSequenceID);
25
26
bool Entangled(const nsTArray<ClonedMessageData>& aMessages);
27
28
void Close();
29
void CloseAndDelete();
30
31
bool CanSendData() const { return mCanSendData; }
32
33
const nsID& ID() const { return mUUID; }
34
35
static bool ForceClose(const nsID& aUUID, const nsID& aDestinationUUID,
36
const uint32_t& aSequenceID);
37
38
private:
39
mozilla::ipc::IPCResult RecvPostMessages(
40
nsTArray<ClonedMessageData>&& aMessages);
41
42
mozilla::ipc::IPCResult RecvDisentangle(
43
nsTArray<ClonedMessageData>&& aMessages);
44
45
mozilla::ipc::IPCResult RecvStopSendingData();
46
47
mozilla::ipc::IPCResult RecvClose();
48
49
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
50
51
RefPtr<MessagePortService> mService;
52
const nsID mUUID;
53
bool mEntangled;
54
bool mCanSendData;
55
};
56
57
} // namespace dom
58
} // namespace mozilla
59
60
#endif // mozilla_dom_MessagePortParent_h