Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/nsIWeakReference.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM /src/mozilla-central/xpcom/base/nsIWeakReference.idl
3
 */
4
5
#ifndef __gen_nsIWeakReference_h__
6
#define __gen_nsIWeakReference_h__
7
8
9
#ifndef __gen_nsISupports_h__
10
#include "nsISupports.h"
11
#endif
12
13
#include "js/GCAnnotations.h"
14
15
/* For IDL files that don't want to include root IDL files. */
16
#ifndef NS_NO_VTABLE
17
#define NS_NO_VTABLE
18
#endif
19
#include "mozilla/Attributes.h"
20
#include "mozilla/MemoryReporting.h"
21
// For MOZ_THREAD_SAFETY_OWNERSHIP_CHECKS_SUPPORTED.
22
#include "nsDebug.h"
23
#ifdef MOZ_THREAD_SAFETY_OWNERSHIP_CHECKS_SUPPORTED
24
#define MOZ_WEAKREF_DECL_OWNINGTHREAD nsAutoOwningThread _mWeakRefOwningThread;
25
#define MOZ_WEAKREF_ASSERT_OWNINGTHREAD \
26
  _mWeakRefOwningThread.AssertOwnership("nsWeakReference not thread-safe")
27
#define MOZ_WEAKREF_ASSERT_OWNINGTHREAD_DELEGATED(that) \
28
  (that)->_mWeakRefOwningThread.AssertOwnership("nsWeakReference not thread-safe")
29
#else
30
#define MOZ_WEAKREF_DECL_OWNINGTHREAD
31
1.12M
#define MOZ_WEAKREF_ASSERT_OWNINGTHREAD do { } while (false)
32
136
#define MOZ_WEAKREF_ASSERT_OWNINGTHREAD_DELEGATED(that) do { } while (false)
33
#endif
34
35
/* starting interface:    nsIWeakReference */
36
#define NS_IWEAKREFERENCE_IID_STR "9188bc85-f92e-11d2-81ef-0060083a0bcf"
37
38
#define NS_IWEAKREFERENCE_IID \
39
  {0x9188bc85, 0xf92e, 0x11d2, \
40
    { 0x81, 0xef, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf }}
41
42
class nsIWeakReference : public nsISupports {
43
 public:
44
45
  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWEAKREFERENCE_IID)
46
47
  /* [binaryname(QueryReferentFromScript)] void QueryReferent (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
48
  JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD QueryReferentFromScript(const nsIID & uuid, void * * result) = 0;
49
50
   virtual size_t SizeOfOnlyThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
51
  /**
52
   * Returns true if the referring object is alive.  Otherwise, false.
53
   */
54
  bool IsAlive() const
55
0
  {
56
0
    return !!mObject;
57
0
  }
58
  nsresult QueryReferent(const nsIID& aIID, void** aInstancePtr);
59
protected:
60
  friend class nsSupportsWeakReference;
61
  nsIWeakReference(nsISupports* aObject)
62
    : mObject(aObject)
63
69
  {
64
69
  }
65
  nsIWeakReference() = delete;
66
  MOZ_WEAKREF_DECL_OWNINGTHREAD
67
  // The object we're holding a weak reference to.
68
  nsISupports* MOZ_NON_OWNING_REF mObject;
69
};
70
71
  NS_DEFINE_STATIC_IID_ACCESSOR(nsIWeakReference, NS_IWEAKREFERENCE_IID)
72
73
/* Use this macro when declaring classes that implement this interface. */
74
#define NS_DECL_NSIWEAKREFERENCE \
75
  NS_IMETHOD QueryReferentFromScript(const nsIID & uuid, void * * result) override; \
76
77
/* Use this macro when declaring the members of this interface when the
78
   class doesn't implement the interface. This is useful for forwarding. */
79
#define NS_DECL_NON_VIRTUAL_NSIWEAKREFERENCE \
80
  nsresult QueryReferentFromScript(const nsIID & uuid, void * * result); \
81
82
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
83
#define NS_FORWARD_NSIWEAKREFERENCE(_to) \
84
  NS_IMETHOD QueryReferentFromScript(const nsIID & uuid, void * * result) override { return _to QueryReferentFromScript(uuid, result); } \
85
86
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
87
#define NS_FORWARD_SAFE_NSIWEAKREFERENCE(_to) \
88
  NS_IMETHOD QueryReferentFromScript(const nsIID & uuid, void * * result) override { return !_to ? NS_ERROR_NULL_POINTER : _to->QueryReferentFromScript(uuid, result); } \
89
90
91
/* starting interface:    nsISupportsWeakReference */
92
#define NS_ISUPPORTSWEAKREFERENCE_IID_STR "9188bc86-f92e-11d2-81ef-0060083a0bcf"
93
94
#define NS_ISUPPORTSWEAKREFERENCE_IID \
95
  {0x9188bc86, 0xf92e, 0x11d2, \
96
    { 0x81, 0xef, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf }}
97
98
class NS_NO_VTABLE nsISupportsWeakReference : public nsISupports {
99
 public:
100
101
  NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISUPPORTSWEAKREFERENCE_IID)
102
103
  /* nsIWeakReference GetWeakReference (); */
104
  JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) = 0;
105
106
};
107
108
  NS_DEFINE_STATIC_IID_ACCESSOR(nsISupportsWeakReference, NS_ISUPPORTSWEAKREFERENCE_IID)
109
110
/* Use this macro when declaring classes that implement this interface. */
111
#define NS_DECL_NSISUPPORTSWEAKREFERENCE \
112
  NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) override; 
113
114
/* Use this macro when declaring the members of this interface when the
115
   class doesn't implement the interface. This is useful for forwarding. */
116
#define NS_DECL_NON_VIRTUAL_NSISUPPORTSWEAKREFERENCE \
117
  nsresult GetWeakReference(nsIWeakReference **_retval); 
118
119
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
120
#define NS_FORWARD_NSISUPPORTSWEAKREFERENCE(_to) \
121
  NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) override { return _to GetWeakReference(_retval); } 
122
123
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
124
#define NS_FORWARD_SAFE_NSISUPPORTSWEAKREFERENCE(_to) \
125
  NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWeakReference(_retval); } 
126
127
#ifdef MOZILLA_INTERNAL_API
128
#include "nsIWeakReferenceUtils.h"
129
#endif
130
131
#endif /* __gen_nsIWeakReference_h__ */