Line data Source code
1 : /*
2 : * DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/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 : /* For IDL files that don't want to include root IDL files. */
14 : #ifndef NS_NO_VTABLE
15 : #define NS_NO_VTABLE
16 : #endif
17 : class nsIObserver; /* forward declaration */
18 :
19 : class nsIEventTarget; /* forward declaration */
20 :
21 : #include "mozilla/MemoryReporting.h"
22 : #include "mozilla/TimeStamp.h"
23 : /**
24 : * The signature of the timer callback function passed to initWithFuncCallback.
25 : * This is the function that will get called when the timer expires if the
26 : * timer is initialized via initWithFuncCallback.
27 : *
28 : * @param aTimer the timer which has expired
29 : * @param aClosure opaque parameter passed to initWithFuncCallback
30 : */
31 : class nsITimer;
32 : typedef void (*nsTimerCallbackFunc) (nsITimer *aTimer, void *aClosure);
33 : /**
34 : * The signature of the timer name callback function passed to
35 : * initWithNameableFuncCallback.
36 : * This is the function that will get called when timer profiling is enabled
37 : * via the "TimerFirings" log module.
38 : *
39 : * @param aTimer the timer which has expired
40 : * @param aAnonymize whether the name should avoid including privacy sensitive info
41 : * @param aClosure opaque parameter passed to initWithFuncCallback
42 : * @param aBuf a buffer in which to put the name
43 : * @param aLen the length of the buffer
44 : */
45 : typedef void (*nsTimerNameCallbackFunc) (nsITimer *aTimer,
46 : bool aAnonymize,
47 : void *aClosure,
48 : char *aBuf, size_t aLen);
49 : class nsITimer; /* forward declaration */
50 :
51 :
52 : /* starting interface: nsITimerCallback */
53 : #define NS_ITIMERCALLBACK_IID_STR "a796816d-7d47-4348-9ab8-c7aeb3216a7d"
54 :
55 : #define NS_ITIMERCALLBACK_IID \
56 : {0xa796816d, 0x7d47, 0x4348, \
57 : { 0x9a, 0xb8, 0xc7, 0xae, 0xb3, 0x21, 0x6a, 0x7d }}
58 :
59 160 : class NS_NO_VTABLE nsITimerCallback : public nsISupports {
60 : public:
61 :
62 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITIMERCALLBACK_IID)
63 :
64 : /* void notify (in nsITimer timer); */
65 : NS_IMETHOD Notify(nsITimer *timer) = 0;
66 :
67 : };
68 :
69 : NS_DEFINE_STATIC_IID_ACCESSOR(nsITimerCallback, NS_ITIMERCALLBACK_IID)
70 :
71 : /* Use this macro when declaring classes that implement this interface. */
72 : #define NS_DECL_NSITIMERCALLBACK \
73 : NS_IMETHOD Notify(nsITimer *timer) override;
74 :
75 : /* Use this macro when declaring the members of this interface when the
76 : class doesn't implement the interface. This is useful for forwarding. */
77 : #define NS_DECL_NON_VIRTUAL_NSITIMERCALLBACK \
78 : nsresult Notify(nsITimer *timer);
79 :
80 : /* Use this macro to declare functions that forward the behavior of this interface to another object. */
81 : #define NS_FORWARD_NSITIMERCALLBACK(_to) \
82 : NS_IMETHOD Notify(nsITimer *timer) override { return _to Notify(timer); }
83 :
84 : /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
85 : #define NS_FORWARD_SAFE_NSITIMERCALLBACK(_to) \
86 : NS_IMETHOD Notify(nsITimer *timer) override { return !_to ? NS_ERROR_NULL_POINTER : _to->Notify(timer); }
87 :
88 : #if 0
89 : /* Use the code below as a template for the implementation class for this interface. */
90 :
91 : /* Header file */
92 : class nsTimerCallback : public nsITimerCallback
93 : {
94 : public:
95 : NS_DECL_ISUPPORTS
96 : NS_DECL_NSITIMERCALLBACK
97 :
98 : nsTimerCallback();
99 :
100 : private:
101 : ~nsTimerCallback();
102 :
103 : protected:
104 : /* additional members */
105 : };
106 :
107 : /* Implementation file */
108 : NS_IMPL_ISUPPORTS(nsTimerCallback, nsITimerCallback)
109 :
110 : nsTimerCallback::nsTimerCallback()
111 : {
112 : /* member initializers and constructor code */
113 : }
114 :
115 : nsTimerCallback::~nsTimerCallback()
116 : {
117 : /* destructor code */
118 : }
119 :
120 : /* void notify (in nsITimer timer); */
121 : NS_IMETHODIMP nsTimerCallback::Notify(nsITimer *timer)
122 : {
123 : return NS_ERROR_NOT_IMPLEMENTED;
124 : }
125 :
126 : /* End of implementation class template. */
127 : #endif
128 :
129 : // Two timer deadlines must differ by less than half the PRIntervalTime domain.
130 : #define DELAY_INTERVAL_LIMIT PR_BIT(8 * sizeof(PRIntervalTime) - 1)
131 :
132 : /* starting interface: nsITimer */
133 : #define NS_ITIMER_IID_STR "3de4b105-363c-482c-a409-baac83a01bfc"
134 :
135 : #define NS_ITIMER_IID \
136 : {0x3de4b105, 0x363c, 0x482c, \
137 : { 0xa4, 0x09, 0xba, 0xac, 0x83, 0xa0, 0x1b, 0xfc }}
138 :
139 218 : class nsITimer : public nsISupports {
140 : public:
141 :
142 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITIMER_IID)
143 :
144 : enum {
145 : TYPE_ONE_SHOT = 0,
146 : TYPE_REPEATING_SLACK = 1,
147 : TYPE_REPEATING_PRECISE = 2,
148 : TYPE_REPEATING_PRECISE_CAN_SKIP = 3,
149 : TYPE_REPEATING_SLACK_LOW_PRIORITY = 4,
150 : TYPE_ONE_SHOT_LOW_PRIORITY = 5
151 : };
152 :
153 : /* void init (in nsIObserver aObserver, in unsigned long aDelay, in unsigned long aType); */
154 : NS_IMETHOD Init(nsIObserver *aObserver, uint32_t aDelay, uint32_t aType) = 0;
155 :
156 : /* void initWithCallback (in nsITimerCallback aCallback, in unsigned long aDelay, in unsigned long aType); */
157 : NS_IMETHOD InitWithCallback(nsITimerCallback *aCallback, uint32_t aDelay, uint32_t aType) = 0;
158 :
159 : /* [noscript] void InitHighResolutionWithCallback (in nsITimerCallback aCallback, [const] in TimeDuration aDelay, in unsigned long aType); */
160 : NS_IMETHOD InitHighResolutionWithCallback(nsITimerCallback *aCallback, const mozilla::TimeDuration & aDelay, uint32_t aType) = 0;
161 :
162 : /* void cancel (); */
163 : NS_IMETHOD Cancel(void) = 0;
164 :
165 : /* [noscript] void initWithNamedFuncCallback (in nsTimerCallbackFunc aCallback, in voidPtr aClosure, in unsigned long aDelay, in unsigned long aType, in string aName); */
166 : NS_IMETHOD InitWithNamedFuncCallback(nsTimerCallbackFunc aCallback, void *aClosure, uint32_t aDelay, uint32_t aType, const char * aName) = 0;
167 :
168 : /* [noscript] void initWithNameableFuncCallback (in nsTimerCallbackFunc aCallback, in voidPtr aClosure, in unsigned long aDelay, in unsigned long aType, in nsTimerNameCallbackFunc aNameCallback); */
169 : NS_IMETHOD InitWithNameableFuncCallback(nsTimerCallbackFunc aCallback, void *aClosure, uint32_t aDelay, uint32_t aType, nsTimerNameCallbackFunc aNameCallback) = 0;
170 :
171 : /* attribute unsigned long delay; */
172 : NS_IMETHOD GetDelay(uint32_t *aDelay) = 0;
173 : NS_IMETHOD SetDelay(uint32_t aDelay) = 0;
174 :
175 : /* attribute unsigned long type; */
176 : NS_IMETHOD GetType(uint32_t *aType) = 0;
177 : NS_IMETHOD SetType(uint32_t aType) = 0;
178 :
179 : /* [noscript] readonly attribute voidPtr closure; */
180 : NS_IMETHOD GetClosure(void **aClosure) = 0;
181 :
182 : /* readonly attribute nsITimerCallback callback; */
183 : NS_IMETHOD GetCallback(nsITimerCallback * *aCallback) = 0;
184 :
185 : /* attribute nsIEventTarget target; */
186 : NS_IMETHOD GetTarget(nsIEventTarget * *aTarget) = 0;
187 : NS_IMETHOD SetTarget(nsIEventTarget *aTarget) = 0;
188 :
189 : /* [noscript] readonly attribute unsigned long allowedEarlyFiringMicroseconds; */
190 : NS_IMETHOD GetAllowedEarlyFiringMicroseconds(uint32_t *aAllowedEarlyFiringMicroseconds) = 0;
191 :
192 : virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
193 : };
194 :
195 : NS_DEFINE_STATIC_IID_ACCESSOR(nsITimer, NS_ITIMER_IID)
196 :
197 : /* Use this macro when declaring classes that implement this interface. */
198 : #define NS_DECL_NSITIMER \
199 : NS_IMETHOD Init(nsIObserver *aObserver, uint32_t aDelay, uint32_t aType) override; \
200 : NS_IMETHOD InitWithCallback(nsITimerCallback *aCallback, uint32_t aDelay, uint32_t aType) override; \
201 : NS_IMETHOD InitHighResolutionWithCallback(nsITimerCallback *aCallback, const mozilla::TimeDuration & aDelay, uint32_t aType) override; \
202 : NS_IMETHOD Cancel(void) override; \
203 : NS_IMETHOD InitWithNamedFuncCallback(nsTimerCallbackFunc aCallback, void *aClosure, uint32_t aDelay, uint32_t aType, const char * aName) override; \
204 : NS_IMETHOD InitWithNameableFuncCallback(nsTimerCallbackFunc aCallback, void *aClosure, uint32_t aDelay, uint32_t aType, nsTimerNameCallbackFunc aNameCallback) override; \
205 : NS_IMETHOD GetDelay(uint32_t *aDelay) override; \
206 : NS_IMETHOD SetDelay(uint32_t aDelay) override; \
207 : NS_IMETHOD GetType(uint32_t *aType) override; \
208 : NS_IMETHOD SetType(uint32_t aType) override; \
209 : NS_IMETHOD GetClosure(void **aClosure) override; \
210 : NS_IMETHOD GetCallback(nsITimerCallback * *aCallback) override; \
211 : NS_IMETHOD GetTarget(nsIEventTarget * *aTarget) override; \
212 : NS_IMETHOD SetTarget(nsIEventTarget *aTarget) override; \
213 : NS_IMETHOD GetAllowedEarlyFiringMicroseconds(uint32_t *aAllowedEarlyFiringMicroseconds) override; \
214 :
215 : /* Use this macro when declaring the members of this interface when the
216 : class doesn't implement the interface. This is useful for forwarding. */
217 : #define NS_DECL_NON_VIRTUAL_NSITIMER \
218 : nsresult Init(nsIObserver *aObserver, uint32_t aDelay, uint32_t aType); \
219 : nsresult InitWithCallback(nsITimerCallback *aCallback, uint32_t aDelay, uint32_t aType); \
220 : nsresult InitHighResolutionWithCallback(nsITimerCallback *aCallback, const mozilla::TimeDuration & aDelay, uint32_t aType); \
221 : nsresult Cancel(void); \
222 : nsresult InitWithNamedFuncCallback(nsTimerCallbackFunc aCallback, void *aClosure, uint32_t aDelay, uint32_t aType, const char * aName); \
223 : nsresult InitWithNameableFuncCallback(nsTimerCallbackFunc aCallback, void *aClosure, uint32_t aDelay, uint32_t aType, nsTimerNameCallbackFunc aNameCallback); \
224 : nsresult GetDelay(uint32_t *aDelay); \
225 : nsresult SetDelay(uint32_t aDelay); \
226 : nsresult GetType(uint32_t *aType); \
227 : nsresult SetType(uint32_t aType); \
228 : nsresult GetClosure(void **aClosure); \
229 : nsresult GetCallback(nsITimerCallback * *aCallback); \
230 : nsresult GetTarget(nsIEventTarget * *aTarget); \
231 : nsresult SetTarget(nsIEventTarget *aTarget); \
232 : nsresult GetAllowedEarlyFiringMicroseconds(uint32_t *aAllowedEarlyFiringMicroseconds); \
233 :
234 : /* Use this macro to declare functions that forward the behavior of this interface to another object. */
235 : #define NS_FORWARD_NSITIMER(_to) \
236 : NS_IMETHOD Init(nsIObserver *aObserver, uint32_t aDelay, uint32_t aType) override { return _to Init(aObserver, aDelay, aType); } \
237 : NS_IMETHOD InitWithCallback(nsITimerCallback *aCallback, uint32_t aDelay, uint32_t aType) override { return _to InitWithCallback(aCallback, aDelay, aType); } \
238 : NS_IMETHOD InitHighResolutionWithCallback(nsITimerCallback *aCallback, const mozilla::TimeDuration & aDelay, uint32_t aType) override { return _to InitHighResolutionWithCallback(aCallback, aDelay, aType); } \
239 : NS_IMETHOD Cancel(void) override { return _to Cancel(); } \
240 : 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); } \
241 : NS_IMETHOD InitWithNameableFuncCallback(nsTimerCallbackFunc aCallback, void *aClosure, uint32_t aDelay, uint32_t aType, nsTimerNameCallbackFunc aNameCallback) override { return _to InitWithNameableFuncCallback(aCallback, aClosure, aDelay, aType, aNameCallback); } \
242 : NS_IMETHOD GetDelay(uint32_t *aDelay) override { return _to GetDelay(aDelay); } \
243 : NS_IMETHOD SetDelay(uint32_t aDelay) override { return _to SetDelay(aDelay); } \
244 : NS_IMETHOD GetType(uint32_t *aType) override { return _to GetType(aType); } \
245 : NS_IMETHOD SetType(uint32_t aType) override { return _to SetType(aType); } \
246 : NS_IMETHOD GetClosure(void **aClosure) override { return _to GetClosure(aClosure); } \
247 : NS_IMETHOD GetCallback(nsITimerCallback * *aCallback) override { return _to GetCallback(aCallback); } \
248 : NS_IMETHOD GetTarget(nsIEventTarget * *aTarget) override { return _to GetTarget(aTarget); } \
249 : NS_IMETHOD SetTarget(nsIEventTarget *aTarget) override { return _to SetTarget(aTarget); } \
250 : NS_IMETHOD GetAllowedEarlyFiringMicroseconds(uint32_t *aAllowedEarlyFiringMicroseconds) override { return _to GetAllowedEarlyFiringMicroseconds(aAllowedEarlyFiringMicroseconds); } \
251 :
252 : /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
253 : #define NS_FORWARD_SAFE_NSITIMER(_to) \
254 : NS_IMETHOD Init(nsIObserver *aObserver, uint32_t aDelay, uint32_t aType) override { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(aObserver, aDelay, aType); } \
255 : NS_IMETHOD InitWithCallback(nsITimerCallback *aCallback, uint32_t aDelay, uint32_t aType) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitWithCallback(aCallback, aDelay, aType); } \
256 : NS_IMETHOD InitHighResolutionWithCallback(nsITimerCallback *aCallback, const mozilla::TimeDuration & aDelay, uint32_t aType) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitHighResolutionWithCallback(aCallback, aDelay, aType); } \
257 : NS_IMETHOD Cancel(void) override { return !_to ? NS_ERROR_NULL_POINTER : _to->Cancel(); } \
258 : 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); } \
259 : 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); } \
260 : NS_IMETHOD GetDelay(uint32_t *aDelay) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDelay(aDelay); } \
261 : NS_IMETHOD SetDelay(uint32_t aDelay) override { return !_to ? NS_ERROR_NULL_POINTER : _to->SetDelay(aDelay); } \
262 : NS_IMETHOD GetType(uint32_t *aType) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetType(aType); } \
263 : NS_IMETHOD SetType(uint32_t aType) override { return !_to ? NS_ERROR_NULL_POINTER : _to->SetType(aType); } \
264 : NS_IMETHOD GetClosure(void **aClosure) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetClosure(aClosure); } \
265 : NS_IMETHOD GetCallback(nsITimerCallback * *aCallback) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCallback(aCallback); } \
266 : NS_IMETHOD GetTarget(nsIEventTarget * *aTarget) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetTarget(aTarget); } \
267 : NS_IMETHOD SetTarget(nsIEventTarget *aTarget) override { return !_to ? NS_ERROR_NULL_POINTER : _to->SetTarget(aTarget); } \
268 : NS_IMETHOD GetAllowedEarlyFiringMicroseconds(uint32_t *aAllowedEarlyFiringMicroseconds) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAllowedEarlyFiringMicroseconds(aAllowedEarlyFiringMicroseconds); } \
269 :
270 : #if 0
271 : /* Use the code below as a template for the implementation class for this interface. */
272 :
273 : /* Header file */
274 : class nsTimer : public nsITimer
275 : {
276 : public:
277 : NS_DECL_ISUPPORTS
278 : NS_DECL_NSITIMER
279 :
280 : nsTimer();
281 :
282 : private:
283 : ~nsTimer();
284 :
285 : protected:
286 : /* additional members */
287 : };
288 :
289 : /* Implementation file */
290 : NS_IMPL_ISUPPORTS(nsTimer, nsITimer)
291 :
292 : nsTimer::nsTimer()
293 : {
294 : /* member initializers and constructor code */
295 : }
296 :
297 : nsTimer::~nsTimer()
298 : {
299 : /* destructor code */
300 : }
301 :
302 : /* void init (in nsIObserver aObserver, in unsigned long aDelay, in unsigned long aType); */
303 : NS_IMETHODIMP nsTimer::Init(nsIObserver *aObserver, uint32_t aDelay, uint32_t aType)
304 : {
305 : return NS_ERROR_NOT_IMPLEMENTED;
306 : }
307 :
308 : /* void initWithCallback (in nsITimerCallback aCallback, in unsigned long aDelay, in unsigned long aType); */
309 : NS_IMETHODIMP nsTimer::InitWithCallback(nsITimerCallback *aCallback, uint32_t aDelay, uint32_t aType)
310 : {
311 : return NS_ERROR_NOT_IMPLEMENTED;
312 : }
313 :
314 : /* [noscript] void InitHighResolutionWithCallback (in nsITimerCallback aCallback, [const] in TimeDuration aDelay, in unsigned long aType); */
315 : NS_IMETHODIMP nsTimer::InitHighResolutionWithCallback(nsITimerCallback *aCallback, const mozilla::TimeDuration & aDelay, uint32_t aType)
316 : {
317 : return NS_ERROR_NOT_IMPLEMENTED;
318 : }
319 :
320 : /* void cancel (); */
321 : NS_IMETHODIMP nsTimer::Cancel()
322 : {
323 : return NS_ERROR_NOT_IMPLEMENTED;
324 : }
325 :
326 : /* [noscript] void initWithNamedFuncCallback (in nsTimerCallbackFunc aCallback, in voidPtr aClosure, in unsigned long aDelay, in unsigned long aType, in string aName); */
327 : NS_IMETHODIMP nsTimer::InitWithNamedFuncCallback(nsTimerCallbackFunc aCallback, void *aClosure, uint32_t aDelay, uint32_t aType, const char * aName)
328 : {
329 : return NS_ERROR_NOT_IMPLEMENTED;
330 : }
331 :
332 : /* [noscript] void initWithNameableFuncCallback (in nsTimerCallbackFunc aCallback, in voidPtr aClosure, in unsigned long aDelay, in unsigned long aType, in nsTimerNameCallbackFunc aNameCallback); */
333 : NS_IMETHODIMP nsTimer::InitWithNameableFuncCallback(nsTimerCallbackFunc aCallback, void *aClosure, uint32_t aDelay, uint32_t aType, nsTimerNameCallbackFunc aNameCallback)
334 : {
335 : return NS_ERROR_NOT_IMPLEMENTED;
336 : }
337 :
338 : /* attribute unsigned long delay; */
339 : NS_IMETHODIMP nsTimer::GetDelay(uint32_t *aDelay)
340 : {
341 : return NS_ERROR_NOT_IMPLEMENTED;
342 : }
343 : NS_IMETHODIMP nsTimer::SetDelay(uint32_t aDelay)
344 : {
345 : return NS_ERROR_NOT_IMPLEMENTED;
346 : }
347 :
348 : /* attribute unsigned long type; */
349 : NS_IMETHODIMP nsTimer::GetType(uint32_t *aType)
350 : {
351 : return NS_ERROR_NOT_IMPLEMENTED;
352 : }
353 : NS_IMETHODIMP nsTimer::SetType(uint32_t aType)
354 : {
355 : return NS_ERROR_NOT_IMPLEMENTED;
356 : }
357 :
358 : /* [noscript] readonly attribute voidPtr closure; */
359 : NS_IMETHODIMP nsTimer::GetClosure(void **aClosure)
360 : {
361 : return NS_ERROR_NOT_IMPLEMENTED;
362 : }
363 :
364 : /* readonly attribute nsITimerCallback callback; */
365 : NS_IMETHODIMP nsTimer::GetCallback(nsITimerCallback * *aCallback)
366 : {
367 : return NS_ERROR_NOT_IMPLEMENTED;
368 : }
369 :
370 : /* attribute nsIEventTarget target; */
371 : NS_IMETHODIMP nsTimer::GetTarget(nsIEventTarget * *aTarget)
372 : {
373 : return NS_ERROR_NOT_IMPLEMENTED;
374 : }
375 : NS_IMETHODIMP nsTimer::SetTarget(nsIEventTarget *aTarget)
376 : {
377 : return NS_ERROR_NOT_IMPLEMENTED;
378 : }
379 :
380 : /* [noscript] readonly attribute unsigned long allowedEarlyFiringMicroseconds; */
381 : NS_IMETHODIMP nsTimer::GetAllowedEarlyFiringMicroseconds(uint32_t *aAllowedEarlyFiringMicroseconds)
382 : {
383 : return NS_ERROR_NOT_IMPLEMENTED;
384 : }
385 :
386 : /* End of implementation class template. */
387 : #endif
388 :
389 : #define NS_TIMER_CONTRACTID "@mozilla.org/timer;1"
390 : #define NS_TIMER_CALLBACK_TOPIC "timer-callback"
391 :
392 : #endif /* __gen_nsITimer_h__ */
|