~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/xpcom/glue/nsISupportsImpl.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ***** BEGIN LICENSE BLOCK *****
 
2
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
3
 *
 
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/
 
8
 *
 
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
 
12
 * License.
 
13
 *
 
14
 * The Original Code is XPCOM.
 
15
 *
 
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.
 
19
 *
 
20
 * Contributor(s):
 
21
 *
 
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.
 
33
 *
 
34
 * ***** END LICENSE BLOCK ***** */
 
35
 
 
36
 
 
37
#ifndef nsISupportsImpl_h__
 
38
#define nsISupportsImpl_h__
 
39
 
 
40
#ifndef nscore_h___
 
41
#include "nscore.h"
 
42
#endif
 
43
 
 
44
#ifndef nsISupportsBase_h__
 
45
#include "nsISupportsBase.h"
 
46
#endif
 
47
 
 
48
#include "prthread.h" /* needed for thread-safety checks */
 
49
#include "pratom.h"   /* needed for PR_AtomicIncrement and PR_AtomicDecrement */
 
50
 
 
51
#include "nsDebug.h"
 
52
#include "nsTraceRefcnt.h" 
 
53
 
 
54
////////////////////////////////////////////////////////////////////////////////
 
55
// Macros to help detect thread-safety:
 
56
 
 
57
#if defined(NS_DEBUG)
 
58
 
 
59
class nsAutoOwningThread {
 
60
public:
 
61
    nsAutoOwningThread() { mThread = PR_GetCurrentThread(); }
 
62
    void *GetThread() const { return mThread; }
 
63
 
 
64
private:
 
65
    void *mThread;
 
66
};
 
67
 
 
68
#define NS_DECL_OWNINGTHREAD            nsAutoOwningThread _mOwningThread;
 
69
#define NS_ASSERT_OWNINGTHREAD(_class) \
 
70
  NS_CheckThreadSafe(_mOwningThread.GetThread(), #_class " not thread-safe")
 
71
 
 
72
#else // !(defined(NS_DEBUG))
 
73
 
 
74
#define NS_DECL_OWNINGTHREAD            /* nothing */
 
75
#define NS_ASSERT_OWNINGTHREAD(_class)  ((void)0)
 
76
 
 
77
#endif // !(defined(NS_DEBUG))
 
78
 
 
79
class nsAutoRefCnt {
 
80
 
 
81
 public:
 
82
    nsAutoRefCnt() : mValue(0) {}
 
83
    nsAutoRefCnt(nsrefcnt aValue) : mValue(aValue) {}
 
84
 
 
85
    // only support prefix increment/decrement
 
86
    nsrefcnt operator++() { return ++mValue; }
 
87
    nsrefcnt operator--() { return --mValue; }
 
88
    
 
89
    nsrefcnt operator=(nsrefcnt aValue) { return (mValue = aValue); }
 
90
    operator nsrefcnt() const { return mValue; }
 
91
    nsrefcnt get() const { return mValue; }
 
92
 private:
 
93
    // do not define these to enforce the faster prefix notation
 
94
    nsrefcnt operator++(int);
 
95
    nsrefcnt operator--(int);
 
96
    nsrefcnt mValue;
 
97
};
 
98
 
 
99
///////////////////////////////////////////////////////////////////////////////
 
100
 
 
101
/**
 
102
 * Declare the reference count variable and the implementations of the
 
103
 * AddRef and QueryInterface methods.
 
104
 */
 
105
 
 
106
#define NS_DECL_ISUPPORTS                                                     \
 
107
public:                                                                       \
 
108
  NS_IMETHOD QueryInterface(REFNSIID aIID,                                    \
 
109
                            void** aInstancePtr);                             \
 
110
  NS_IMETHOD_(nsrefcnt) AddRef(void);                                         \
 
111
  NS_IMETHOD_(nsrefcnt) Release(void);                                        \
 
112
protected:                                                                    \
 
113
  nsAutoRefCnt mRefCnt;                                                       \
 
114
  NS_DECL_OWNINGTHREAD                                                        \
 
115
public:
 
116
 
 
117
 
 
118
///////////////////////////////////////////////////////////////////////////////
 
119
 
 
120
/**
 
121
 * Previously used to initialize the reference count, but no longer needed.
 
122
 *
 
123
 * DEPRECATED.
 
124
 */
 
125
#define NS_INIT_ISUPPORTS() ((void)0)
 
126
 
 
127
/**
 
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
 
130
 */
 
131
#define NS_IMPL_ADDREF(_class)                                                \
 
132
NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void)                                 \
 
