Source code

Revision control

Other Tools

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