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_MessagePortChild_h
6 : #define mozilla_dom_MessagePortChild_h
7 :
8 : #include "mozilla/Assertions.h"
9 : #include "mozilla/dom/PMessagePortChild.h"
10 : #include "nsISupportsImpl.h"
11 :
12 : namespace mozilla {
13 : namespace dom {
14 :
15 : class MessagePort;
16 :
17 : class MessagePortChild final : public PMessagePortChild
18 : {
19 : public:
20 0 : NS_INLINE_DECL_REFCOUNTING(MessagePortChild)
21 :
22 0 : MessagePortChild() : mPort(nullptr) {}
23 :
24 0 : void SetPort(MessagePort* aPort)
25 : {
26 0 : mPort = aPort;
27 0 : }
28 :
29 : private:
30 0 : ~MessagePortChild()
31 0 : {
32 0 : MOZ_ASSERT(!mPort);
33 0 : }
34 :
35 : virtual mozilla::ipc::IPCResult
36 : RecvEntangled(nsTArray<ClonedMessageData>&& aMessages) override;
37 :
38 : virtual mozilla::ipc::IPCResult
39 : RecvReceiveData(nsTArray<ClonedMessageData>&& aMessages) override;
40 :
41 : virtual mozilla::ipc::IPCResult RecvStopSendingDataConfirmed() override;
42 :
43 : virtual void ActorDestroy(ActorDestroyReason aWhy) override;
44 :
45 : // This is a raw pointer because this child is owned by this MessagePort.
46 : MessagePort* mPort;
47 : };
48 :
49 : } // namespace dom
50 : } // namespace mozilla
51 :
52 : #endif // mozilla_dom_MessagePortChild_h
|