/src/mozilla-central/dom/messagechannel/MessagePortParent.h
Line | Count | Source (jump to first uncovered line) |
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 | | { |
19 | | public: |
20 | | explicit MessagePortParent(const nsID& aUUID); |
21 | | ~MessagePortParent(); |
22 | | |
23 | | bool Entangle(const nsID& aDestinationUUID, |
24 | | const uint32_t& aSequenceID); |
25 | | |
26 | | bool Entangled(const nsTArray<ClonedMessageData>& aMessages); |
27 | | |
28 | | void Close(); |
29 | | void CloseAndDelete(); |
30 | | |
31 | | bool CanSendData() const |
32 | 0 | { |
33 | 0 | return mCanSendData; |
34 | 0 | } |
35 | | |
36 | | const nsID& ID() const |
37 | 0 | { |
38 | 0 | return mUUID; |
39 | 0 | } |
40 | | |
41 | | static bool ForceClose(const nsID& aUUID, |
42 | | const nsID& aDestinationUUID, |
43 | | const uint32_t& aSequenceID); |
44 | | |
45 | | private: |
46 | | virtual mozilla::ipc::IPCResult RecvPostMessages(nsTArray<ClonedMessageData>&& aMessages) |
47 | | override; |
48 | | |
49 | | virtual mozilla::ipc::IPCResult RecvDisentangle(nsTArray<ClonedMessageData>&& aMessages) |
50 | | override; |
51 | | |
52 | | virtual mozilla::ipc::IPCResult RecvStopSendingData() override; |
53 | | |
54 | | virtual mozilla::ipc::IPCResult RecvClose() override; |
55 | | |
56 | | virtual void ActorDestroy(ActorDestroyReason aWhy) override; |
57 | | |
58 | | RefPtr<MessagePortService> mService; |
59 | | const nsID mUUID; |
60 | | bool mEntangled; |
61 | | bool mCanSendData; |
62 | | }; |
63 | | |
64 | | } // namespace dom |
65 | | } // namespace mozilla |
66 | | |
67 | | #endif // mozilla_dom_MessagePortParent_h |