Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/nsIEventTarget.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM /src/mozilla-central/xpcom/threads/nsIEventTarget.idl
3
 */
4
5
#ifndef __gen_nsIEventTarget_h__
6
#define __gen_nsIEventTarget_h__
7
8
9
#ifndef __gen_nsISupports_h__
10
#include "nsISupports.h"
11
#endif
12
13
#ifndef __gen_nsIRunnable_h__
14
#include "nsIRunnable.h"
15
#endif
16
17
/* For IDL files that don't want to include root IDL files. */
18
#ifndef NS_NO_VTABLE
19
#define NS_NO_VTABLE
20
#endif
21
#include "nsCOMPtr.h"
22
#include "mozilla/AlreadyAddRefed.h"
23
24
/* starting interface:    nsIEventTarget */
25
#define NS_IEVENTTARGET_IID_STR "a03b8b63-af8b-4164-b0e5-c41e8b2b7cfa"
26
27
#define NS_IEVENTTARGET_IID \
28
  {0xa03b8b63, 0xaf8b, 0x4164, \
29
    { 0xb0, 0xe5, 0xc4, 0x1e, 0x8b, 0x2b, 0x7c, 0xfa }}
30
31
class nsIEventTarget : public nsISupports {
32
 public:
33
34
  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEVENTTARGET_IID)
35
36
97
     nsresult Dispatch(nsIRunnable* aEvent, uint32_t aFlags) {
37
97
      return Dispatch(nsCOMPtr<nsIRunnable>(aEvent).forget(), aFlags);
38
97
    }
39
  enum {
40
    DISPATCH_NORMAL = 0U,
41
    DISPATCH_SYNC = 1U,
42
    DISPATCH_AT_END = 2U
43
  };
44
45
 public:
46
  // Infallible. Defined in nsThreadUtils.cpp. Delegates to
47
  // IsOnCurrentThreadInfallible when mVirtualThread is null.
48
  bool IsOnCurrentThread();
49
protected:
50
  PRThread* mVirtualThread;
51
152
  nsIEventTarget() : mVirtualThread(nullptr) {}
52
    /* [noscript,notxpcom] boolean isOnCurrentThreadInfallible (); */
53
  NS_IMETHOD_(bool) IsOnCurrentThreadInfallible(void) = 0;
54
55
 public:
56
    /* boolean isOnCurrentThread (); */
57
  NS_IMETHOD IsOnCurrentThread(bool *_retval) = 0;
58
59
  /* [binaryname(Dispatch),noscript] void dispatchFromC (in alreadyAddRefed_nsIRunnable event, [default (DISPATCH_NORMAL)] in unsigned long flags); */
60
  NS_IMETHOD Dispatch(already_AddRefed<nsIRunnable> event, uint32_t flags = DISPATCH_NORMAL) = 0;
61
62
  /* [binaryname(DispatchFromScript)] void dispatch (in nsIRunnable event, in unsigned long flags); */
63
  NS_IMETHOD DispatchFromScript(nsIRunnable *event, uint32_t flags) = 0;
64
65
  /* [noscript] void delayedDispatch (in alreadyAddRefed_nsIRunnable event, in unsigned long delay); */
66
  NS_IMETHOD DelayedDispatch(already_AddRefed<nsIRunnable> event, uint32_t delay) = 0;
67
68
};
69
70
  NS_DEFINE_STATIC_IID_ACCESSOR(nsIEventTarget, NS_IEVENTTARGET_IID)
71
72
/* Use this macro when declaring classes that implement this interface. */
73
#define NS_DECL_NSIEVENTTARGET \
74
  NS_IMETHOD_(bool) IsOnCurrentThreadInfallible(void) override; \
75
  NS_IMETHOD IsOnCurrentThread(bool *_retval) override; \
76
  NS_IMETHOD Dispatch(already_AddRefed<nsIRunnable> event, uint32_t flags = DISPATCH_NORMAL) override; \
77
  NS_IMETHOD DispatchFromScript(nsIRunnable *event, uint32_t flags) override; \
78
  NS_IMETHOD DelayedDispatch(already_AddRefed<nsIRunnable> event, uint32_t delay) override; 
79
80
/* Use this macro when declaring the members of this interface when the
81
   class doesn't implement the interface. This is useful for forwarding. */
82
#define NS_DECL_NON_VIRTUAL_NSIEVENTTARGET \
83
  nsresult_(bool) IsOnCurrentThreadInfallible(void); \
84
  nsresult IsOnCurrentThread(bool *_retval); \
85
  nsresult Dispatch(already_AddRefed<nsIRunnable> event, uint32_t flags = DISPATCH_NORMAL); \
86
  nsresult DispatchFromScript(nsIRunnable *event, uint32_t flags); \
87
  nsresult DelayedDispatch(already_AddRefed<nsIRunnable> event, uint32_t delay); 
88
89
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
90
#define NS_FORWARD_NSIEVENTTARGET(_to) \
91
  NS_IMETHOD_(bool) IsOnCurrentThreadInfallible(void) override { return _to IsOnCurrentThreadInfallible(); } \
92
  NS_IMETHOD IsOnCurrentThread(bool *_retval) override { return _to IsOnCurrentThread(_retval); } \
93
  NS_IMETHOD Dispatch(already_AddRefed<nsIRunnable> event, uint32_t flags = DISPATCH_NORMAL) override { return _to Dispatch(event, flags); } \
94
  NS_IMETHOD DispatchFromScript(nsIRunnable *event, uint32_t flags) override { return _to DispatchFromScript(event, flags); } \
95
  NS_IMETHOD DelayedDispatch(already_AddRefed<nsIRunnable> event, uint32_t delay) override { return _to DelayedDispatch(event, delay); } 
96
97
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
98
#define NS_FORWARD_SAFE_NSIEVENTTARGET(_to) \
99
  NS_IMETHOD_(bool) IsOnCurrentThreadInfallible(void) override; \
100
  NS_IMETHOD IsOnCurrentThread(bool *_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->IsOnCurrentThread(_retval); } \
101
  NS_IMETHOD Dispatch(already_AddRefed<nsIRunnable> event, uint32_t flags = DISPATCH_NORMAL) override { return !_to ? NS_ERROR_NULL_POINTER : _to->Dispatch(event, flags); } \
102
  NS_IMETHOD DispatchFromScript(nsIRunnable *event, uint32_t flags) override { return !_to ? NS_ERROR_NULL_POINTER : _to->DispatchFromScript(event, flags); } \
103
  NS_IMETHOD DelayedDispatch(already_AddRefed<nsIRunnable> event, uint32_t delay) override { return !_to ? NS_ERROR_NULL_POINTER : _to->DelayedDispatch(event, delay); } 
104
105
// convenient aliases:
106
137
#define NS_DISPATCH_NORMAL nsIEventTarget::DISPATCH_NORMAL
107
0
#define NS_DISPATCH_SYNC   nsIEventTarget::DISPATCH_SYNC
108
0
#define NS_DISPATCH_AT_END nsIEventTarget::DISPATCH_AT_END
109
// Convenient NS_DECL variant that includes some C++-only methods.
110
#define NS_DECL_NSIEVENTTARGET_FULL                                   \
111
    NS_DECL_NSIEVENTTARGET                                            \
112
    /* Avoid hiding these methods */                                  \
113
    using nsIEventTarget::Dispatch;                                   \
114
    using nsIEventTarget::IsOnCurrentThread;
115
116
#endif /* __gen_nsIEventTarget_h__ */