Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/messagechannel/MessagePortService.h
Line
Count
Source (jump to first uncovered line)
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_MessagePortService_h
8
#define mozilla_dom_MessagePortService_h
9
10
#include "nsClassHashtable.h"
11
#include "nsHashKeys.h"
12
#include "nsISupportsImpl.h"
13
14
namespace mozilla {
15
namespace dom {
16
17
class MessagePortParent;
18
class SharedMessagePortMessage;
19
20
class MessagePortService final
21
{
22
public:
23
  NS_INLINE_DECL_REFCOUNTING(MessagePortService)
24
25
  static MessagePortService* Get();
26
  static MessagePortService* GetOrCreate();
27
28
  bool RequestEntangling(MessagePortParent* aParent,
29
                         const nsID& aDestinationUUID,
30
                         const uint32_t& aSequenceID);
31
32
  bool DisentanglePort(
33
                 MessagePortParent* aParent,
34
                 FallibleTArray<RefPtr<SharedMessagePortMessage>>& aMessages);
35
36
  bool ClosePort(MessagePortParent* aParent);
37
38
  bool PostMessages(
39
                 MessagePortParent* aParent,
40
                 FallibleTArray<RefPtr<SharedMessagePortMessage>>& aMessages);
41
42
  void ParentDestroy(MessagePortParent* aParent);
43
44
  bool ForceClose(const nsID& aUUID,
45
                  const nsID& aDestinationUUID,
46
                  const uint32_t& aSequenceID);
47
48
private:
49
0
  ~MessagePortService() {}
50
51
  void CloseAll(const nsID& aUUID, bool aForced = false);
52
  void MaybeShutdown();
53
54
  class MessagePortServiceData;
55
56
  nsClassHashtable<nsIDHashKey, MessagePortServiceData> mPorts;
57
};
58
59
} // namespace dom
60
} // namespace mozilla
61
62
#endif // mozilla_dom_MessagePortService_h