133
{                                                                             \
 
134
  NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt");                   \
 
135
  NS_ASSERT_OWNINGTHREAD(_class);                                             \
 
136
  ++mRefCnt;                                                                  \
 
137
  NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this));                       \
 
138
  return mRefCnt;                                                             \
 
139
}
 
140
 
 
141
/**
 
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
 
147
 */
 
148
#define NS_IMPL_ADDREF_USING_AGGREGATOR(_class, _aggregator)                  \
 
149
NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void)                                 \
 
150
{                                                                             \
 
151
  NS_PRECONDITION(_aggregator, "null aggregator");                            \
 
152
  return (_aggregator)->AddRef();                                             \
 
153
}
 
154
 
 
155
/**
 
156
 * Use this macro to implement the Release method for a given
 
157
 * <i>_class</i>.
 
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.
 
161
 *
 
162
 * For example,
 
163
 *
 
164
 *   NS_IMPL_RELEASE_WITH_DESTROY(Foo, Destroy(this))
 
165
 *
 
166
 * will cause
 
167
 *
 
168
 *   Destroy(this);
 
169
 *
 
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).
 
173
 */
 
174
#define NS_IMPL_RELEASE_WITH_DESTROY(_class, _destroy)                        \
 
175
NS_IMETHODIMP_(nsrefcnt) _class::Release(void)                                \
 
176
{                                                                             \
 
177
  NS_PRECONDITION(0 != mRefCnt, "dup release");                               \
 
178
  NS_ASSERT_OWNINGTHREAD(_class);                                             \
 
179
  --mRefCnt;                                                                  \
 
180
  NS_LOG_RELEASE(this, mRefCnt, #_class);                                     \
 
181
  if (mRefCnt == 0) {                                                         \
 
182
    mRefCnt = 1; /* stabilize */                                              \
 
183
    _destroy;                                                                 \
 
184
    return 0;                                                                 \
 
185
  }                                                                           \
 
186
  return mRefCnt;                                                             \
 
187
}
 
188
 
 
189
/**
 
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
 
192
 *
 
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|.
 
201
 */
 
202
#define NS_IMPL_RELEASE(_class) \
 
203
  NS_IMPL_RELEASE_WITH_DESTROY(_class, NS_DELETEXPCOM(this))
 
204
 
 
205
/**
 
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
 
211
 */
 
212
#define NS_IMPL_RELEASE_USING_AGGREGATOR(_class, _aggregator)                 \
 
213
NS_IMETHODIMP_(nsrefcnt) _class::Release(void)                                \
 
214
{                                                                             \
 
215
  NS_PRECONDITION(_aggregator, "null aggregator");                            \
 
216
  return (_aggregator)->Release();                                            \
 
217
}
 
218
 
 
219
 
 
220
 
 
221
///////////////////////////////////////////////////////////////////////////////
 
222
 
 
223
/*
 
224
 * Some convenience macros for implementing QueryInterface
 
225
 */
 
226
 
 
227
/**
 
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.
 
232
 *
 
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)
 
236
 */
 
237
 
 
238
#define NS_IMPL_QUERY_HEAD(_class)                                            \
 
239
NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr)      \
 
240
{                                                                             \
 
241
  NS_ASSERTION(aInstancePtr,                                                  \
 
242
               "QueryInterface requires a non-NULL destination!");            \
 
243
  nsISupports* foundInterface;
 
244
 
 
245
#define NS_IMPL_QUERY_BODY(_interface)                                        \
 
246
  if ( aIID.Equals(NS_GET_IID(_interface)) )                                  \
 
247
    foundInterface = NS_STATIC_CAST(_interface*, this);                       \
 
248
  else
 
249
 
 
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);                       \
 
253
  else
 
254
 
 
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));       \
 
259
  else
 
260
 
 
261
#define NS_IMPL_QUERY_BODY_AGGREGATED(_interface, _aggregate)                 \
 
