Line data Source code
1 : /*
2 : * DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/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 559 : nsresult Dispatch(nsIRunnable* aEvent, uint32_t aFlags) {
37 559 : return Dispatch(nsCOMPtr<nsIRunnable>(aEvent).forget(), aFlags);
38 : }
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 237 : 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 : #if 0
106 : /* Use the code below as a template for the implementation class for this interface. */
107 :
108 : /* Header file */
109 : class nsEventTarget : public nsIEventTarget
110 : {
111 : public:
112 : NS_DECL_ISUPPORTS
113 : NS_DECL_NSIEVENTTARGET
114 :
115 : nsEventTarget();
116 :
117 : private:
118 : ~nsEventTarget();
119 :
120 : protected:
121 : /* additional members */
122 : };
123 :
124 : /* Implementation file */
125 : NS_IMPL_ISUPPORTS(nsEventTarget, nsIEventTarget)
126 :
127 : nsEventTarget::nsEventTarget()
128 : {
129 : /* member initializers and constructor code */
130 : }
131 :
132 : nsEventTarget::~nsEventTarget()
133 : {
134 : /* destructor code */
135 : }
136 :
137 : /* [noscript,notxpcom] boolean isOnCurrentThreadInfallible (); */
138 : NS_IMETHODIMP_(bool) nsEventTarget::IsOnCurrentThreadInfallible()
139 : {
140 : return NS_ERROR_NOT_IMPLEMENTED;
141 : }
142 :
143 : /* boolean isOnCurrentThread (); */
144 : NS_IMETHODIMP nsEventTarget::IsOnCurrentThread(bool *_retval)
145 : {
146 : return NS_ERROR_NOT_IMPLEMENTED;
147 : }
148 :
149 : /* [binaryname(Dispatch),noscript] void dispatchFromC (in alreadyAddRefed_nsIRunnable event, [default (DISPATCH_NORMAL)] in unsigned long flags); */
150 : NS_IMETHODIMP nsEventTarget::Dispatch(already_AddRefed<nsIRunnable> event, uint32_t flags = DISPATCH_NORMAL)
151 : {
152 : return NS_ERROR_NOT_IMPLEMENTED;
153 : }
154 :
155 : /* [binaryname(DispatchFromScript)] void dispatch (in nsIRunnable event, in unsigned long flags); */
156 : NS_IMETHODIMP nsEventTarget::DispatchFromScript(nsIRunnable *event, uint32_t flags)
157 : {
158 : return NS_ERROR_NOT_IMPLEMENTED;
159 : }
160 :
161 : /* [noscript] void delayedDispatch (in alreadyAddRefed_nsIRunnable event, in unsigned long delay); */
162 : NS_IMETHODIMP nsEventTarget::DelayedDispatch(already_AddRefed<nsIRunnable> event, uint32_t delay)
163 : {
164 : return NS_ERROR_NOT_IMPLEMENTED;
165 : }
166 :
167 : /* End of implementation class template. */
168 : #endif
169 :
170 : // convenient aliases:
171 : #define NS_DISPATCH_NORMAL nsIEventTarget::DISPATCH_NORMAL
172 : #define NS_DISPATCH_SYNC nsIEventTarget::DISPATCH_SYNC
173 : #define NS_DISPATCH_AT_END nsIEventTarget::DISPATCH_AT_END
174 : // Convenient NS_DECL variant that includes some C++-only methods.
175 : #define NS_DECL_NSIEVENTTARGET_FULL \
176 : NS_DECL_NSIEVENTTARGET \
177 : /* Avoid hiding these methods */ \
178 : using nsIEventTarget::Dispatch; \
179 : using nsIEventTarget::IsOnCurrentThread;
180 :
181 : #endif /* __gen_nsIEventTarget_h__ */
|