2017-10-27 01:08:41 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2015-06-17 13:44:27 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_MessagePortParent_h
|
|
|
|
#define mozilla_dom_MessagePortParent_h
|
|
|
|
|
|
|
|
#include "mozilla/dom/PMessagePortParent.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class MessagePortService;
|
|
|
|
|
|
|
|
class MessagePortParent final : public PMessagePortParent {
|
2019-02-06 18:57:37 +03:00
|
|
|
friend class PMessagePortParent;
|
|
|
|
|
2015-06-17 13:44:27 +03:00
|
|
|
public:
|
|
|
|
explicit MessagePortParent(const nsID& aUUID);
|
|
|
|
~MessagePortParent();
|
|
|
|
|
|
|
|
bool Entangle(const nsID& aDestinationUUID, const uint32_t& aSequenceID);
|
|
|
|
|
2016-11-08 12:50:51 +03:00
|
|
|
bool Entangled(const nsTArray<ClonedMessageData>& aMessages);
|
2015-06-17 13:44:27 +03:00
|
|
|
|
|
|
|
void Close();
|
|
|
|
void CloseAndDelete();
|
|
|
|
|
|
|
|
bool CanSendData() const { return mCanSendData; }
|
|
|
|
|
|
|
|
const nsID& ID() const { return mUUID; }
|
|
|
|
|
2015-06-24 01:50:00 +03:00
|
|
|
static bool ForceClose(const nsID& aUUID, const nsID& aDestinationUUID,
|
|
|
|
const uint32_t& aSequenceID);
|
|
|
|
|
2015-06-17 13:44:27 +03:00
|
|
|
private:
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvPostMessages(
|
|
|
|
nsTArray<ClonedMessageData>&& aMessages);
|
2015-06-17 13:44:27 +03:00
|
|
|
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvDisentangle(
|
|
|
|
nsTArray<ClonedMessageData>&& aMessages);
|
2015-06-17 13:44:27 +03:00
|
|
|
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvStopSendingData();
|
2015-06-17 13:44:27 +03:00
|
|
|
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvClose();
|
2015-06-17 13:44:27 +03:00
|
|
|
|
|
|
|
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<MessagePortService> mService;
|
2015-06-17 13:44:27 +03:00
|
|
|
const nsID mUUID;
|
|
|
|
bool mEntangled;
|
|
|
|
bool mCanSendData;
|
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2015-06-17 13:44:27 +03:00
|
|
|
|
|
|
|
#endif // mozilla_dom_MessagePortParent_h
|