1
/* ***** BEGIN LICENSE BLOCK *****
2
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
* The contents of this file are subject to the Mozilla Public License Version
5
* 1.1 (the "License"); you may not use this file except in compliance with
6
* the License. You may obtain a copy of the License at
7
* http://www.mozilla.org/MPL/
9
* Software distributed under the License is distributed on an "AS IS" basis,
10
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
* for the specific language governing rights and limitations under the
14
* The Original Code is XPCOM.
16
* The Initial Developer of the Original Code is Netscape Communications Corp.
17
* Portions created by the Initial Developer are Copyright (C) 2001
18
* the Initial Developer. All Rights Reserved.
22
* Alternatively, the contents of this file may be used under the terms of
23
* either the GNU General Public License Version 2 or later (the "GPL"), or
24
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
25
* in which case the provisions of the GPL or the LGPL are applicable instead
26
* of those above. If you wish to allow use of your version of this file only
27
* under the terms of either the GPL or the LGPL, and not to allow others to
28
* use your version of this file under the terms of the MPL, indicate your
29
* decision by deleting the provisions above and replace them with the notice
30
* and other provisions required by the GPL or the LGPL. If you do not delete
31
* the provisions above, a recipient may use your version of this file under
32
* the terms of any one of the MPL, the GPL or the LGPL.
34
* ***** END LICENSE BLOCK ***** */
37
#ifndef nsISupportsImpl_h__
38
#define nsISupportsImpl_h__
44
#ifndef nsISupportsBase_h__
45
#include "nsISupportsBase.h"
48
#include "prthread.h" /* needed for thread-safety checks */
49
#include "pratom.h" /* needed for PR_AtomicIncrement and PR_AtomicDecrement */
52
#include "nsTraceRefcnt.h"
54
////////////////////////////////////////////////////////////////////////////////
55
// Macros to help detect thread-safety:
59
class nsAutoOwningThread {
61
nsAutoOwningThread() { mThread = PR_GetCurrentThread(); }
62
void *GetThread() const { return mThread; }
68
#define NS_DECL_OWNINGTHREAD nsAutoOwningThread _mOwningThread;
69
#define NS_ASSERT_OWNINGTHREAD(_class) \
70
NS_CheckThreadSafe(_mOwningThread.GetThread(), #_class " not thread-safe")
72
#else // !(defined(NS_DEBUG))
74
#define NS_DECL_OWNINGTHREAD /* nothing */
75
#define NS_ASSERT_OWNINGTHREAD(_class) ((void)0)
77
#endif // !(defined(NS_DEBUG))
82
nsAutoRefCnt() : mValue(0) {}
83
nsAutoRefCnt(nsrefcnt aValue) : mValue(aValue) {}
85
// only support prefix increment/decrement
86
nsrefcnt operator++() { return ++mValue; }
87
nsrefcnt operator--() { return --mValue; }
89
nsrefcnt operator=(nsrefcnt aValue) { return (mValue = aValue); }
90
operator nsrefcnt() const { return mValue; }
91
nsrefcnt get() const { return mValue; }
93
// do not define these to enforce the faster prefix notation
94
nsrefcnt operator++(int);
95
nsrefcnt operator--(int);
99
///////////////////////////////////////////////////////////////////////////////
102
* Declare the reference count variable and the implementations of the
103
* AddRef and QueryInterface methods.
106
#define NS_DECL_ISUPPORTS \
108
NS_IMETHOD QueryInterface(REFNSIID aIID, \
109
void** aInstancePtr); \
110
NS_IMETHOD_(nsrefcnt) AddRef(void); \
111
NS_IMETHOD_(nsrefcnt) Release(void); \
113
nsAutoRefCnt mRefCnt; \
114
NS_DECL_OWNINGTHREAD \
118
///////////////////////////////////////////////////////////////////////////////
121
* Previously used to initialize the reference count, but no longer needed.
125
#define NS_INIT_ISUPPORTS() ((void)0)
128
* Use this macro to implement the AddRef method for a given <i>_class</i>
129
* @param _class The name of the class implementing the method
131
#define NS_IMPL_ADDREF(_class) \
132
NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \
134
NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \
135
NS_ASSERT_OWNINGTHREAD(_class); \
137
NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this)); \
142
* Use this macro to implement the AddRef method for a given <i>_class</i>
143
* implemented as a wholly owned aggregated object intended to implement
144
* interface(s) for its owner
145
* @param _class The name of the class implementing the method
146
* @param _aggregator the owning/containing object
148
#define NS_IMPL_ADDREF_USING_AGGREGATOR(_class, _aggregator) \
149
NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \
151
NS_PRECONDITION(_aggregator, "null aggregator"); \
152
return (_aggregator)->AddRef(); \
156
* Use this macro to implement the Release method for a given
158
* @param _class The name of the class implementing the method
159
* @param _destroy A statement that is executed when the object's
160
* refcount drops to zero.
164
* NS_IMPL_RELEASE_WITH_DESTROY(Foo, Destroy(this))
170
* to be invoked when the object's refcount drops to zero. This
171
* allows for arbitrary teardown activity to occur (e.g., deallocation
172
* of object allocated with placement new).
174
#define NS_IMPL_RELEASE_WITH_DESTROY(_class, _destroy) \
175
NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
177
NS_PRECONDITION(0 != mRefCnt, "dup release"); \
178
NS_ASSERT_OWNINGTHREAD(_class); \
180
NS_LOG_RELEASE(this, mRefCnt, #_class); \
181
if (mRefCnt == 0) { \
182
mRefCnt = 1; /* stabilize */ \
190
* Use this macro to implement the Release method for a given <i>_class</i>
191
* @param _class The name of the class implementing the method
193
* A note on the 'stabilization' of the refcnt to one. At that point,
194
* the object's refcount will have gone to zero. The object's
195
* destructor may trigger code that attempts to QueryInterface() and
196
* Release() 'this' again. Doing so will temporarily increment and
197
* decrement the refcount. (Only a logic error would make one try to
198
* keep a permanent hold on 'this'.) To prevent re-entering the
199
* destructor, we make sure that no balanced refcounting can return
200
* the refcount to |0|.
202
#define NS_IMPL_RELEASE(_class) \
203
NS_IMPL_RELEASE_WITH_DESTROY(_class, NS_DELETEXPCOM(this))
206
* Use this macro to implement the Release method for a given <i>_class</i>
207
* implemented as a wholly owned aggregated object intended to implement
208
* interface(s) for its owner
209
* @param _class The name of the class implementing the method
210
* @param _aggregator the owning/containing object
212
#define NS_IMPL_RELEASE_USING_AGGREGATOR(_class, _aggregator) \
213
NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
215
NS_PRECONDITION(_aggregator, "null aggregator"); \
216
return (_aggregator)->Release(); \
221
///////////////////////////////////////////////////////////////////////////////
224
* Some convenience macros for implementing QueryInterface
228
* This implements query interface with two assumptions: First, the
229
* class in question implements nsISupports and its own interface and
230
* nothing else. Second, the implementation of the class's primary
231
* inheritance chain leads to its own interface.
233
* @param _class The name of the class implementing the method
234
* @param _classiiddef The name of the #define symbol that defines the IID
235
* for the class (e.g. NS_ISUPPORTS_IID)
238
#define NS_IMPL_QUERY_HEAD(_class) \
239
NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
241
NS_ASSERTION(aInstancePtr, \
242
"QueryInterface requires a non-NULL destination!"); \
243
nsISupports* foundInterface;
245
#define NS_IMPL_QUERY_BODY(_interface) \
246
if ( aIID.Equals(NS_GET_IID(_interface)) ) \
247
foundInterface = NS_STATIC_CAST(_interface*, this); \
250
#define NS_IMPL_QUERY_BODY_CONDITIONAL(_interface, condition) \
251
if ( (condition) && aIID.Equals(NS_GET_IID(_interface))) \
252
foundInterface = NS_STATIC_CAST(_interface*, this); \
255
#define NS_IMPL_QUERY_BODY_AMBIGUOUS(_interface, _implClass) \
256
if ( aIID.Equals(NS_GET_IID(_interface)) ) \
257
foundInterface = NS_STATIC_CAST(_interface*, \
258
NS_STATIC_CAST(_implClass*, this)); \
261
#define NS_IMPL_QUERY_BODY_AGGREGATED(_interface, _aggregate) \
262
if ( aIID.Equals(NS_GET_IID(_interface)) ) \
263
foundInterface = NS_STATIC_CAST(_interface*, _aggregate); \
266
#define NS_IMPL_QUERY_TAIL_GUTS \
267
foundInterface = 0; \
269
if ( !foundInterface ) \
270
status = NS_NOINTERFACE; \
273
NS_ADDREF(foundInterface); \
276
*aInstancePtr = foundInterface; \
280
#define NS_IMPL_QUERY_TAIL_INHERITING(_baseclass) \
281
foundInterface = 0; \
283
if ( !foundInterface ) \
284
status = _baseclass::QueryInterface(aIID, (void**)&foundInterface); \
287
NS_ADDREF(foundInterface); \
290
*aInstancePtr = foundInterface; \
294
#define NS_IMPL_QUERY_TAIL_USING_AGGREGATOR(_aggregator) \
295
foundInterface = 0; \
297
if ( !foundInterface ) { \
298
NS_ASSERTION(_aggregator, "null aggregator"); \
299
status = _aggregator->QueryInterface(aIID, (void**)&foundInterface); \
302
NS_ADDREF(foundInterface); \
305
*aInstancePtr = foundInterface; \
309
#define NS_IMPL_QUERY_TAIL(_supports_interface) \
310
NS_IMPL_QUERY_BODY_AMBIGUOUS(nsISupports, _supports_interface) \
311
NS_IMPL_QUERY_TAIL_GUTS
315
This is the new scheme. Using this notation now will allow us to switch to
316
a table driven mechanism when it's ready. Note the difference between this
317
and the (currently) underlying NS_IMPL_QUERY_INTERFACE mechanism. You must
318
explicitly mention |nsISupports| when using the interface maps.
320
#define NS_INTERFACE_MAP_BEGIN(_implClass) NS_IMPL_QUERY_HEAD(_implClass)
321
#define NS_INTERFACE_MAP_ENTRY(_interface) NS_IMPL_QUERY_BODY(_interface)
322
#define NS_INTERFACE_MAP_ENTRY_CONDITIONAL(_interface, condition) \
323
NS_IMPL_QUERY_BODY_CONDITIONAL(_interface, condition)
324
#define NS_INTERFACE_MAP_ENTRY_AGGREGATED(_interface,_aggregate) \
325
NS_IMPL_QUERY_BODY_AGGREGATED(_interface,_aggregate)
327
#define NS_INTERFACE_MAP_END NS_IMPL_QUERY_TAIL_GUTS
328
#define NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(_interface, _implClass) \
329
NS_IMPL_QUERY_BODY_AMBIGUOUS(_interface, _implClass)
330
#define NS_INTERFACE_MAP_END_INHERITING(_baseClass) \
331
NS_IMPL_QUERY_TAIL_INHERITING(_baseClass)
332
#define NS_INTERFACE_MAP_END_AGGREGATED(_aggregator) \
333
NS_IMPL_QUERY_TAIL_USING_AGGREGATOR(_aggregator)
335
#define NS_IMPL_QUERY_INTERFACE0(_class) \
336
NS_INTERFACE_MAP_BEGIN(_class) \
337
NS_INTERFACE_MAP_ENTRY(nsISupports) \
340
#define NS_IMPL_QUERY_INTERFACE1(_class, _i1) \
341
NS_INTERFACE_MAP_BEGIN(_class) \
342
NS_INTERFACE_MAP_ENTRY(_i1) \
343
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
346
#define NS_IMPL_QUERY_INTERFACE2(_class, _i1, _i2) \
347
NS_INTERFACE_MAP_BEGIN(_class) \
348
NS_INTERFACE_MAP_ENTRY(_i1) \
349
NS_INTERFACE_MAP_ENTRY(_i2) \
350
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
353
#define NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3) \
354
NS_INTERFACE_MAP_BEGIN(_class) \
355
NS_INTERFACE_MAP_ENTRY(_i1) \
356
NS_INTERFACE_MAP_ENTRY(_i2) \
357
NS_INTERFACE_MAP_ENTRY(_i3) \
358
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
361
#define NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4) \
362
NS_INTERFACE_MAP_BEGIN(_class) \
363
NS_INTERFACE_MAP_ENTRY(_i1) \
364
NS_INTERFACE_MAP_ENTRY(_i2) \
365
NS_INTERFACE_MAP_ENTRY(_i3) \
366
NS_INTERFACE_MAP_ENTRY(_i4) \
367
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
370
#define NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5) \
371
NS_INTERFACE_MAP_BEGIN(_class) \
372
NS_INTERFACE_MAP_ENTRY(_i1) \
373
NS_INTERFACE_MAP_ENTRY(_i2) \
374
NS_INTERFACE_MAP_ENTRY(_i3) \
375
NS_INTERFACE_MAP_ENTRY(_i4) \
376
NS_INTERFACE_MAP_ENTRY(_i5) \
377
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
380
#define NS_IMPL_QUERY_INTERFACE6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
381
NS_INTERFACE_MAP_BEGIN(_class) \
382
NS_INTERFACE_MAP_ENTRY(_i1) \
383
NS_INTERFACE_MAP_ENTRY(_i2) \
384
NS_INTERFACE_MAP_ENTRY(_i3) \
385
NS_INTERFACE_MAP_ENTRY(_i4) \
386
NS_INTERFACE_MAP_ENTRY(_i5) \
387
NS_INTERFACE_MAP_ENTRY(_i6) \
388
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
391
#define NS_IMPL_QUERY_INTERFACE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \
392
NS_INTERFACE_MAP_BEGIN(_class) \
393
NS_INTERFACE_MAP_ENTRY(_i1) \
394
NS_INTERFACE_MAP_ENTRY(_i2) \
395
NS_INTERFACE_MAP_ENTRY(_i3) \
396
NS_INTERFACE_MAP_ENTRY(_i4) \
397
NS_INTERFACE_MAP_ENTRY(_i5) \
398
NS_INTERFACE_MAP_ENTRY(_i6) \
399
NS_INTERFACE_MAP_ENTRY(_i7) \
400
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
403
#define NS_IMPL_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
405
NS_INTERFACE_MAP_BEGIN(_class) \
406
NS_INTERFACE_MAP_ENTRY(_i1) \
407
NS_INTERFACE_MAP_ENTRY(_i2) \
408
NS_INTERFACE_MAP_ENTRY(_i3) \
409
NS_INTERFACE_MAP_ENTRY(_i4) \
410
NS_INTERFACE_MAP_ENTRY(_i5) \
411
NS_INTERFACE_MAP_ENTRY(_i6) \
412
NS_INTERFACE_MAP_ENTRY(_i7) \
413
NS_INTERFACE_MAP_ENTRY(_i8) \
414
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
417
#define NS_IMPL_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
419
NS_INTERFACE_MAP_BEGIN(_class) \
420
NS_INTERFACE_MAP_ENTRY(_i1) \
421
NS_INTERFACE_MAP_ENTRY(_i2) \
422
NS_INTERFACE_MAP_ENTRY(_i3) \
423
NS_INTERFACE_MAP_ENTRY(_i4) \
424
NS_INTERFACE_MAP_ENTRY(_i5) \
425
NS_INTERFACE_MAP_ENTRY(_i6) \
426
NS_INTERFACE_MAP_ENTRY(_i7) \
427
NS_INTERFACE_MAP_ENTRY(_i8) \
428
NS_INTERFACE_MAP_ENTRY(_i9) \
429
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
432
#define NS_IMPL_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
433
_i7, _i8, _i9, _i10) \
434
NS_INTERFACE_MAP_BEGIN(_class) \
435
NS_INTERFACE_MAP_ENTRY(_i1) \
436
NS_INTERFACE_MAP_ENTRY(_i2) \
437
NS_INTERFACE_MAP_ENTRY(_i3) \
438
NS_INTERFACE_MAP_ENTRY(_i4) \
439
NS_INTERFACE_MAP_ENTRY(_i5) \
440
NS_INTERFACE_MAP_ENTRY(_i6) \
441
NS_INTERFACE_MAP_ENTRY(_i7) \
442
NS_INTERFACE_MAP_ENTRY(_i8) \
443
NS_INTERFACE_MAP_ENTRY(_i9) \
444
NS_INTERFACE_MAP_ENTRY(_i10) \
445
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
448
#define NS_IMPL_QUERY_INTERFACE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
449
_i7, _i8, _i9, _i10, _i11) \
450
NS_INTERFACE_MAP_BEGIN(_class) \
451
NS_INTERFACE_MAP_ENTRY(_i1) \
452
NS_INTERFACE_MAP_ENTRY(_i2) \
453
NS_INTERFACE_MAP_ENTRY(_i3) \
454
NS_INTERFACE_MAP_ENTRY(_i4) \
455
NS_INTERFACE_MAP_ENTRY(_i5) \
456
NS_INTERFACE_MAP_ENTRY(_i6) \
457
NS_INTERFACE_MAP_ENTRY(_i7) \
458
NS_INTERFACE_MAP_ENTRY(_i8) \
459
NS_INTERFACE_MAP_ENTRY(_i9) \
460
NS_INTERFACE_MAP_ENTRY(_i10) \
461
NS_INTERFACE_MAP_ENTRY(_i11) \
462
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
466
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE0 NS_IMPL_QUERY_INTERFACE0
467
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE1 NS_IMPL_QUERY_INTERFACE1
468
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE2 NS_IMPL_QUERY_INTERFACE2
469
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE3 NS_IMPL_QUERY_INTERFACE3
470
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE4 NS_IMPL_QUERY_INTERFACE4
471
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE5 NS_IMPL_QUERY_INTERFACE5
472
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE6 NS_IMPL_QUERY_INTERFACE6
473
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE7 NS_IMPL_QUERY_INTERFACE7
474
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE8 NS_IMPL_QUERY_INTERFACE8
475
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE9 NS_IMPL_QUERY_INTERFACE9
476
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE10 NS_IMPL_QUERY_INTERFACE10
477
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE11 NS_IMPL_QUERY_INTERFACE11
480
* Declare that you're going to inherit from something that already
481
* implements nsISupports, but also implements an additional interface, thus
482
* causing an ambiguity. In this case you don't need another mRefCnt, you
483
* just need to forward the definitions to the appropriate superclass. E.g.
485
* class Bar : public Foo, public nsIBar { // both provide nsISupports
487
* NS_DECL_ISUPPORTS_INHERITED
488
* ...other nsIBar and Bar methods...
491
#define NS_DECL_ISUPPORTS_INHERITED \
493
NS_IMETHOD QueryInterface(REFNSIID aIID, \
494
void** aInstancePtr); \
495
NS_IMETHOD_(nsrefcnt) AddRef(void); \
496
NS_IMETHOD_(nsrefcnt) Release(void); \
499
* These macros can be used in conjunction with NS_DECL_ISUPPORTS_INHERITED
500
* to implement the nsISupports methods, forwarding the invocations to a
501
* superclass that already implements nsISupports.
503
* Note that I didn't make these inlined because they're virtual methods.
506
#define NS_IMPL_ADDREF_INHERITED(Class, Super) \
507
NS_IMETHODIMP_(nsrefcnt) Class::AddRef(void) \
509
return Super::AddRef(); \
512
#define NS_IMPL_RELEASE_INHERITED(Class, Super) \
513
NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \
515
return Super::Release(); \
518
#define NS_IMPL_QUERY_INTERFACE_INHERITED0(Class, Super) \
519
NS_IMPL_QUERY_HEAD(Class) \
520
NS_IMPL_QUERY_TAIL_INHERITING(Super) \
522
#define NS_IMPL_QUERY_INTERFACE_INHERITED1(Class, Super, i1) \
523
NS_IMPL_QUERY_HEAD(Class) \
524
NS_IMPL_QUERY_BODY(i1) \
525
NS_IMPL_QUERY_TAIL_INHERITING(Super) \
527
#define NS_IMPL_QUERY_INTERFACE_INHERITED2(Class, Super, i1, i2) \
528
NS_IMPL_QUERY_HEAD(Class) \
529
NS_IMPL_QUERY_BODY(i1) \
530
NS_IMPL_QUERY_BODY(i2) \
531
NS_IMPL_QUERY_TAIL_INHERITING(Super) \
533
#define NS_IMPL_QUERY_INTERFACE_INHERITED3(Class, Super, i1, i2, i3) \
534
NS_IMPL_QUERY_HEAD(Class) \
535
NS_IMPL_QUERY_BODY(i1) \
536
NS_IMPL_QUERY_BODY(i2) \
537
NS_IMPL_QUERY_BODY(i3) \
538
NS_IMPL_QUERY_TAIL_INHERITING(Super) \
540
#define NS_IMPL_QUERY_INTERFACE_INHERITED4(Class, Super, i1, i2, i3, i4) \
541
NS_IMPL_QUERY_HEAD(Class) \
542
NS_IMPL_QUERY_BODY(i1) \
543
NS_IMPL_QUERY_BODY(i2) \
544
NS_IMPL_QUERY_BODY(i3) \
545
NS_IMPL_QUERY_BODY(i4) \
546
NS_IMPL_QUERY_TAIL_INHERITING(Super) \
548
#define NS_IMPL_QUERY_INTERFACE_INHERITED5(Class,Super,i1,i2,i3,i4,i5) \
549
NS_IMPL_QUERY_HEAD(Class) \
550
NS_IMPL_QUERY_BODY(i1) \
551
NS_IMPL_QUERY_BODY(i2) \
552
NS_IMPL_QUERY_BODY(i3) \
553
NS_IMPL_QUERY_BODY(i4) \
554
NS_IMPL_QUERY_BODY(i5) \
555
NS_IMPL_QUERY_TAIL_INHERITING(Super) \
557
#define NS_IMPL_QUERY_INTERFACE_INHERITED6(Class,Super,i1,i2,i3,i4,i5,i6) \
558
NS_IMPL_QUERY_HEAD(Class) \
559
NS_IMPL_QUERY_BODY(i1) \
560
NS_IMPL_QUERY_BODY(i2) \
561
NS_IMPL_QUERY_BODY(i3) \
562
NS_IMPL_QUERY_BODY(i4) \
563
NS_IMPL_QUERY_BODY(i5) \
564
NS_IMPL_QUERY_BODY(i6) \
565
NS_IMPL_QUERY_TAIL_INHERITING(Super) \
568
* Convenience macros for implementing all nsISupports methods for
570
* @param _class The name of the class implementing the method
571
* @param _classiiddef The name of the #define symbol that defines the IID
572
* for the class (e.g. NS_ISUPPORTS_IID)
575
#define NS_IMPL_ISUPPORTS0(_class) \
576
NS_IMPL_ADDREF(_class) \
577
NS_IMPL_RELEASE(_class) \
578
NS_IMPL_QUERY_INTERFACE0(_class)
580
#define NS_IMPL_ISUPPORTS1(_class, _interface) \
581
NS_IMPL_ADDREF(_class) \
582
NS_IMPL_RELEASE(_class) \
583
NS_IMPL_QUERY_INTERFACE1(_class, _interface)
585
#define NS_IMPL_ISUPPORTS2(_class, _i1, _i2) \
586
NS_IMPL_ADDREF(_class) \
587
NS_IMPL_RELEASE(_class) \
588
NS_IMPL_QUERY_INTERFACE2(_class, _i1, _i2)
590
#define NS_IMPL_ISUPPORTS3(_class, _i1, _i2, _i3) \
591
NS_IMPL_ADDREF(_class) \
592
NS_IMPL_RELEASE(_class) \
593
NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3)
595
#define NS_IMPL_ISUPPORTS4(_class, _i1, _i2, _i3, _i4) \
596
NS_IMPL_ADDREF(_class) \
597
NS_IMPL_RELEASE(_class) \
598
NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4)
600
#define NS_IMPL_ISUPPORTS5(_class, _i1, _i2, _i3, _i4, _i5) \
601
NS_IMPL_ADDREF(_class) \
602
NS_IMPL_RELEASE(_class) \
603
NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5)
605
#define NS_IMPL_ISUPPORTS6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
606
NS_IMPL_ADDREF(_class) \
607
NS_IMPL_RELEASE(_class) \
608
NS_IMPL_QUERY_INTERFACE6(_class, _i1, _i2, _i3, _i4, _i5, _i6)
610
#define NS_IMPL_ISUPPORTS7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \
611
NS_IMPL_ADDREF(_class) \
612
NS_IMPL_RELEASE(_class) \
613
NS_IMPL_QUERY_INTERFACE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7)
615
#define NS_IMPL_ISUPPORTS8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \
616
NS_IMPL_ADDREF(_class) \
617
NS_IMPL_RELEASE(_class) \
618
NS_IMPL_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8)
620
#define NS_IMPL_ISUPPORTS9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
622
NS_IMPL_ADDREF(_class) \
623
NS_IMPL_RELEASE(_class) \
624
NS_IMPL_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9)
626
#define NS_IMPL_ISUPPORTS10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
628
NS_IMPL_ADDREF(_class) \
629
NS_IMPL_RELEASE(_class) \
630
NS_IMPL_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
633
#define NS_IMPL_ISUPPORTS11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
635
NS_IMPL_ADDREF(_class) \
636
NS_IMPL_RELEASE(_class) \
637
NS_IMPL_QUERY_INTERFACE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
640
#define NS_IMPL_ISUPPORTS_INHERITED0(Class, Super) \
641
NS_IMPL_QUERY_INTERFACE_INHERITED0(Class, Super) \
642
NS_IMPL_ADDREF_INHERITED(Class, Super) \
643
NS_IMPL_RELEASE_INHERITED(Class, Super) \
645
#define NS_IMPL_ISUPPORTS_INHERITED1(Class, Super, i1) \
646
NS_IMPL_QUERY_INTERFACE_INHERITED1(Class, Super, i1) \
647
NS_IMPL_ADDREF_INHERITED(Class, Super) \
648
NS_IMPL_RELEASE_INHERITED(Class, Super) \
650
#define NS_IMPL_ISUPPORTS_INHERITED2(Class, Super, i1, i2) \
651
NS_IMPL_QUERY_INTERFACE_INHERITED2(Class, Super, i1, i2) \
652
NS_IMPL_ADDREF_INHERITED(Class, Super) \
653
NS_IMPL_RELEASE_INHERITED(Class, Super) \
655
#define NS_IMPL_ISUPPORTS_INHERITED3(Class, Super, i1, i2, i3) \
656
NS_IMPL_QUERY_INTERFACE_INHERITED3(Class, Super, i1, i2, i3) \
657
NS_IMPL_ADDREF_INHERITED(Class, Super) \
658
NS_IMPL_RELEASE_INHERITED(Class, Super) \
660
#define NS_IMPL_ISUPPORTS_INHERITED4(Class, Super, i1, i2, i3, i4) \
661
NS_IMPL_QUERY_INTERFACE_INHERITED4(Class, Super, i1, i2, i3, i4) \
662
NS_IMPL_ADDREF_INHERITED(Class, Super) \
663
NS_IMPL_RELEASE_INHERITED(Class, Super) \
665
#define NS_IMPL_ISUPPORTS_INHERITED5(Class, Super, i1, i2, i3, i4, i5) \
666
NS_IMPL_QUERY_INTERFACE_INHERITED5(Class, Super, i1, i2, i3, i4, i5) \
667
NS_IMPL_ADDREF_INHERITED(Class, Super) \
668
NS_IMPL_RELEASE_INHERITED(Class, Super) \
670
#define NS_IMPL_ISUPPORTS_INHERITED6(Class, Super, i1, i2, i3, i4, i5, i6) \
671
NS_IMPL_QUERY_INTERFACE_INHERITED6(Class, Super, i1, i2, i3, i4, i5, i6) \
672
NS_IMPL_ADDREF_INHERITED(Class, Super) \
673
NS_IMPL_RELEASE_INHERITED(Class, Super) \
675
///////////////////////////////////////////////////////////////////////////////
678
* Threadsafe implementations of the ISupports convenience macros
683
* Use this macro to implement the AddRef method for a given <i>_class</i>
684
* @param _class The name of the class implementing the method
687
#define NS_IMPL_THREADSAFE_ADDREF(_class) \
688
NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \
690
NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \
692
count = PR_AtomicIncrement((PRInt32*)&mRefCnt); \
693
NS_LOG_ADDREF(this, count, #_class, sizeof(*this)); \
698
* Use this macro to implement the Release method for a given <i>_class</i>
699
* @param _class The name of the class implementing the method
702
#define NS_IMPL_THREADSAFE_RELEASE(_class) \
703
NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
706
NS_PRECONDITION(0 != mRefCnt, "dup release"); \
707
count = PR_AtomicDecrement((PRInt32 *)&mRefCnt); \
708
NS_LOG_RELEASE(this, count, #_class); \
710
mRefCnt = 1; /* stabilize */ \
711
/* enable this to find non-threadsafe destructors: */ \
712
/* NS_ASSERT_OWNINGTHREAD(_class); */ \
713
NS_DELETEXPCOM(this); \
719
#define NS_IMPL_THREADSAFE_ISUPPORTS0(_class) \
720
NS_IMPL_THREADSAFE_ADDREF(_class) \
721
NS_IMPL_THREADSAFE_RELEASE(_class) \
722
NS_IMPL_THREADSAFE_QUERY_INTERFACE0(_class)
724
#define NS_IMPL_THREADSAFE_ISUPPORTS1(_class, _interface) \
725
NS_IMPL_THREADSAFE_ADDREF(_class) \
726
NS_IMPL_THREADSAFE_RELEASE(_class) \
727
NS_IMPL_THREADSAFE_QUERY_INTERFACE1(_class, _interface)
729
#define NS_IMPL_THREADSAFE_ISUPPORTS2(_class, _i1, _i2) \
730
NS_IMPL_THREADSAFE_ADDREF(_class) \
731
NS_IMPL_THREADSAFE_RELEASE(_class) \
732
NS_IMPL_THREADSAFE_QUERY_INTERFACE2(_class, _i1, _i2)
734
#define NS_IMPL_THREADSAFE_ISUPPORTS3(_class, _i1, _i2, _i3) \
735
NS_IMPL_THREADSAFE_ADDREF(_class) \
736
NS_IMPL_THREADSAFE_RELEASE(_class) \
737
NS_IMPL_THREADSAFE_QUERY_INTERFACE3(_class, _i1, _i2, _i3)
739
#define NS_IMPL_THREADSAFE_ISUPPORTS4(_class, _i1, _i2, _i3, _i4) \
740
NS_IMPL_THREADSAFE_ADDREF(_class) \
741
NS_IMPL_THREADSAFE_RELEASE(_class) \
742
NS_IMPL_THREADSAFE_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4)
744
#define NS_IMPL_THREADSAFE_ISUPPORTS5(_class, _i1, _i2, _i3, _i4, _i5) \
745
NS_IMPL_THREADSAFE_ADDREF(_class) \
746
NS_IMPL_THREADSAFE_RELEASE(_class) \
747
NS_IMPL_THREADSAFE_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5)
749
#define NS_IMPL_THREADSAFE_ISUPPORTS6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
750
NS_IMPL_THREADSAFE_ADDREF(_class) \
751
NS_IMPL_THREADSAFE_RELEASE(_class) \
752
NS_IMPL_THREADSAFE_QUERY_INTERFACE6(_class, _i1, _i2, _i3, _i4, _i5, _i6)
754
#define NS_IMPL_THREADSAFE_ISUPPORTS7(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
756
NS_IMPL_THREADSAFE_ADDREF(_class) \
757
NS_IMPL_THREADSAFE_RELEASE(_class) \
758
NS_IMPL_THREADSAFE_QUERY_INTERFACE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
761
#define NS_IMPL_THREADSAFE_ISUPPORTS8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
763
NS_IMPL_THREADSAFE_ADDREF(_class) \
764
NS_IMPL_THREADSAFE_RELEASE(_class) \
765
NS_IMPL_THREADSAFE_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
768
#define NS_IMPL_THREADSAFE_ISUPPORTS9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
770
NS_IMPL_THREADSAFE_ADDREF(_class) \
771
NS_IMPL_THREADSAFE_RELEASE(_class) \
772
NS_IMPL_THREADSAFE_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
775
#define NS_IMPL_THREADSAFE_ISUPPORTS10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
776
_i7, _i8, _i9, _i10) \
777
NS_IMPL_THREADSAFE_ADDREF(_class) \
778
NS_IMPL_THREADSAFE_RELEASE(_class) \
779
NS_IMPL_THREADSAFE_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
782
#define NS_IMPL_THREADSAFE_ISUPPORTS11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
783
_i7, _i8, _i9, _i10, _i11) \
784
NS_IMPL_THREADSAFE_ADDREF(_class) \
785
NS_IMPL_THREADSAFE_RELEASE(_class) \
786
NS_IMPL_THREADSAFE_QUERY_INTERFACE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
787
_i7, _i8, _i9, _i10, _i11)
789
///////////////////////////////////////////////////////////////////////////////
790
// Macros for implementing nsIClassInfo-related stuff.
791
///////////////////////////////////////////////////////////////////////////////
793
// include here instead of at the top because it requires the nsISupport decl
794
#include "nsIClassInfo.h"
796
#define NS_CLASSINFO_NAME(_class) _class##_classInfoGlobal
797
#define NS_CI_INTERFACE_GETTER_NAME(_class) _class##_GetInterfacesHelper
799
#define NS_DECL_CI_INTERFACE_GETTER(_class) \
800
extern NS_IMETHODIMP NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *, \
803
#define NS_DECL_CLASSINFO(_class) \
804
NS_DECL_CI_INTERFACE_GETTER(_class) \
805
nsIClassInfo *NS_CLASSINFO_NAME(_class);
807
#define NS_IMPL_QUERY_CLASSINFO(_class) \
808
if ( aIID.Equals(NS_GET_IID(nsIClassInfo)) ) { \
809
extern nsIClassInfo *NS_CLASSINFO_NAME(_class); \
810
foundInterface = NS_STATIC_CAST(nsIClassInfo*, NS_CLASSINFO_NAME(_class));\
813
#define NS_CLASSINFO_HELPER_BEGIN(_class, _c) \
815
NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *count, nsIID ***array) \
818
*array = (nsIID **)nsMemory::Alloc(sizeof (nsIID *) * _c);
820
#define NS_CLASSINFO_HELPER_ENTRY(_i, _interface) \
821
(*array)[_i] = (nsIID *)nsMemory::Clone(&NS_GET_IID(_interface), \
824
#define NS_CLASSINFO_HELPER_END \
828
#define NS_IMPL_CI_INTERFACE_GETTER1(_class, _interface) \
829
NS_CLASSINFO_HELPER_BEGIN(_class, 1) \
830
NS_CLASSINFO_HELPER_ENTRY(0, _interface) \
831
NS_CLASSINFO_HELPER_END
833
#define NS_IMPL_QUERY_INTERFACE1_CI(_class, _i1) \
834
NS_INTERFACE_MAP_BEGIN(_class) \
835
NS_INTERFACE_MAP_ENTRY(_i1) \
836
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
837
NS_IMPL_QUERY_CLASSINFO(_class) \
840
#define NS_IMPL_ISUPPORTS1_CI(_class, _interface) \
841
NS_IMPL_ADDREF(_class) \
842
NS_IMPL_RELEASE(_class) \
843
NS_IMPL_QUERY_INTERFACE1_CI(_class, _interface) \
844
NS_IMPL_CI_INTERFACE_GETTER1(_class, _interface)
846
#define NS_IMPL_CI_INTERFACE_GETTER2(_class, _i1, _i2) \
847
NS_CLASSINFO_HELPER_BEGIN(_class, 2) \
848
NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
849
NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
850
NS_CLASSINFO_HELPER_END
852
#define NS_IMPL_QUERY_INTERFACE2_CI(_class, _i1, _i2) \
853
NS_INTERFACE_MAP_BEGIN(_class) \
854
NS_INTERFACE_MAP_ENTRY(_i1) \
855
NS_INTERFACE_MAP_ENTRY(_i2) \
856
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
857
NS_IMPL_QUERY_CLASSINFO(_class) \
860
#define NS_IMPL_ISUPPORTS2_CI(_class, _i1, _i2) \
861
NS_IMPL_ADDREF(_class) \
862
NS_IMPL_RELEASE(_class) \
863
NS_IMPL_QUERY_INTERFACE2_CI(_class, _i1, _i2) \
864
NS_IMPL_CI_INTERFACE_GETTER2(_class, _i1, _i2)
866
#define NS_IMPL_CI_INTERFACE_GETTER3(_class, _i1, _i2, _i3) \
867
NS_CLASSINFO_HELPER_BEGIN(_class, 3) \
868
NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
869
NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
870
NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
871
NS_CLASSINFO_HELPER_END
873
#define NS_IMPL_QUERY_INTERFACE3_CI(_class, _i1, _i2, _i3) \
874
NS_INTERFACE_MAP_BEGIN(_class) \
875
NS_INTERFACE_MAP_ENTRY(_i1) \
876
NS_INTERFACE_MAP_ENTRY(_i2) \
877
NS_INTERFACE_MAP_ENTRY(_i3) \
878
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
879
NS_IMPL_QUERY_CLASSINFO(_class) \
882
#define NS_IMPL_ISUPPORTS3_CI(_class, _i1, _i2, _i3) \
883
NS_IMPL_ADDREF(_class) \
884
NS_IMPL_RELEASE(_class) \
885
NS_IMPL_QUERY_INTERFACE3_CI(_class, _i1, _i2, _i3) \
886
NS_IMPL_CI_INTERFACE_GETTER3(_class, _i1, _i2, _i3)
888
#define NS_IMPL_CI_INTERFACE_GETTER4(_class, _i1, _i2, _i3, _i4) \
889
NS_CLASSINFO_HELPER_BEGIN(_class, 4) \
890
NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
891
NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
892
NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
893
NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
894
NS_CLASSINFO_HELPER_END
896
#define NS_IMPL_QUERY_INTERFACE4_CI(_class, _i1, _i2, _i3, _i4) \
897
NS_INTERFACE_MAP_BEGIN(_class) \
898
NS_INTERFACE_MAP_ENTRY(_i1) \
899
NS_INTERFACE_MAP_ENTRY(_i2) \
900
NS_INTERFACE_MAP_ENTRY(_i3) \
901
NS_INTERFACE_MAP_ENTRY(_i4) \
902
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
903
NS_IMPL_QUERY_CLASSINFO(_class) \
906
#define NS_IMPL_ISUPPORTS4_CI(_class, _i1, _i2, _i3, _i4) \
907
NS_IMPL_ADDREF(_class) \
908
NS_IMPL_RELEASE(_class) \
909
NS_IMPL_QUERY_INTERFACE4_CI(_class, _i1, _i2, _i3, _i4) \
910
NS_IMPL_CI_INTERFACE_GETTER4(_class, _i1, _i2, _i3, _i4)
912
#define NS_IMPL_CI_INTERFACE_GETTER5(_class, _i1, _i2, _i3, _i4, _i5) \
913
NS_CLASSINFO_HELPER_BEGIN(_class, 5) \
914
NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
915
NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
916
NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
917
NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
918
NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
919
NS_CLASSINFO_HELPER_END
921
#define NS_IMPL_QUERY_INTERFACE5_CI(_class, _i1, _i2, _i3, _i4, _i5) \
922
NS_INTERFACE_MAP_BEGIN(_class) \
923
NS_INTERFACE_MAP_ENTRY(_i1) \
924
NS_INTERFACE_MAP_ENTRY(_i2) \
925
NS_INTERFACE_MAP_ENTRY(_i3) \
926
NS_INTERFACE_MAP_ENTRY(_i4) \
927
NS_INTERFACE_MAP_ENTRY(_i5) \
928
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
929
NS_IMPL_QUERY_CLASSINFO(_class) \
932
#define NS_IMPL_ISUPPORTS5_CI(_class, _i1, _i2, _i3, _i4, _i5) \
933
NS_IMPL_ADDREF(_class) \
934
NS_IMPL_RELEASE(_class) \
935
NS_IMPL_QUERY_INTERFACE5_CI(_class, _i1, _i2, _i3, _i4, _i5) \
936
NS_IMPL_CI_INTERFACE_GETTER5(_class, _i1, _i2, _i3, _i4, _i5)
938
#define NS_IMPL_CI_INTERFACE_GETTER6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
939
NS_CLASSINFO_HELPER_BEGIN(_class, 6) \
940
NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
941
NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
942
NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
943
NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
944
NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
945
NS_CLASSINFO_HELPER_ENTRY(5, _i6) \
946
NS_CLASSINFO_HELPER_END
948
#define NS_IMPL_QUERY_INTERFACE6_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
949
NS_INTERFACE_MAP_BEGIN(_class) \
950
NS_INTERFACE_MAP_ENTRY(_i1) \
951
NS_INTERFACE_MAP_ENTRY(_i2) \
952
NS_INTERFACE_MAP_ENTRY(_i3) \
953
NS_INTERFACE_MAP_ENTRY(_i4) \
954
NS_INTERFACE_MAP_ENTRY(_i5) \
955
NS_INTERFACE_MAP_ENTRY(_i6) \
956
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
957
NS_IMPL_QUERY_CLASSINFO(_class) \
960
#define NS_IMPL_ISUPPORTS6_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
961
NS_IMPL_ADDREF(_class) \
962
NS_IMPL_RELEASE(_class) \
963
NS_IMPL_QUERY_INTERFACE6_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
964
NS_IMPL_CI_INTERFACE_GETTER6(_class, _i1, _i2, _i3, _i4, _i5, _i6)
966
#define NS_IMPL_CI_INTERFACE_GETTER7(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
968
NS_CLASSINFO_HELPER_BEGIN(_class, 7) \
969
NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
970
NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
971
NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
972
NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
973
NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
974
NS_CLASSINFO_HELPER_ENTRY(5, _i6) \
975
NS_CLASSINFO_HELPER_ENTRY(6, _i7) \
976
NS_CLASSINFO_HELPER_END
978
#define NS_IMPL_QUERY_INTERFACE7_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
980
NS_INTERFACE_MAP_BEGIN(_class) \
981
NS_INTERFACE_MAP_ENTRY(_i1) \
982
NS_INTERFACE_MAP_ENTRY(_i2) \
983
NS_INTERFACE_MAP_ENTRY(_i3) \
984
NS_INTERFACE_MAP_ENTRY(_i4) \
985
NS_INTERFACE_MAP_ENTRY(_i5) \
986
NS_INTERFACE_MAP_ENTRY(_i6) \
987
NS_INTERFACE_MAP_ENTRY(_i7) \
988
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
989
NS_IMPL_QUERY_CLASSINFO(_class) \
992
#define NS_IMPL_ISUPPORTS7_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \
993
NS_IMPL_ADDREF(_class) \
994
NS_IMPL_RELEASE(_class) \
995
NS_IMPL_QUERY_INTERFACE7_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \
996
NS_IMPL_CI_INTERFACE_GETTER7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7)
998
#define NS_IMPL_CI_INTERFACE_GETTER8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
1000
NS_CLASSINFO_HELPER_BEGIN(_class, 8) \
1001
NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
1002
NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
1003
NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
1004
NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
1005
NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
1006
NS_CLASSINFO_HELPER_ENTRY(5, _i6) \
1007
NS_CLASSINFO_HELPER_ENTRY(6, _i7) \
1008
NS_CLASSINFO_HELPER_ENTRY(7, _i8) \
1009
NS_CLASSINFO_HELPER_END
1011
#define NS_IMPL_QUERY_INTERFACE8_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
1013
NS_INTERFACE_MAP_BEGIN(_class) \
1014
NS_INTERFACE_MAP_ENTRY(_i1) \
1015
NS_INTERFACE_MAP_ENTRY(_i2) \
1016
NS_INTERFACE_MAP_ENTRY(_i3) \
1017
NS_INTERFACE_MAP_ENTRY(_i4) \
1018
NS_INTERFACE_MAP_ENTRY(_i5) \
1019
NS_INTERFACE_MAP_ENTRY(_i6) \
1020
NS_INTERFACE_MAP_ENTRY(_i7) \
1021
NS_INTERFACE_MAP_ENTRY(_i8) \
1022
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
1023
NS_IMPL_QUERY_CLASSINFO(_class) \
1024
NS_INTERFACE_MAP_END
1026
#define NS_IMPL_ISUPPORTS8_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \
1027
NS_IMPL_ADDREF(_class) \
1028
NS_IMPL_RELEASE(_class) \
1029
NS_IMPL_QUERY_INTERFACE8_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \
1030
NS_IMPL_CI_INTERFACE_GETTER8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8)
1032
#define NS_IMPL_CI_INTERFACE_GETTER9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
1034
NS_CLASSINFO_HELPER_BEGIN(_class, 9) \
1035
NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
1036
NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
1037
NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
1038
NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
1039
NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
1040
NS_CLASSINFO_HELPER_ENTRY(5, _i6) \
1041
NS_CLASSINFO_HELPER_ENTRY(6, _i7) \
1042
NS_CLASSINFO_HELPER_ENTRY(7, _i8) \
1043
NS_CLASSINFO_HELPER_ENTRY(8, _i9) \
1044
NS_CLASSINFO_HELPER_END
1046
#define NS_IMPL_QUERY_INTERFACE9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
1048
NS_INTERFACE_MAP_BEGIN(_class) \
1049
NS_INTERFACE_MAP_ENTRY(_i1) \
1050
NS_INTERFACE_MAP_ENTRY(_i2) \
1051
NS_INTERFACE_MAP_ENTRY(_i3) \
1052
NS_INTERFACE_MAP_ENTRY(_i4) \
1053
NS_INTERFACE_MAP_ENTRY(_i5) \
1054
NS_INTERFACE_MAP_ENTRY(_i6) \
1055
NS_INTERFACE_MAP_ENTRY(_i7) \
1056
NS_INTERFACE_MAP_ENTRY(_i8) \
1057
NS_INTERFACE_MAP_ENTRY(_i9) \
1058
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
1059
NS_IMPL_QUERY_CLASSINFO(_class) \
1060
NS_INTERFACE_MAP_END
1062
#define NS_IMPL_ISUPPORTS9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
1064
NS_IMPL_ADDREF(_class) \
1065
NS_IMPL_RELEASE(_class) \
1066
NS_IMPL_QUERY_INTERFACE9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
1068
NS_IMPL_CI_INTERFACE_GETTER9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
1071
#define NS_IMPL_CI_INTERFACE_GETTER10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
1072
_i7, _i8, _i9, _i10) \
1073
NS_CLASSINFO_HELPER_BEGIN(_class, 10) \
1074
NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
1075
NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
1076
NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
1077
NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
1078
NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
1079
NS_CLASSINFO_HELPER_ENTRY(5, _i6) \
1080
NS_CLASSINFO_HELPER_ENTRY(6, _i7) \
1081
NS_CLASSINFO_HELPER_ENTRY(7, _i8) \
1082
NS_CLASSINFO_HELPER_ENTRY(8, _i9) \
1083
NS_CLASSINFO_HELPER_ENTRY(9, _i10) \
1084
NS_CLASSINFO_HELPER_END
1086
#define NS_IMPL_CI_INTERFACE_GETTER11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
1087
_i7, _i8, _i9, _i10, _i11) \
1088
NS_CLASSINFO_HELPER_BEGIN(_class, 10) \
1089
NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
1090
NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
1091
NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
1092
NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
1093
NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
1094
NS_CLASSINFO_HELPER_ENTRY(5, _i6) \
1095
NS_CLASSINFO_HELPER_ENTRY(6, _i7) \
1096
NS_CLASSINFO_HELPER_ENTRY(7, _i8) \
1097
NS_CLASSINFO_HELPER_ENTRY(8, _i9) \
1098
NS_CLASSINFO_HELPER_ENTRY(9, _i10) \
1099
NS_CLASSINFO_HELPER_ENTRY(10, _i11) \
1100
NS_CLASSINFO_HELPER_END
1102
#define NS_IMPL_QUERY_INTERFACE10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
1103
_i7, _i8, _i9, _i10) \
1104
NS_INTERFACE_MAP_BEGIN(_class) \
1105
NS_INTERFACE_MAP_ENTRY(_i1) \
1106
NS_INTERFACE_MAP_ENTRY(_i2) \
1107
NS_INTERFACE_MAP_ENTRY(_i3) \
1108
NS_INTERFACE_MAP_ENTRY(_i4) \
1109
NS_INTERFACE_MAP_ENTRY(_i5) \
1110
NS_INTERFACE_MAP_ENTRY(_i6) \
1111
NS_INTERFACE_MAP_ENTRY(_i7) \
1112
NS_INTERFACE_MAP_ENTRY(_i8) \
1113
NS_INTERFACE_MAP_ENTRY(_i9) \
1114
NS_INTERFACE_MAP_ENTRY(_i10) \
1115
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
1116
NS_IMPL_QUERY_CLASSINFO(_class) \
1117
NS_INTERFACE_MAP_END
1119
#define NS_IMPL_QUERY_INTERFACE11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
1120
_i7, _i8, _i9, _i10, _i11) \
1121
NS_INTERFACE_MAP_BEGIN(_class) \
1122
NS_INTERFACE_MAP_ENTRY(_i1) \
1123
NS_INTERFACE_MAP_ENTRY(_i2) \
1124
NS_INTERFACE_MAP_ENTRY(_i3) \
1125
NS_INTERFACE_MAP_ENTRY(_i4) \
1126
NS_INTERFACE_MAP_ENTRY(_i5) \
1127
NS_INTERFACE_MAP_ENTRY(_i6) \
1128
NS_INTERFACE_MAP_ENTRY(_i7) \
1129
NS_INTERFACE_MAP_ENTRY(_i8) \
1130
NS_INTERFACE_MAP_ENTRY(_i9) \
1131
NS_INTERFACE_MAP_ENTRY(_i10) \
1132
NS_INTERFACE_MAP_ENTRY(_i11) \
1133
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
1134
NS_IMPL_QUERY_CLASSINFO(_class) \
1135
NS_INTERFACE_MAP_END
1137
#define NS_IMPL_ISUPPORTS10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
1139
NS_IMPL_ADDREF(_class) \
1140
NS_IMPL_RELEASE(_class) \
1141
NS_IMPL_QUERY_INTERFACE10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
1143
NS_IMPL_CI_INTERFACE_GETTER10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
1146
#define NS_IMPL_ISUPPORTS11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
1147
_i8, _i9, _i10, _i11) \
1148
NS_IMPL_ADDREF(_class) \
1149
NS_IMPL_RELEASE(_class) \
1150
NS_IMPL_QUERY_INTERFACE11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
1151
_i8, _i9, _i10, _i11) \
1152
NS_IMPL_CI_INTERFACE_GETTER11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
1153
_i8, _i9, _i10, _i11)
1155
#define NS_INTERFACE_MAP_END_THREADSAFE NS_IMPL_QUERY_TAIL_GUTS