262
  if ( aIID.Equals(NS_GET_IID(_interface)) )                                  \
 
263
    foundInterface = NS_STATIC_CAST(_interface*, _aggregate);                 \
 
264
  else
 
265
 
 
266
#define NS_IMPL_QUERY_TAIL_GUTS                                               \
 
267
    foundInterface = 0;                                                       \
 
268
  nsresult status;                                                            \
 
269
  if ( !foundInterface )                                                      \
 
270
    status = NS_NOINTERFACE;                                                  \
 
271
  else                                                                        \
 
272
    {                                                                         \
 
273
      NS_ADDREF(foundInterface);                                              \
 
274
      status = NS_OK;                                                         \
 
275
    }                                                                         \
 
276
  *aInstancePtr = foundInterface;                                             \
 
277
  return status;                                                              \
 
278
}
 
279
 
 
280
#define NS_IMPL_QUERY_TAIL_INHERITING(_baseclass)                             \
 
281
    foundInterface = 0;                                                       \
 
282
  nsresult status;                                                            \
 
283
  if ( !foundInterface )                                                      \
 
284
    status = _baseclass::QueryInterface(aIID, (void**)&foundInterface);       \
 
285
  else                                                                        \
 
286
    {                                                                         \
 
287
      NS_ADDREF(foundInterface);                                              \
 
288
      status = NS_OK;                                                         \
 
289
    }                                                                         \
 
290
  *aInstancePtr = foundInterface;                                             \
 
291
  return status;                                                              \
 
292
}
 
293
 
 
294
#define NS_IMPL_QUERY_TAIL_USING_AGGREGATOR(_aggregator)                      \
 
295
    foundInterface = 0;                                                       \
 
296
  nsresult status;                                                            \
 
297
  if ( !foundInterface ) {                                                    \
 
298
    NS_ASSERTION(_aggregator, "null aggregator");                             \
 
299
    status = _aggregator->QueryInterface(aIID, (void**)&foundInterface);      \
 
300
  } else                                                                      \
 
301
    {                                                                         \
 
302
      NS_ADDREF(foundInterface);                                              \
 
303
      status = NS_OK;                                                         \
 
304
    }                                                                         \
 
305
  *aInstancePtr = foundInterface;                                             \
 
306
  return status;                                                              \
 
307
}
 
308
 
 
309
#define NS_IMPL_QUERY_TAIL(_supports_interface)                               \
 
310
  NS_IMPL_QUERY_BODY_AMBIGUOUS(nsISupports, _supports_interface)              \
 
311
  NS_IMPL_QUERY_TAIL_GUTS
 
312
 
 
313
 
 
314
  /*
 
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.
 
319
  */
 
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)
 
326
 
 
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)
 
334
 
 
335
#define NS_IMPL_QUERY_INTERFACE0(_class)                                      \
 
336
  NS_INTERFACE_MAP_BEGIN(_class)                                              \
 
337
    NS_INTERFACE_MAP_ENTRY(nsISupports)                                       \
 
338
  NS_INTERFACE_MAP_END
 
339
 
 
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)                        \
 
344
  NS_INTERFACE_MAP_END
 
345
 
 
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)                        \
 
351
  NS_INTERFACE_MAP_END
 
352
 
 
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)                        \
 
359
  NS_INTERFACE_MAP_END
 
360
 
 
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)                        \
 
368
  NS_INTERFACE_MAP_END
 
369
 
 
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)                        \
 
378
  NS_INTERFACE_MAP_END
 
379
 
 
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)                        \
 
389
  NS_INTERFACE_MAP_END
 
390
 
 
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)                        \
 
401
  NS_INTERFACE_MAP_END
 
402
 
 
403
#define NS_IMPL_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6,        \
 
404
                                 _i7, _i8)                                    \
 
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)                        \
 
415
  NS_INTERFACE_MAP_END
 
416
 
 
417
#define NS_IMPL_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6,        \
 
418
                                 _i7, _i8, _i9)                               \
 
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)                        \
 
430
  NS_INTERFACE_MAP_END
 
431
 
 
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)                        \
 
446
  NS_INTERFACE_MAP_END
 
447
 
 
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)                        \
 
463
  NS_INTERFACE_MAP_END
 
464
 
 
465
 
 
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
 
