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