/work/obj-fuzz/dist/include/nsITimer.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * DO NOT EDIT. THIS FILE IS GENERATED FROM /src/mozilla-central/xpcom/threads/nsITimer.idl |
3 | | */ |
4 | | |
5 | | #ifndef __gen_nsITimer_h__ |
6 | | #define __gen_nsITimer_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 | | class nsIObserver; /* forward declaration */ |
20 | | |
21 | | class nsIEventTarget; /* forward declaration */ |
22 | | |
23 | | #include "mozilla/MemoryReporting.h" |
24 | | #include "mozilla/TimeStamp.h" |
25 | | /** |
26 | | * The signature of the timer callback function passed to initWithFuncCallback. |
27 | | * This is the function that will get called when the timer expires if the |
28 | | * timer is initialized via initWithFuncCallback. |
29 | | * |
30 | | * @param aTimer the timer which has expired |
31 | | * @param aClosure opaque parameter passed to initWithFuncCallback |
32 | | */ |
33 | | class nsITimer; |
34 | | typedef void (*nsTimerCallbackFunc) (nsITimer *aTimer, void *aClosure); |
35 | | /** |
36 | | * The signature of the timer name callback function passed to |
37 | | * initWithNameableFuncCallback. |
38 | | * This is the function that will get called when timer profiling is enabled |
39 | | * via the "TimerFirings" log module. |
40 | | * |
41 | | * @param aTimer the timer which has expired |
42 | | * @param aAnonymize whether the name should avoid including privacy sensitive info |
43 | | * @param aClosure opaque parameter passed to initWithFuncCallback |
44 | | * @param aBuf a buffer in which to put the name |
45 | | * @param aLen the length of the buffer |
46 | | */ |
47 | | typedef void (*nsTimerNameCallbackFunc) (nsITimer *aTimer, |
48 | | bool aAnonymize, |
49 | | void *aClosure, |
50 | | char *aBuf, size_t aLen); |
51 | | class nsITimer; /* forward declaration */ |
52 | | |
53 | | |
54 | | /* starting interface: nsITimerCallback */ |
55 | | #define NS_ITIMERCALLBACK_IID_STR "a796816d-7d47-4348-9ab8-c7aeb3216a7d" |
56 | | |
57 | | #define NS_ITIMERCALLBACK_IID \ |
58 | | {0xa796816d, 0x7d47, 0x4348, \ |
59 | | { 0x9a, 0xb8, 0xc7, 0xae, 0xb3, 0x21, 0x6a, 0x7d }} |
60 | | |
61 | | class NS_NO_VTABLE nsITimerCallback : public nsISupports { |
62 | | public: |
63 | | |
64 | | NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITIMERCALLBACK_IID) |
65 | | |
66 | | /* void notify (in nsITimer timer); */ |
67 | | JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD Notify(nsITimer *timer) = 0; |
68 | | |
69 | | }; |
70 | | |
71 | | NS_DEFINE_STATIC_IID_ACCESSOR(nsITimerCallback, NS_ITIMERCALLBACK_IID) |
72 | | |
73 | | /* Use this macro when declaring classes that implement this interface. */ |
74 | | #define NS_DECL_NSITIMERCALLBACK \ |
75 | | NS_IMETHOD Notify(nsITimer *timer) 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_NSITIMERCALLBACK \ |
80 | | nsresult Notify(nsITimer *timer); |
81 | | |
82 | | /* Use this macro to declare functions that forward the behavior of this interface to another object. */ |
83 | | #define NS_FORWARD_NSITIMERCALLBACK(_to) \ |
84 | 0 | NS_IMETHOD Notify(nsITimer *timer) override { return _to Notify(timer); } |
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_NSITIMERCALLBACK(_to) \ |
88 | | NS_IMETHOD Notify(nsITimer *timer) override { return !_to ? NS_ERROR_NULL_POINTER : _to->Notify(timer); } |
89 | | |
90 | | // Two timer deadlines must differ by less than half the PRIntervalTime domain. |
91 | 0 | #define DELAY_INTERVAL_LIMIT PR_BIT(8 * sizeof(PRIntervalTime) - 1) |
92 | | |
93 | | /* starting interface: nsITimer */ |
94 | | #define NS_ITIMER_IID_STR "3de4b105-363c-482c-a409-baac83a01bfc" |
95 | | |
96 | | #define NS_ITIMER_IID \ |
97 | | {0x3de4b105, 0x363c, 0x482c, \ |
98 | | { 0xa4, 0x09, 0xba, 0xac, 0x83, 0xa0, 0x1b, 0xfc }} |
99 | | |
100 | | class nsITimer : public nsISupports { |
101 | | public: |
102 | | |
103 | | NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITIMER_IID) |
104 | | |
105 | | enum { |
106 | | TYPE_ONE_SHOT = 0, |
107 | | TYPE_REPEATING_SLACK = 1, |
108 | | TYPE_REPEATING_PRECISE = 2, |
109 | | TYPE_REPEATING_PRECISE_CAN_SKIP = 3, |
110 | | TYPE_REPEATING_SLACK_LOW_PRIORITY = 4, |
111 | | TYPE_ONE_SHOT_LOW_PRIORITY = 5 |
112 | | }; |
113 | | |
114 | | /* void init (in nsIObserver aObserver, in unsigned long aDelay, in unsigned long aType); */ |
115 | | JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD Init(nsIObserver *aObserver, uint32_t aDelay, uint32_t aType) = 0; |
116 | | |
117 | | /* void initWithCallback (in nsITimerCallback aCallback, in unsigned long aDelay, in unsigned long aType); */ |
118 | | JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD InitWithCallback(nsITimerCallback *aCallback, uint32_t aDelay, uint32_t aType) = 0; |
119 | | |
120 | | /* [noscript] void InitHighResolutionWithCallback (in nsITimerCallback aCallback, [const] in TimeDuration aDelay, in unsigned long aType); */ |
121 | | NS_IMETHOD InitHighResolutionWithCallback(nsITimerCallback *aCallback, const mozilla::TimeDuration & aDelay, uint32_t aType) = 0; |
122 | | |
123 | | /* void cancel (); */ |
124 | | JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD Cancel(void) = 0; |
125 | | |
126 | | /* [noscript] void initWithNamedFuncCallback (in nsTimerCallbackFunc aCallback, in voidPtr aClosure, in unsigned long aDelay, in unsigned long aType, in string aName); */ |
127 | | NS_IMETHOD InitWithNamedFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, uint32_t aDelay, uint32_t aType, const char * aName) = 0; |
128 | | |
129 | | /* [noscript] void initWithNameableFuncCallback (in nsTimerCallbackFunc aCallback, in voidPtr aClosure, in unsigned long aDelay, in unsigned long aType, in nsTimerNameCallbackFunc aNameCallback); */ |
130 | | NS_IMETHOD InitWithNameableFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, uint32_t aDelay, uint32_t aType, nsTimerNameCallbackFunc aNameCallback) = 0; |
131 | | |
132 | | /* attribute unsigned long delay; */ |
133 | | JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD GetDelay(uint32_t *aDelay) = 0; |
134 | | JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD SetDelay(uint32_t aDelay) = 0; |
135 | | |
136 | | /* attribute unsigned long type; */ |
137 | | JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD GetType(uint32_t *aType) = 0; |
138 | | JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD SetType(uint32_t aType) = 0; |
139 | | |
140 | | /* [noscript] readonly attribute voidPtr closure; */ |
141 | | NS_IMETHOD GetClosure(void * * aClosure) = 0; |
142 | | |
143 | | /* readonly attribute nsITimerCallback callback; */ |
144 | | JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD GetCallback(nsITimerCallback **aCallback) = 0; |
145 | | |
146 | | /* attribute nsIEventTarget target; */ |
147 | | JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD GetTarget(nsIEventTarget **aTarget) = 0; |
148 | | JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD SetTarget(nsIEventTarget *aTarget) = 0; |
149 | | |
150 | | /* [noscript] readonly attribute unsigned long allowedEarlyFiringMicroseconds; */ |
151 | | NS_IMETHOD GetAllowedEarlyFiringMicroseconds(uint32_t *aAllowedEarlyFiringMicroseconds) = 0; |
152 | | |
153 | | virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0; |
154 | | }; |
155 | | |
156 | | NS_DEFINE_STATIC_IID_ACCESSOR(nsITimer, NS_ITIMER_IID) |
157 | | |
158 | | /* Use this macro when declaring classes that implement this interface. */ |
159 | | #define NS_DECL_NSITIMER \ |
160 | | NS_IMETHOD Init(nsIObserver *aObserver, uint32_t aDelay, uint32_t aType) override; \ |
161 | | NS_IMETHOD InitWithCallback(nsITimerCallback *aCallback, uint32_t aDelay, uint32_t aType) override; \ |
162 | | NS_IMETHOD InitHighResolutionWithCallback(nsITimerCallback *aCallback, const mozilla::TimeDuration & aDelay, uint32_t aType) override; \ |
163 | | NS_IMETHOD Cancel(void) override; \ |
164 | | NS_IMETHOD InitWithNamedFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, uint32_t aDelay, uint32_t aType, const char * aName) override; \ |
165 | | NS_IMETHOD InitWithNameableFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, uint32_t aDelay, uint32_t aType, nsTimerNameCallbackFunc aNameCallback) override; \ |
166 | | NS_IMETHOD GetDelay(uint32_t *aDelay) override; \ |
167 | | NS_IMETHOD SetDelay(uint32_t aDelay) override; \ |
168 | | NS_IMETHOD GetType(uint32_t *aType) override; \ |
169 | | NS_IMETHOD SetType(uint32_t aType) override; \ |
170 | | NS_IMETHOD GetClosure(void * * aClosure) override; \ |
171 | | NS_IMETHOD GetCallback(nsITimerCallback **aCallback) override; \ |
172 | | NS_IMETHOD GetTarget(nsIEventTarget **aTarget) override; \ |
173 | | NS_IMETHOD SetTarget(nsIEventTarget *aTarget) override; \ |
174 | | NS_IMETHOD GetAllowedEarlyFiringMicroseconds(uint32_t *aAllowedEarlyFiringMicroseconds) override; \ |
175 | | |
176 | | /* Use this macro when declaring the members of this interface when the |
177 | | class doesn't implement the interface. This is useful for forwarding. */ |
178 | | #define NS_DECL_NON_VIRTUAL_NSITIMER \ |
179 | | nsresult Init(nsIObserver *aObserver, uint32_t aDelay, uint32_t aType); \ |
180 | | nsresult InitWithCallback(nsITimerCallback *aCallback, uint32_t aDelay, uint32_t aType); \ |
181 | | nsresult InitHighResolutionWithCallback(nsITimerCallback *aCallback, const mozilla::TimeDuration & aDelay, uint32_t aType); \ |
182 | | nsresult Cancel(void); \ |
183 | | nsresult InitWithNamedFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, uint32_t aDelay, uint32_t aType, const char * aName); \ |
184 | | nsresult InitWithNameableFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, uint32_t aDelay, uint32_t aType, nsTimerNameCallbackFunc aNameCallback); \ |
185 | | nsresult GetDelay(uint32_t *aDelay); \ |
186 | | nsresult SetDelay(uint32_t aDelay); \ |
187 | | nsresult GetType(uint32_t *aType); \ |
188 | | nsresult SetType(uint32_t aType); \ |
189 | | nsresult GetClosure(void * * aClosure); \ |
190 | | nsresult GetCallback(nsITimerCallback **aCallback); \ |
191 | | nsresult GetTarget(nsIEventTarget **aTarget); \ |
192 | | nsresult SetTarget(nsIEventTarget *aTarget); \ |
193 | | nsresult GetAllowedEarlyFiringMicroseconds(uint32_t *aAllowedEarlyFiringMicroseconds); \ |
194 | | |
195 | | /* Use this macro to declare functions that forward the behavior of this interface to another object. */ |
196 | | #define NS_FORWARD_NSITIMER(_to) \ |
197 | | NS_IMETHOD Init(nsIObserver *aObserver, uint32_t aDelay, uint32_t aType) override { return _to Init(aObserver, aDelay, aType); } \ |
198 | | NS_IMETHOD InitWithCallback(nsITimerCallback *aCallback, uint32_t aDelay, uint32_t aType) override { return _to InitWithCallback(aCallback, aDelay, aType); } \ |
199 | | NS_IMETHOD InitHighResolutionWithCallback(nsITimerCallback *aCallback, const mozilla::TimeDuration & aDelay, uint32_t aType) override { return _to InitHighResolutionWithCallback(aCallback, aDelay, aType); } \ |
200 | | NS_IMETHOD Cancel(void) override { return _to Cancel(); } \ |
201 | | NS_IMETHOD InitWithNamedFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, uint32_t aDelay, uint32_t aType, const char * aName) override { return _to InitWithNamedFuncCallback(aCallback, aClosure, aDelay, aType, aName); } \ |
202 | | NS_IMETHOD InitWithNameableFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, uint32_t aDelay, uint32_t aType, nsTimerNameCallbackFunc aNameCallback) override { return _to InitWithNameableFuncCallback(aCallback, aClosure, aDelay, aType, aNameCallback); } \ |
203 | | NS_IMETHOD GetDelay(uint32_t *aDelay) override { return _to GetDelay(aDelay); } \ |
204 | | NS_IMETHOD SetDelay(uint32_t aDelay) override { return _to SetDelay(aDelay); } \ |
205 | | NS_IMETHOD GetType(uint32_t *aType) override { return _to GetType(aType); } \ |
206 | | NS_IMETHOD SetType(uint32_t aType) override { return _to SetType(aType); } \ |
207 | | NS_IMETHOD GetClosure(void * * aClosure) override { return _to GetClosure(aClosure); } \ |
208 | | NS_IMETHOD GetCallback(nsITimerCallback **aCallback) override { return _to GetCallback(aCallback); } \ |
209 | | NS_IMETHOD GetTarget(nsIEventTarget **aTarget) override { return _to GetTarget(aTarget); } \ |
210 | | NS_IMETHOD SetTarget(nsIEventTarget *aTarget) override { return _to SetTarget(aTarget); } \ |
211 | | NS_IMETHOD GetAllowedEarlyFiringMicroseconds(uint32_t *aAllowedEarlyFiringMicroseconds) override { return _to GetAllowedEarlyFiringMicroseconds(aAllowedEarlyFiringMicroseconds); } \ |
212 | | |
213 | | /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ |
214 | | #define NS_FORWARD_SAFE_NSITIMER(_to) \ |
215 | 0 | NS_IMETHOD Init(nsIObserver *aObserver, uint32_t aDelay, uint32_t aType) override { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(aObserver, aDelay, aType); } \ |
216 | 0 | NS_IMETHOD InitWithCallback(nsITimerCallback *aCallback, uint32_t aDelay, uint32_t aType) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitWithCallback(aCallback, aDelay, aType); } \ |
217 | 0 | NS_IMETHOD InitHighResolutionWithCallback(nsITimerCallback *aCallback, const mozilla::TimeDuration & aDelay, uint32_t aType) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitHighResolutionWithCallback(aCallback, aDelay, aType); } \ |
218 | 86 | NS_IMETHOD Cancel(void) override { return !_to ? NS_ERROR_NULL_POINTER : _to->Cancel(); } \ |
219 | 90 | NS_IMETHOD InitWithNamedFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, uint32_t aDelay, uint32_t aType, const char * aName) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitWithNamedFuncCallback(aCallback, aClosure, aDelay, aType, aName); } \ |
220 | 0 | NS_IMETHOD InitWithNameableFuncCallback(nsTimerCallbackFunc aCallback, void * aClosure, uint32_t aDelay, uint32_t aType, nsTimerNameCallbackFunc aNameCallback) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitWithNameableFuncCallback(aCallback, aClosure, aDelay, aType, aNameCallback); } \ |
221 | 0 | NS_IMETHOD GetDelay(uint32_t *aDelay) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDelay(aDelay); } \ |
222 | 0 | NS_IMETHOD SetDelay(uint32_t aDelay) override { return !_to ? NS_ERROR_NULL_POINTER : _to->SetDelay(aDelay); } \ |
223 | 0 | NS_IMETHOD GetType(uint32_t *aType) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetType(aType); } \ |
224 | 0 | NS_IMETHOD SetType(uint32_t aType) override { return !_to ? NS_ERROR_NULL_POINTER : _to->SetType(aType); } \ |
225 | 0 | NS_IMETHOD GetClosure(void * * aClosure) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetClosure(aClosure); } \ |
226 | 0 | NS_IMETHOD GetCallback(nsITimerCallback **aCallback) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCallback(aCallback); } \ |
227 | 0 | NS_IMETHOD GetTarget(nsIEventTarget **aTarget) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetTarget(aTarget); } \ |
228 | 99 | NS_IMETHOD SetTarget(nsIEventTarget *aTarget) override { return !_to ? NS_ERROR_NULL_POINTER : _to->SetTarget(aTarget); } \ |
229 | 0 | NS_IMETHOD GetAllowedEarlyFiringMicroseconds(uint32_t *aAllowedEarlyFiringMicroseconds) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAllowedEarlyFiringMicroseconds(aAllowedEarlyFiringMicroseconds); } \ |
230 | | |
231 | | #include "nsCOMPtr.h" |
232 | | already_AddRefed<nsITimer> NS_NewTimer(); |
233 | | already_AddRefed<nsITimer> NS_NewTimer(nsIEventTarget* aTarget); |
234 | | nsresult |
235 | | NS_NewTimerWithObserver(nsITimer** aTimer, |
236 | | nsIObserver* aObserver, |
237 | | uint32_t aDelay, |
238 | | uint32_t aType, |
239 | | nsIEventTarget* aTarget = nullptr); |
240 | | mozilla::Result<nsCOMPtr<nsITimer>, nsresult> |
241 | | NS_NewTimerWithObserver(nsIObserver* aObserver, |
242 | | uint32_t aDelay, |
243 | | uint32_t aType, |
244 | | nsIEventTarget* aTarget = nullptr); |
245 | | nsresult |
246 | | NS_NewTimerWithCallback(nsITimer** aTimer, |
247 | | nsITimerCallback* aCallback, |
248 | | uint32_t aDelay, |
249 | | uint32_t aType, |
250 | | nsIEventTarget* aTarget = nullptr); |
251 | | mozilla::Result<nsCOMPtr<nsITimer>, nsresult> |
252 | | NS_NewTimerWithCallback(nsITimerCallback* aCallback, |
253 | | uint32_t aDelay, |
254 | | uint32_t aType, |
255 | | nsIEventTarget* aTarget = nullptr); |
256 | | nsresult |
257 | | NS_NewTimerWithCallback(nsITimer** aTimer, |
258 | | nsITimerCallback* aCallback, |
259 | | const mozilla::TimeDuration& aDelay, |
260 | | uint32_t aType, |
261 | | nsIEventTarget* aTarget = nullptr); |
262 | | mozilla::Result<nsCOMPtr<nsITimer>, nsresult> |
263 | | NS_NewTimerWithCallback(nsITimerCallback* aCallback, |
264 | | const mozilla::TimeDuration& aDelay, |
265 | | uint32_t aType, |
266 | | nsIEventTarget* aTarget = nullptr); |
267 | | nsresult |
268 | | NS_NewTimerWithFuncCallback(nsITimer** aTimer, |
269 | | nsTimerCallbackFunc aCallback, |
270 | | void* aClosure, |
271 | | uint32_t aDelay, |
272 | | uint32_t aType, |
273 | | const char* aNameString, |
274 | | nsIEventTarget* aTarget = nullptr); |
275 | | mozilla::Result<nsCOMPtr<nsITimer>, nsresult> |
276 | | NS_NewTimerWithFuncCallback(nsTimerCallbackFunc aCallback, |
277 | | void* aClosure, |
278 | | uint32_t aDelay, |
279 | | uint32_t aType, |
280 | | const char* aNameString, |
281 | | nsIEventTarget* aTarget = nullptr); |
282 | | nsresult |
283 | | NS_NewTimerWithFuncCallback(nsITimer** aTimer, |
284 | | nsTimerCallbackFunc aCallback, |
285 | | void* aClosure, |
286 | | uint32_t aDelay, |
287 | | uint32_t aType, |
288 | | nsTimerNameCallbackFunc aNameCallback, |
289 | | nsIEventTarget* aTarget = nullptr); |
290 | | mozilla::Result<nsCOMPtr<nsITimer>, nsresult> |
291 | | NS_NewTimerWithFuncCallback(nsTimerCallbackFunc aCallback, |
292 | | void* aClosure, |
293 | | uint32_t aDelay, |
294 | | uint32_t aType, |
295 | | nsTimerNameCallbackFunc aNameCallback, |
296 | | nsIEventTarget* aTarget = nullptr); |
297 | 0 | #define NS_TIMER_CONTRACTID "@mozilla.org/timer;1" |
298 | 0 | #define NS_TIMER_CALLBACK_TOPIC "timer-callback" |
299 | | |
300 | | #endif /* __gen_nsITimer_h__ */ |