478
 
 
479
/**
 
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.
 
484
 *
 
485
 * class Bar : public Foo, public nsIBar {  // both provide nsISupports
 
486
 * public:
 
487
 *   NS_DECL_ISUPPORTS_INHERITED
 
488
 *   ...other nsIBar and Bar methods...
 
489
 * };
 
490
 */
 
491
#define NS_DECL_ISUPPORTS_INHERITED                                           \
 
492
public:                                                                       \
 
493
  NS_IMETHOD QueryInterface(REFNSIID aIID,                                    \
 
494
                            void** aInstancePtr);                             \
 
495
  NS_IMETHOD_(nsrefcnt) AddRef(void);                                         \
 
496
  NS_IMETHOD_(nsrefcnt) Release(void);                                        \
 
497
 
 
498
/**
 
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.
 
502
 *
 
503
 * Note that I didn't make these inlined because they're virtual methods.
 
504
 */
 
505
 
 
506
#define NS_IMPL_ADDREF_INHERITED(Class, Super)                                \
 
507
NS_IMETHODIMP_(nsrefcnt) Class::AddRef(void)                                  \
 
508
{                                                                             \
 
509
  return Super::AddRef();                                                     \
 
510
}                                                                             \
 
511
 
 
512
#define NS_IMPL_RELEASE_INHERITED(Class, Super)                               \
 
513
NS_IMETHODIMP_(nsrefcnt) Class::Release(void)                                 \
 
514
{                                                                             \
 
515
  return Super::Release();                                                    \
 
516
}                                                                             \
 
517
 
 
518
#define NS_IMPL_QUERY_INTERFACE_INHERITED0(Class, Super)                      \
 
519
  NS_IMPL_QUERY_HEAD(Class)                                                   \
 
520
  NS_IMPL_QUERY_TAIL_INHERITING(Super)                                        \
 
521
 
 
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)                                        \
 
526
 
 
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)                                        \
 
532
 
 
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)                                        \
 
539
 
 
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)                                        \
 
547
 
 
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)                                        \
 
556
 
 
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)                                        \
 
566
 
 
567
/**
 
568
 * Convenience macros for implementing all nsISupports methods for
 
569
 * a simple class.
 
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)
 
573
 */
 
574
 
 
575
#define NS_IMPL_ISUPPORTS0(_class)                                            \
 
576
  NS_IMPL_ADDREF(_class)                                                      \
 
577
  NS_IMPL_RELEASE(_class)                                                     \
 
578
  NS_IMPL_QUERY_INTERFACE0(_class)
 
579
 
 
580
#define NS_IMPL_ISUPPORTS1(_class, _interface)                                \
 
581
  NS_IMPL_ADDREF(_class)                                                      \
 
582
  NS_IMPL_RELEASE(_class)                                                     \
 
583
  NS_IMPL_QUERY_INTERFACE1(_class, _interface)
 
584
 
 
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)
 
589
 
 
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)
 
594
 
 
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)
 
599
 
 
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)
 
604
 
 
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)
 
609
 
 
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)
 
614
 
 
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)
 
619
 
 
620
#define NS_IMPL_ISUPPORTS9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8,    \
 
621
                           _i9)                                               \
 
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)
 
625
 
 
626
#define NS_IMPL_ISUPPORTS10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8,   \
 
627
                            _i9, _i10)                                        \
 
628
  NS_IMPL_ADDREF(_class)                                                      \
 
629
  NS_IMPL_RELEASE(_class)                                                     \
 
630
  NS_IMPL_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8,   \
 
631
                            _i9, _i10)
 
632
 
 
633
#define NS_IMPL_ISUPPORTS11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8,   \
 
634
                            _i9, _i10, _i11)                                  \
 
635
  NS_IMPL_ADDREF(_class)                                                      \
 
636
  NS_IMPL_RELEASE(_class)                                                     \
 
637
  NS_IMPL_QUERY_INTERFACE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8,   \
 
638
                            _i9, _i10, _i11)
 
639
 
 
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)                                   \
 
644
 
 
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)                                   \
 
649
 
 
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)                                   \
 
654
 
 
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)                                   \
 
659
 
 
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)                                   \
 
664
 
 
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)                                   \
 
669
 
 
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)                                   \
 
