tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

MessagePortParent.h (1768B)


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