Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/net/StunAddrsRequestChild.h
Line
Count
Source (jump to first uncovered line)
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3
 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
#ifndef mozilla_net_StunAddrsRequestChild_h
6
#define mozilla_net_StunAddrsRequestChild_h
7
8
#include "mozilla/net/PStunAddrsRequestChild.h"
9
10
class nsIEventTarget;
11
12
namespace mozilla {
13
namespace net {
14
15
class StunAddrsListener {
16
public:
17
  virtual void OnStunAddrsAvailable(const NrIceStunAddrArray& addrs) = 0;
18
19
  NS_IMETHOD_(MozExternalRefCountType) AddRef();
20
  NS_IMETHOD_(MozExternalRefCountType) Release();
21
22
protected:
23
0
  virtual ~StunAddrsListener() {}
24
25
  ThreadSafeAutoRefCnt mRefCnt;
26
  NS_DECL_OWNINGTHREAD
27
};
28
29
class StunAddrsRequestChild final : public PStunAddrsRequestChild
30
{
31
public:
32
  explicit StunAddrsRequestChild(StunAddrsListener* listener,
33
                                 nsIEventTarget* mainThreadEventTarget);
34
35
  NS_IMETHOD_(MozExternalRefCountType) AddRef();
36
  NS_IMETHOD_(MozExternalRefCountType) Release();
37
38
  // Not sure why AddIPDLReference & ReleaseIPDLReference don't come
39
  // from PStunAddrsRequestChild since the IPC plumbing seem to
40
  // expect this.
41
  void AddIPDLReference() { AddRef(); }
42
0
  void ReleaseIPDLReference() { Release(); }
43
44
  void Cancel();
45
46
protected:
47
  virtual ~StunAddrsRequestChild() {}
48
49
  virtual mozilla::ipc::IPCResult RecvOnStunAddrsAvailable(
50
      const NrIceStunAddrArray& addrs) override;
51
52
  RefPtr<StunAddrsListener> mListener;
53
54
  ThreadSafeAutoRefCnt mRefCnt;
55
  NS_DECL_OWNINGTHREAD
56
};
57
58
} // namespace net
59
} // namespace mozilla
60
61
#endif // mozilla_net_StunAddrsRequestChild_h