674
 
 
675
///////////////////////////////////////////////////////////////////////////////
 
676
/**
 
677
 *
 
678
 * Threadsafe implementations of the ISupports convenience macros
 
679
 *
 
680
 */
 
681
 
 
682
/**
 
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
 
685
 */
 
686
 
 
687
#define NS_IMPL_THREADSAFE_ADDREF(_class)                                     \
 
688
NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void)                                 \
 
689
{                                                                             \
 
690
  NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt");                   \
 
691
  nsrefcnt count;                                                             \
 
692
  count = PR_AtomicIncrement((PRInt32*)&mRefCnt);                             \
 
693
  NS_LOG_ADDREF(this, count, #_class, sizeof(*this));                         \
 
694
  return count;                                                               \
 
695
}
 
696
 
 
697
/**
 
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
 
700
 */
 
701
 
 
702
#define NS_IMPL_THREADSAFE_RELEASE(_class)                                    \
 
703
NS_IMETHODIMP_(nsrefcnt) _class::Release(void)                                \
 
704
{                                                                             \
 
705
  nsrefcnt count;                                                             \
 
706
  NS_PRECONDITION(0 != mRefCnt, "dup release");                               \
 
707
  count = PR_AtomicDecrement((PRInt32 *)&mRefCnt);                            \
 
708
  NS_LOG_RELEASE(this, count, #_class);                                       \
 
709
  if (0 == count) {                                                           \
 
710
    mRefCnt = 1; /* stabilize */                                              \
 
711
    /* enable this to find non-threadsafe destructors: */                     \
 
712
    /* NS_ASSERT_OWNINGTHREAD(_class); */                                     \
 
713
    NS_DELETEXPCOM(this);                                                     \
 
714
    return 0;                                                                 \
 
715
  }                                                                           \
 
716
  return count;                                                               \
 
717
}
 
718
 
 
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)
 
723
 
 
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)
 
728
 
 
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)
 
733
 
 
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)
 
738
 
 
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)
 
743
 
 
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)
 
748
 
 
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)
 
753
 
 
754
#define NS_IMPL_THREADSAFE_ISUPPORTS7(_class, _i1, _i2, _i3, _i4, _i5, _i6,   \
 
755
                                      _i7)                                    \
 
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,   \
 
759
                                      _i7)
 
760
 
 
761
#define NS_IMPL_THREADSAFE_ISUPPORTS8(_class, _i1, _i2, _i3, _i4, _i5, _i6,   \
 
762
                                      _i7, _i8)                               \
 
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,   \
 
766
                                      _i7, _i8)
 
767
 
 
768
#define NS_IMPL_THREADSAFE_ISUPPORTS9(_class, _i1, _i2, _i3, _i4, _i5, _i6,   \
 
769
                                      _i7, _i8, _i9)                          \
 
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,   \
 
773
                                      _i7, _i8, _i9)
 
774
 
 
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,  \
 
780
                                       _i7, _i8, _i9, _i10)
 
781
 
 
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)
 
788
 
 
789
///////////////////////////////////////////////////////////////////////////////
 
790
// Macros for implementing nsIClassInfo-related stuff.
 
791
///////////////////////////////////////////////////////////////////////////////
 
792
 
 
793
// include here instead of at the top because it requires the nsISupport decl
 
794
#include "nsIClassInfo.h"
 
795
 
 
796
#define NS_CLASSINFO_NAME(_class) _class##_classInfoGlobal
 
797
#define NS_CI_INTERFACE_GETTER_NAME(_class) _class##_GetInterfacesHelper
 
798
 
 
799
#define NS_DECL_CI_INTERFACE_GETTER(_class)                                   \
 
800
  extern NS_IMETHODIMP NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *,        \
 
801
                                                           nsIID ***);
 
802
 
 
803
#define NS_DECL_CLASSINFO(_class)                                             \
 
804
  NS_DECL_CI_INTERFACE_GETTER(_class)                                         \
 
805
  nsIClassInfo *NS_CLASSINFO_NAME(_class);
 
806
 
 
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));\
 
811
  } else
 
812
 
 
813
#define NS_CLASSINFO_HELPER_BEGIN(_class, _c)                                 \
 
814
NS_IMETHODIMP                                                                 \
 
