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