815
NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *count, nsIID ***array)          \
 
816
{                                                                             \
 
817
    *count = _c;                                                              \
 
818
    *array = (nsIID **)nsMemory::Alloc(sizeof (nsIID *) * _c);
 
819
 
 
820
#define NS_CLASSINFO_HELPER_ENTRY(_i, _interface)                             \
 
821
    (*array)[_i] = (nsIID *)nsMemory::Clone(&NS_GET_IID(_interface),          \
 
822
                                            sizeof(nsIID));
 
823
 
 
824
#define NS_CLASSINFO_HELPER_END                                               \
 
825
    return NS_OK;                                                             \
 
826
}
 
827
 
 
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
 
832
 
 
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)                                           \
 
838
  NS_INTERFACE_MAP_END
 
839
 
 
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)
 
845
 
 
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
 
851
 
 
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)                                           \
 
858
  NS_INTERFACE_MAP_END
 
859
 
 
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)
 
865
 
 
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
 
872
 
 
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)                                           \
 
880
  NS_INTERFACE_MAP_END
 
881
 
 
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)
 
887
 
 
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
 
895
 
 
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)                                           \
 
904
  NS_INTERFACE_MAP_END
 
905
 
 
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)
 
911
 
 
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
 
920
 
 
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)                                           \
 
930
  NS_INTERFACE_MAP_END
 
931
 
 
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)
 
937
 
 
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
 
947
 
 
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)                                           \
 
958
  NS_INTERFACE_MAP_END
 
959
 
 
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)
 
965
 
 
966
#define NS_IMPL_CI_INTERFACE_GETTER7(_class, _i1, _i2, _i3, _i4, _i5, _i6,    \
 
967
                                     _i7)                                     \
 
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
 
977
 
 
978
#define NS_IMPL_QUERY_INTERFACE7_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6,     \
 
979
                                    _i7)                                      \
 
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)                                           \
 
990
  NS_INTERFACE_MAP_END
 
991
 
 
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)
 
997
 
 
998
#define NS_IMPL_CI_INTERFACE_GETTER8(_class, _i1, _i2, _i3, _i4, _i5, _i6,    \
 
999
                                     _i7, _i8)                                \
 
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
 
1010
 
 
1011
#define NS_IMPL_QUERY_INTERFACE8_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6,     \
 
1012
                                    _i7, _i8)                                 \
 
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
 
1025
 
 
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)
 
1031
 
 
1032
#define NS_IMPL_CI_INTERFACE_GETTER9(_class, _i1, _i2, _i3, _i4, _i5, _i6,    \
 
1033
                                     _i7, _i8, _i9)                           \
 
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
 
1045
 
 
1046
#define NS_IMPL_QUERY_INTERFACE9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6,     \
 
1047
                                    _i7, _i8, _i9)                            \
 
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
 
1061
 
 
1062
#define NS_IMPL_ISUPPORTS9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,      \
 
1063
                              _i8, _i9)                                       \
 
1064
  NS_IMPL_ADDREF(_class)                                                      \
 
1065
  NS_IMPL_RELEASE(_class)                                                     \
 
1066
  NS_IMPL_QUERY_INTERFACE9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,      \
 
1067
                              _i8, _i9)                                       \
 
1068
  NS_IMPL_CI_INTERFACE_GETTER9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,     \
 
1069
                               _i8, _i9)
 
1070
 
 
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
 
1085
 
 
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
 
1101
 
 
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
 
1118
 
 
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
 
1136
 
 
1137
#define NS_IMPL_ISUPPORTS10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,     \
 
1138
                               _i8, _i9, _i10)                                \
 
1139
  NS_IMPL_ADDREF(_class)                                                      \
 
1140
  NS_IMPL_RELEASE(_class)                                                     \
 
1141
  NS_IMPL_QUERY_INTERFACE10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,     \
 
1142
                               _i8, _i9, _i10)                                \
 
1143
  NS_IMPL_CI_INTERFACE_GETTER10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,    \
 
1144
                                _i8, _i9, _i10)
 
1145
 
 
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)
 
1154
 
 
1155
#define NS_INTERFACE_MAP_END_THREADSAFE NS_IMPL_QUERY_TAIL_GUTS
 
1156
 
 
1157
#endif