OLD | NEW |
(Empty) | |
| 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 #if defined(XPCOM_GLUE) && !defined(XPCOM_GLUE_USE_NSPR) |
| 49 // If we're being linked as standalone glue, we don't want a dynamic dependency |
| 50 // on NSPR libs, so we skip the debug thread-safety checks, and we cannot use |
| 51 // the THREADSAFE_ISUPPORTS macros. |
| 52 |
| 53 #define XPCOM_GLUE_AVOID_NSPR |
| 54 |
| 55 #endif |
| 56 |
| 57 |
| 58 #if !defined(XPCOM_GLUE_AVOID_NSPR) |
| 59 #include "prthread.h" /* needed for thread-safety checks */ |
| 60 #include "pratom.h" /* needed for PR_AtomicIncrement and PR_AtomicDecrement */ |
| 61 #endif |
| 62 |
| 63 #include "nsDebug.h" |
| 64 #include "nsTraceRefcnt.h" |
| 65 |
| 66 //////////////////////////////////////////////////////////////////////////////// |
| 67 // Macros to help detect thread-safety: |
| 68 |
| 69 #if defined(NS_DEBUG) && !defined(XPCOM_GLUE_AVOID_NSPR) |
| 70 |
| 71 class nsAutoOwningThread { |
| 72 public: |
| 73 nsAutoOwningThread() { mThread = PR_GetCurrentThread(); } |
| 74 void *GetThread() const { return mThread; } |
| 75 |
| 76 private: |
| 77 void *mThread; |
| 78 }; |
| 79 |
| 80 #define NS_DECL_OWNINGTHREAD nsAutoOwningThread _mOwningThread; |
| 81 #define NS_ASSERT_OWNINGTHREAD(_class) \ |
| 82 NS_CheckThreadSafe(_mOwningThread.GetThread(), #_class " not thread-safe") |
| 83 |
| 84 #else // !NS_DEBUG |
| 85 |
| 86 #define NS_DECL_OWNINGTHREAD /* nothing */ |
| 87 #define NS_ASSERT_OWNINGTHREAD(_class) ((void)0) |
| 88 |
| 89 #endif // NS_DEBUG |
| 90 |
| 91 class nsAutoRefCnt { |
| 92 |
| 93 public: |
| 94 nsAutoRefCnt() : mValue(0) {} |
| 95 nsAutoRefCnt(nsrefcnt aValue) : mValue(aValue) {} |
| 96 |
| 97 // only support prefix increment/decrement |
| 98 nsrefcnt operator++() { return ++mValue; } |
| 99 nsrefcnt operator--() { return --mValue; } |
| 100 |
| 101 nsrefcnt operator=(nsrefcnt aValue) { return (mValue = aValue); } |
| 102 operator nsrefcnt() const { return mValue; } |
| 103 nsrefcnt get() const { return mValue; } |
| 104 private: |
| 105 // do not define these to enforce the faster prefix notation |
| 106 nsrefcnt operator++(int); |
| 107 nsrefcnt operator--(int); |
| 108 nsrefcnt mValue; |
| 109 }; |
| 110 |
| 111 /////////////////////////////////////////////////////////////////////////////// |
| 112 |
| 113 /** |
| 114 * Declare the reference count variable and the implementations of the |
| 115 * AddRef and QueryInterface methods. |
| 116 */ |
| 117 |
| 118 #define NS_DECL_ISUPPORTS \ |
| 119 public: \ |
| 120 NS_IMETHOD QueryInterface(REFNSIID aIID, \ |
| 121 void** aInstancePtr); \ |
| 122 NS_IMETHOD_(nsrefcnt) AddRef(void); \ |
| 123 NS_IMETHOD_(nsrefcnt) Release(void); \ |
| 124 protected: \ |
| 125 nsAutoRefCnt mRefCnt; \ |
| 126 NS_DECL_OWNINGTHREAD \ |
| 127 public: |
| 128 |
| 129 |
| 130 /////////////////////////////////////////////////////////////////////////////// |
| 131 |
| 132 /** |
| 133 * Previously used to initialize the reference count, but no longer needed. |
| 134 * |
| 135 * DEPRECATED. |
| 136 */ |
| 137 #define NS_INIT_ISUPPORTS() ((void)0) |
| 138 |
| 139 /** |
| 140 * Use this macro to implement the AddRef method for a given <i>_class</i> |
| 141 * @param _class The name of the class implementing the method |
| 142 */ |
| 143 #define NS_IMPL_ADDREF(_class) \ |
| 144 NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \ |
| 145 { \ |
| 146 NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \ |
| 147 NS_ASSERT_OWNINGTHREAD(_class); \ |
| 148 ++mRefCnt; \ |
| 149 NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this)); \ |
| 150 return mRefCnt; \ |
| 151 } |
| 152 |
| 153 /** |
| 154 * Use this macro to implement the AddRef method for a given <i>_class</i> |
| 155 * implemented as a wholly owned aggregated object intended to implement |
| 156 * interface(s) for its owner |
| 157 * @param _class The name of the class implementing the method |
| 158 * @param _aggregator the owning/containing object |
| 159 */ |
| 160 #define NS_IMPL_ADDREF_USING_AGGREGATOR(_class, _aggregator) \ |
| 161 NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \ |
| 162 { \ |
| 163 NS_PRECONDITION(_aggregator, "null aggregator"); \ |
| 164 return (_aggregator)->AddRef(); \ |
| 165 } |
| 166 |
| 167 /** |
| 168 * Use this macro to implement the Release method for a given |
| 169 * <i>_class</i>. |
| 170 * @param _class The name of the class implementing the method |
| 171 * @param _destroy A statement that is executed when the object's |
| 172 * refcount drops to zero. |
| 173 * |
| 174 * For example, |
| 175 * |
| 176 * NS_IMPL_RELEASE_WITH_DESTROY(Foo, Destroy(this)) |
| 177 * |
| 178 * will cause |
| 179 * |
| 180 * Destroy(this); |
| 181 * |
| 182 * to be invoked when the object's refcount drops to zero. This |
| 183 * allows for arbitrary teardown activity to occur (e.g., deallocation |
| 184 * of object allocated with placement new). |
| 185 */ |
| 186 #define NS_IMPL_RELEASE_WITH_DESTROY(_class, _destroy) \ |
| 187 NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \ |
| 188 { \ |
| 189 NS_PRECONDITION(0 != mRefCnt, "dup release"); \ |
| 190 NS_ASSERT_OWNINGTHREAD(_class); \ |
| 191 --mRefCnt; \ |
| 192 NS_LOG_RELEASE(this, mRefCnt, #_class); \ |
| 193 if (mRefCnt == 0) { \ |
| 194 mRefCnt = 1; /* stabilize */ \ |
| 195 _destroy; \ |
| 196 return 0; \ |
| 197 } \ |
| 198 return mRefCnt; \ |
| 199 } |
| 200 |
| 201 /** |
| 202 * Use this macro to implement the Release method for a given <i>_class</i> |
| 203 * @param _class The name of the class implementing the method |
| 204 * |
| 205 * A note on the 'stabilization' of the refcnt to one. At that point, |
| 206 * the object's refcount will have gone to zero. The object's |
| 207 * destructor may trigger code that attempts to QueryInterface() and |
| 208 * Release() 'this' again. Doing so will temporarily increment and |
| 209 * decrement the refcount. (Only a logic error would make one try to |
| 210 * keep a permanent hold on 'this'.) To prevent re-entering the |
| 211 * destructor, we make sure that no balanced refcounting can return |
| 212 * the refcount to |0|. |
| 213 */ |
| 214 #define NS_IMPL_RELEASE(_class) \ |
| 215 NS_IMPL_RELEASE_WITH_DESTROY(_class, NS_DELETEXPCOM(this)) |
| 216 |
| 217 /** |
| 218 * Use this macro to implement the Release method for a given <i>_class</i> |
| 219 * implemented as a wholly owned aggregated object intended to implement |
| 220 * interface(s) for its owner |
| 221 * @param _class The name of the class implementing the method |
| 222 * @param _aggregator the owning/containing object |
| 223 */ |
| 224 #define NS_IMPL_RELEASE_USING_AGGREGATOR(_class, _aggregator) \ |
| 225 NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \ |
| 226 { \ |
| 227 NS_PRECONDITION(_aggregator, "null aggregator"); \ |
| 228 return (_aggregator)->Release(); \ |
| 229 } |
| 230 |
| 231 |
| 232 |
| 233 /////////////////////////////////////////////////////////////////////////////// |
| 234 |
| 235 /* |
| 236 * Some convenience macros for implementing QueryInterface |
| 237 */ |
| 238 |
| 239 /** |
| 240 * This implements query interface with two assumptions: First, the |
| 241 * class in question implements nsISupports and its own interface and |
| 242 * nothing else. Second, the implementation of the class's primary |
| 243 * inheritance chain leads to its own interface. |
| 244 * |
| 245 * @param _class The name of the class implementing the method |
| 246 * @param _classiiddef The name of the #define symbol that defines the IID |
| 247 * for the class (e.g. NS_ISUPPORTS_IID) |
| 248 */ |
| 249 |
| 250 #define NS_IMPL_QUERY_HEAD(_class) \ |
| 251 NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ |
| 252 { \ |
| 253 NS_ASSERTION(aInstancePtr, \ |
| 254 "QueryInterface requires a non-NULL destination!"); \ |
| 255 nsISupports* foundInterface; |
| 256 |
| 257 #define NS_IMPL_QUERY_BODY(_interface) \ |
| 258 if ( aIID.Equals(NS_GET_IID(_interface)) ) \ |
| 259 foundInterface = NS_STATIC_CAST(_interface*, this); \ |
| 260 else |
| 261 |
| 262 #define NS_IMPL_QUERY_BODY_CONDITIONAL(_interface, condition) \ |
| 263 if ( (condition) && aIID.Equals(NS_GET_IID(_interface))) \ |
| 264 foundInterface = NS_STATIC_CAST(_interface*, this); \ |
| 265 else |
| 266 |
| 267 #define NS_IMPL_QUERY_BODY_AMBIGUOUS(_interface, _implClass) \ |
| 268 if ( aIID.Equals(NS_GET_IID(_interface)) ) \ |
| 269 foundInterface = NS_STATIC_CAST(_interface*, \ |
| 270 NS_STATIC_CAST(_implClass*, this)); \ |
| 271 else |
| 272 |
| 273 #define NS_IMPL_QUERY_BODY_AGGREGATED(_interface, _aggregate) \ |
| 274 if ( aIID.Equals(NS_GET_IID(_interface)) ) \ |
| 275 foundInterface = NS_STATIC_CAST(_interface*, _aggregate); \ |
| 276 else |
| 277 |
| 278 #define NS_IMPL_QUERY_TAIL_GUTS \ |
| 279 foundInterface = 0; \ |
| 280 nsresult status; \ |
| 281 if ( !foundInterface ) \ |
| 282 status = NS_NOINTERFACE; \ |
| 283 else \ |
| 284 { \ |
| 285 NS_ADDREF(foundInterface); \ |
| 286 status = NS_OK; \ |
| 287 } \ |
| 288 *aInstancePtr = foundInterface; \ |
| 289 return status; \ |
| 290 } |
| 291 |
| 292 #define NS_IMPL_QUERY_TAIL_INHERITING(_baseclass) \ |
| 293 foundInterface = 0; \ |
| 294 nsresult status; \ |
| 295 if ( !foundInterface ) \ |
| 296 status = _baseclass::QueryInterface(aIID, (void**)&foundInterface); \ |
| 297 else \ |
| 298 { \ |
| 299 NS_ADDREF(foundInterface); \ |
| 300 status = NS_OK; \ |
| 301 } \ |
| 302 *aInstancePtr = foundInterface; \ |
| 303 return status; \ |
| 304 } |
| 305 |
| 306 #define NS_IMPL_QUERY_TAIL_USING_AGGREGATOR(_aggregator) \ |
| 307 foundInterface = 0; \ |
| 308 nsresult status; \ |
| 309 if ( !foundInterface ) { \ |
| 310 NS_ASSERTION(_aggregator, "null aggregator"); \ |
| 311 status = _aggregator->QueryInterface(aIID, (void**)&foundInterface); \ |
| 312 } else \ |
| 313 { \ |
| 314 NS_ADDREF(foundInterface); \ |
| 315 status = NS_OK; \ |
| 316 } \ |
| 317 *aInstancePtr = foundInterface; \ |
| 318 return status; \ |
| 319 } |
| 320 |
| 321 #define NS_IMPL_QUERY_TAIL(_supports_interface) \ |
| 322 NS_IMPL_QUERY_BODY_AMBIGUOUS(nsISupports, _supports_interface) \ |
| 323 NS_IMPL_QUERY_TAIL_GUTS |
| 324 |
| 325 |
| 326 /* |
| 327 This is the new scheme. Using this notation now will allow us to switch to |
| 328 a table driven mechanism when it's ready. Note the difference between this |
| 329 and the (currently) underlying NS_IMPL_QUERY_INTERFACE mechanism. You must |
| 330 explicitly mention |nsISupports| when using the interface maps. |
| 331 */ |
| 332 #define NS_INTERFACE_MAP_BEGIN(_implClass) NS_IMPL_QUERY_HEAD(_implClass) |
| 333 #define NS_INTERFACE_MAP_ENTRY(_interface) NS_IMPL_QUERY_BODY(_interface) |
| 334 #define NS_INTERFACE_MAP_ENTRY_CONDITIONAL(_interface, condition) \ |
| 335 NS_IMPL_QUERY_BODY_CONDITIONAL(_interface, condition) |
| 336 #define NS_INTERFACE_MAP_ENTRY_AGGREGATED(_interface,_aggregate) \ |
| 337 NS_IMPL_QUERY_BODY_AGGREGATED(_interface,_aggregate) |
| 338 |
| 339 #define NS_INTERFACE_MAP_END NS_IMPL_QUERY_TAIL_GUTS |
| 340 #define NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(_interface, _implClass) \ |
| 341 NS_IMPL_QUERY_BODY_AMBIGUOUS(_interface, _implClass) |
| 342 #define NS_INTERFACE_MAP_END_INHERITING(_baseClass) \ |
| 343 NS_IMPL_QUERY_TAIL_INHERITING(_baseClass) |
| 344 #define NS_INTERFACE_MAP_END_AGGREGATED(_aggregator) \ |
| 345 NS_IMPL_QUERY_TAIL_USING_AGGREGATOR(_aggregator) |
| 346 |
| 347 #define NS_IMPL_QUERY_INTERFACE0(_class) \ |
| 348 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 349 NS_INTERFACE_MAP_ENTRY(nsISupports) \ |
| 350 NS_INTERFACE_MAP_END |
| 351 |
| 352 #define NS_IMPL_QUERY_INTERFACE1(_class, _i1) \ |
| 353 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 354 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 355 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 356 NS_INTERFACE_MAP_END |
| 357 |
| 358 #define NS_IMPL_QUERY_INTERFACE2(_class, _i1, _i2) \ |
| 359 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 360 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 361 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 362 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 363 NS_INTERFACE_MAP_END |
| 364 |
| 365 #define NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3) \ |
| 366 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 367 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 368 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 369 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 370 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 371 NS_INTERFACE_MAP_END |
| 372 |
| 373 #define NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4) \ |
| 374 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 375 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 376 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 377 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 378 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 379 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 380 NS_INTERFACE_MAP_END |
| 381 |
| 382 #define NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5) \ |
| 383 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 384 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 385 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 386 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 387 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 388 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 389 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 390 NS_INTERFACE_MAP_END |
| 391 |
| 392 #define NS_IMPL_QUERY_INTERFACE6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \ |
| 393 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 394 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 395 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 396 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 397 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 398 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 399 NS_INTERFACE_MAP_ENTRY(_i6) \ |
| 400 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 401 NS_INTERFACE_MAP_END |
| 402 |
| 403 #define NS_IMPL_QUERY_INTERFACE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \ |
| 404 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 405 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 406 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 407 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 408 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 409 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 410 NS_INTERFACE_MAP_ENTRY(_i6) \ |
| 411 NS_INTERFACE_MAP_ENTRY(_i7) \ |
| 412 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 413 NS_INTERFACE_MAP_END |
| 414 |
| 415 #define NS_IMPL_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 416 _i7, _i8) \ |
| 417 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 418 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 419 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 420 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 421 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 422 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 423 NS_INTERFACE_MAP_ENTRY(_i6) \ |
| 424 NS_INTERFACE_MAP_ENTRY(_i7) \ |
| 425 NS_INTERFACE_MAP_ENTRY(_i8) \ |
| 426 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 427 NS_INTERFACE_MAP_END |
| 428 |
| 429 #define NS_IMPL_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 430 _i7, _i8, _i9) \ |
| 431 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 432 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 433 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 434 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 435 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 436 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 437 NS_INTERFACE_MAP_ENTRY(_i6) \ |
| 438 NS_INTERFACE_MAP_ENTRY(_i7) \ |
| 439 NS_INTERFACE_MAP_ENTRY(_i8) \ |
| 440 NS_INTERFACE_MAP_ENTRY(_i9) \ |
| 441 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 442 NS_INTERFACE_MAP_END |
| 443 |
| 444 #define NS_IMPL_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 445 _i7, _i8, _i9, _i10) \ |
| 446 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 447 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 448 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 449 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 450 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 451 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 452 NS_INTERFACE_MAP_ENTRY(_i6) \ |
| 453 NS_INTERFACE_MAP_ENTRY(_i7) \ |
| 454 NS_INTERFACE_MAP_ENTRY(_i8) \ |
| 455 NS_INTERFACE_MAP_ENTRY(_i9) \ |
| 456 NS_INTERFACE_MAP_ENTRY(_i10) \ |
| 457 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 458 NS_INTERFACE_MAP_END |
| 459 |
| 460 #define NS_IMPL_QUERY_INTERFACE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 461 _i7, _i8, _i9, _i10, _i11) \ |
| 462 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 463 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 464 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 465 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 466 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 467 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 468 NS_INTERFACE_MAP_ENTRY(_i6) \ |
| 469 NS_INTERFACE_MAP_ENTRY(_i7) \ |
| 470 NS_INTERFACE_MAP_ENTRY(_i8) \ |
| 471 NS_INTERFACE_MAP_ENTRY(_i9) \ |
| 472 NS_INTERFACE_MAP_ENTRY(_i10) \ |
| 473 NS_INTERFACE_MAP_ENTRY(_i11) \ |
| 474 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 475 NS_INTERFACE_MAP_END |
| 476 |
| 477 |
| 478 #define NS_IMPL_THREADSAFE_QUERY_INTERFACE0 NS_IMPL_QUERY_INTERFACE0 |
| 479 #define NS_IMPL_THREADSAFE_QUERY_INTERFACE1 NS_IMPL_QUERY_INTERFACE1 |
| 480 #define NS_IMPL_THREADSAFE_QUERY_INTERFACE2 NS_IMPL_QUERY_INTERFACE2 |
| 481 #define NS_IMPL_THREADSAFE_QUERY_INTERFACE3 NS_IMPL_QUERY_INTERFACE3 |
| 482 #define NS_IMPL_THREADSAFE_QUERY_INTERFACE4 NS_IMPL_QUERY_INTERFACE4 |
| 483 #define NS_IMPL_THREADSAFE_QUERY_INTERFACE5 NS_IMPL_QUERY_INTERFACE5 |
| 484 #define NS_IMPL_THREADSAFE_QUERY_INTERFACE6 NS_IMPL_QUERY_INTERFACE6 |
| 485 #define NS_IMPL_THREADSAFE_QUERY_INTERFACE7 NS_IMPL_QUERY_INTERFACE7 |
| 486 #define NS_IMPL_THREADSAFE_QUERY_INTERFACE8 NS_IMPL_QUERY_INTERFACE8 |
| 487 #define NS_IMPL_THREADSAFE_QUERY_INTERFACE9 NS_IMPL_QUERY_INTERFACE9 |
| 488 #define NS_IMPL_THREADSAFE_QUERY_INTERFACE10 NS_IMPL_QUERY_INTERFACE10 |
| 489 #define NS_IMPL_THREADSAFE_QUERY_INTERFACE11 NS_IMPL_QUERY_INTERFACE11 |
| 490 |
| 491 /** |
| 492 * Declare that you're going to inherit from something that already |
| 493 * implements nsISupports, but also implements an additional interface, thus |
| 494 * causing an ambiguity. In this case you don't need another mRefCnt, you |
| 495 * just need to forward the definitions to the appropriate superclass. E.g. |
| 496 * |
| 497 * class Bar : public Foo, public nsIBar { // both provide nsISupports |
| 498 * public: |
| 499 * NS_DECL_ISUPPORTS_INHERITED |
| 500 * ...other nsIBar and Bar methods... |
| 501 * }; |
| 502 */ |
| 503 #define NS_DECL_ISUPPORTS_INHERITED \ |
| 504 public: \ |
| 505 NS_IMETHOD QueryInterface(REFNSIID aIID, \ |
| 506 void** aInstancePtr); \ |
| 507 NS_IMETHOD_(nsrefcnt) AddRef(void); \ |
| 508 NS_IMETHOD_(nsrefcnt) Release(void); \ |
| 509 |
| 510 /** |
| 511 * These macros can be used in conjunction with NS_DECL_ISUPPORTS_INHERITED |
| 512 * to implement the nsISupports methods, forwarding the invocations to a |
| 513 * superclass that already implements nsISupports. |
| 514 * |
| 515 * Note that I didn't make these inlined because they're virtual methods. |
| 516 */ |
| 517 |
| 518 #define NS_IMPL_ADDREF_INHERITED(Class, Super) \ |
| 519 NS_IMETHODIMP_(nsrefcnt) Class::AddRef(void) \ |
| 520 { \ |
| 521 return Super::AddRef(); \ |
| 522 } \ |
| 523 |
| 524 #define NS_IMPL_RELEASE_INHERITED(Class, Super) \ |
| 525 NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \ |
| 526 { \ |
| 527 return Super::Release(); \ |
| 528 } \ |
| 529 |
| 530 #define NS_IMPL_QUERY_INTERFACE_INHERITED0(Class, Super) \ |
| 531 NS_IMPL_QUERY_HEAD(Class) \ |
| 532 NS_IMPL_QUERY_TAIL_INHERITING(Super) \ |
| 533 |
| 534 #define NS_IMPL_QUERY_INTERFACE_INHERITED1(Class, Super, i1) \ |
| 535 NS_IMPL_QUERY_HEAD(Class) \ |
| 536 NS_IMPL_QUERY_BODY(i1) \ |
| 537 NS_IMPL_QUERY_TAIL_INHERITING(Super) \ |
| 538 |
| 539 #define NS_IMPL_QUERY_INTERFACE_INHERITED2(Class, Super, i1, i2) \ |
| 540 NS_IMPL_QUERY_HEAD(Class) \ |
| 541 NS_IMPL_QUERY_BODY(i1) \ |
| 542 NS_IMPL_QUERY_BODY(i2) \ |
| 543 NS_IMPL_QUERY_TAIL_INHERITING(Super) \ |
| 544 |
| 545 #define NS_IMPL_QUERY_INTERFACE_INHERITED3(Class, Super, i1, i2, i3) \ |
| 546 NS_IMPL_QUERY_HEAD(Class) \ |
| 547 NS_IMPL_QUERY_BODY(i1) \ |
| 548 NS_IMPL_QUERY_BODY(i2) \ |
| 549 NS_IMPL_QUERY_BODY(i3) \ |
| 550 NS_IMPL_QUERY_TAIL_INHERITING(Super) \ |
| 551 |
| 552 #define NS_IMPL_QUERY_INTERFACE_INHERITED4(Class, Super, i1, i2, i3, i4) \ |
| 553 NS_IMPL_QUERY_HEAD(Class) \ |
| 554 NS_IMPL_QUERY_BODY(i1) \ |
| 555 NS_IMPL_QUERY_BODY(i2) \ |
| 556 NS_IMPL_QUERY_BODY(i3) \ |
| 557 NS_IMPL_QUERY_BODY(i4) \ |
| 558 NS_IMPL_QUERY_TAIL_INHERITING(Super) \ |
| 559 |
| 560 #define NS_IMPL_QUERY_INTERFACE_INHERITED5(Class,Super,i1,i2,i3,i4,i5) \ |
| 561 NS_IMPL_QUERY_HEAD(Class) \ |
| 562 NS_IMPL_QUERY_BODY(i1) \ |
| 563 NS_IMPL_QUERY_BODY(i2) \ |
| 564 NS_IMPL_QUERY_BODY(i3) \ |
| 565 NS_IMPL_QUERY_BODY(i4) \ |
| 566 NS_IMPL_QUERY_BODY(i5) \ |
| 567 NS_IMPL_QUERY_TAIL_INHERITING(Super) \ |
| 568 |
| 569 #define NS_IMPL_QUERY_INTERFACE_INHERITED6(Class,Super,i1,i2,i3,i4,i5,i6) \ |
| 570 NS_IMPL_QUERY_HEAD(Class) \ |
| 571 NS_IMPL_QUERY_BODY(i1) \ |
| 572 NS_IMPL_QUERY_BODY(i2) \ |
| 573 NS_IMPL_QUERY_BODY(i3) \ |
| 574 NS_IMPL_QUERY_BODY(i4) \ |
| 575 NS_IMPL_QUERY_BODY(i5) \ |
| 576 NS_IMPL_QUERY_BODY(i6) \ |
| 577 NS_IMPL_QUERY_TAIL_INHERITING(Super) \ |
| 578 |
| 579 /** |
| 580 * Convenience macros for implementing all nsISupports methods for |
| 581 * a simple class. |
| 582 * @param _class The name of the class implementing the method |
| 583 * @param _classiiddef The name of the #define symbol that defines the IID |
| 584 * for the class (e.g. NS_ISUPPORTS_IID) |
| 585 */ |
| 586 |
| 587 #define NS_IMPL_ISUPPORTS0(_class) \ |
| 588 NS_IMPL_ADDREF(_class) \ |
| 589 NS_IMPL_RELEASE(_class) \ |
| 590 NS_IMPL_QUERY_INTERFACE0(_class) |
| 591 |
| 592 #define NS_IMPL_ISUPPORTS1(_class, _interface) \ |
| 593 NS_IMPL_ADDREF(_class) \ |
| 594 NS_IMPL_RELEASE(_class) \ |
| 595 NS_IMPL_QUERY_INTERFACE1(_class, _interface) |
| 596 |
| 597 #define NS_IMPL_ISUPPORTS2(_class, _i1, _i2) \ |
| 598 NS_IMPL_ADDREF(_class) \ |
| 599 NS_IMPL_RELEASE(_class) \ |
| 600 NS_IMPL_QUERY_INTERFACE2(_class, _i1, _i2) |
| 601 |
| 602 #define NS_IMPL_ISUPPORTS3(_class, _i1, _i2, _i3) \ |
| 603 NS_IMPL_ADDREF(_class) \ |
| 604 NS_IMPL_RELEASE(_class) \ |
| 605 NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3) |
| 606 |
| 607 #define NS_IMPL_ISUPPORTS4(_class, _i1, _i2, _i3, _i4) \ |
| 608 NS_IMPL_ADDREF(_class) \ |
| 609 NS_IMPL_RELEASE(_class) \ |
| 610 NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4) |
| 611 |
| 612 #define NS_IMPL_ISUPPORTS5(_class, _i1, _i2, _i3, _i4, _i5) \ |
| 613 NS_IMPL_ADDREF(_class) \ |
| 614 NS_IMPL_RELEASE(_class) \ |
| 615 NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5) |
| 616 |
| 617 #define NS_IMPL_ISUPPORTS6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \ |
| 618 NS_IMPL_ADDREF(_class) \ |
| 619 NS_IMPL_RELEASE(_class) \ |
| 620 NS_IMPL_QUERY_INTERFACE6(_class, _i1, _i2, _i3, _i4, _i5, _i6) |
| 621 |
| 622 #define NS_IMPL_ISUPPORTS7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \ |
| 623 NS_IMPL_ADDREF(_class) \ |
| 624 NS_IMPL_RELEASE(_class) \ |
| 625 NS_IMPL_QUERY_INTERFACE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) |
| 626 |
| 627 #define NS_IMPL_ISUPPORTS8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \ |
| 628 NS_IMPL_ADDREF(_class) \ |
| 629 NS_IMPL_RELEASE(_class) \ |
| 630 NS_IMPL_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) |
| 631 |
| 632 #define NS_IMPL_ISUPPORTS9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \ |
| 633 _i9) \ |
| 634 NS_IMPL_ADDREF(_class) \ |
| 635 NS_IMPL_RELEASE(_class) \ |
| 636 NS_IMPL_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9) |
| 637 |
| 638 #define NS_IMPL_ISUPPORTS10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \ |
| 639 _i9, _i10) \ |
| 640 NS_IMPL_ADDREF(_class) \ |
| 641 NS_IMPL_RELEASE(_class) \ |
| 642 NS_IMPL_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \ |
| 643 _i9, _i10) |
| 644 |
| 645 #define NS_IMPL_ISUPPORTS11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \ |
| 646 _i9, _i10, _i11) \ |
| 647 NS_IMPL_ADDREF(_class) \ |
| 648 NS_IMPL_RELEASE(_class) \ |
| 649 NS_IMPL_QUERY_INTERFACE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \ |
| 650 _i9, _i10, _i11) |
| 651 |
| 652 #define NS_IMPL_ISUPPORTS_INHERITED0(Class, Super) \ |
| 653 NS_IMPL_QUERY_INTERFACE_INHERITED0(Class, Super) \ |
| 654 NS_IMPL_ADDREF_INHERITED(Class, Super) \ |
| 655 NS_IMPL_RELEASE_INHERITED(Class, Super) \ |
| 656 |
| 657 #define NS_IMPL_ISUPPORTS_INHERITED1(Class, Super, i1) \ |
| 658 NS_IMPL_QUERY_INTERFACE_INHERITED1(Class, Super, i1) \ |
| 659 NS_IMPL_ADDREF_INHERITED(Class, Super) \ |
| 660 NS_IMPL_RELEASE_INHERITED(Class, Super) \ |
| 661 |
| 662 #define NS_IMPL_ISUPPORTS_INHERITED2(Class, Super, i1, i2) \ |
| 663 NS_IMPL_QUERY_INTERFACE_INHERITED2(Class, Super, i1, i2) \ |
| 664 NS_IMPL_ADDREF_INHERITED(Class, Super) \ |
| 665 NS_IMPL_RELEASE_INHERITED(Class, Super) \ |
| 666 |
| 667 #define NS_IMPL_ISUPPORTS_INHERITED3(Class, Super, i1, i2, i3) \ |
| 668 NS_IMPL_QUERY_INTERFACE_INHERITED3(Class, Super, i1, i2, i3) \ |
| 669 NS_IMPL_ADDREF_INHERITED(Class, Super) \ |
| 670 NS_IMPL_RELEASE_INHERITED(Class, Super) \ |
| 671 |
| 672 #define NS_IMPL_ISUPPORTS_INHERITED4(Class, Super, i1, i2, i3, i4) \ |
| 673 NS_IMPL_QUERY_INTERFACE_INHERITED4(Class, Super, i1, i2, i3, i4) \ |
| 674 NS_IMPL_ADDREF_INHERITED(Class, Super) \ |
| 675 NS_IMPL_RELEASE_INHERITED(Class, Super) \ |
| 676 |
| 677 #define NS_IMPL_ISUPPORTS_INHERITED5(Class, Super, i1, i2, i3, i4, i5) \ |
| 678 NS_IMPL_QUERY_INTERFACE_INHERITED5(Class, Super, i1, i2, i3, i4, i5) \ |
| 679 NS_IMPL_ADDREF_INHERITED(Class, Super) \ |
| 680 NS_IMPL_RELEASE_INHERITED(Class, Super) \ |
| 681 |
| 682 #define NS_IMPL_ISUPPORTS_INHERITED6(Class, Super, i1, i2, i3, i4, i5, i6) \ |
| 683 NS_IMPL_QUERY_INTERFACE_INHERITED6(Class, Super, i1, i2, i3, i4, i5, i6) \ |
| 684 NS_IMPL_ADDREF_INHERITED(Class, Super) \ |
| 685 NS_IMPL_RELEASE_INHERITED(Class, Super) \ |
| 686 |
| 687 /////////////////////////////////////////////////////////////////////////////// |
| 688 /** |
| 689 * |
| 690 * Threadsafe implementations of the ISupports convenience macros. |
| 691 * |
| 692 * @note These are not available when linking against the standalone glue, |
| 693 * because the implementation requires PR_ symbols. |
| 694 */ |
| 695 |
| 696 #if !defined(XPCOM_GLUE_AVOID_NSPR) |
| 697 |
| 698 /** |
| 699 * Use this macro to implement the AddRef method for a given <i>_class</i> |
| 700 * @param _class The name of the class implementing the method |
| 701 */ |
| 702 |
| 703 #define NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 704 NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \ |
| 705 { \ |
| 706 NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \ |
| 707 nsrefcnt count; \ |
| 708 count = PR_AtomicIncrement((PRInt32*)&mRefCnt); \ |
| 709 NS_LOG_ADDREF(this, count, #_class, sizeof(*this)); \ |
| 710 return count; \ |
| 711 } |
| 712 |
| 713 /** |
| 714 * Use this macro to implement the Release method for a given <i>_class</i> |
| 715 * @param _class The name of the class implementing the method |
| 716 */ |
| 717 |
| 718 #define NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 719 NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \ |
| 720 { \ |
| 721 nsrefcnt count; \ |
| 722 NS_PRECONDITION(0 != mRefCnt, "dup release"); \ |
| 723 count = PR_AtomicDecrement((PRInt32 *)&mRefCnt); \ |
| 724 NS_LOG_RELEASE(this, count, #_class); \ |
| 725 if (0 == count) { \ |
| 726 mRefCnt = 1; /* stabilize */ \ |
| 727 /* enable this to find non-threadsafe destructors: */ \ |
| 728 /* NS_ASSERT_OWNINGTHREAD(_class); */ \ |
| 729 NS_DELETEXPCOM(this); \ |
| 730 return 0; \ |
| 731 } \ |
| 732 return count; \ |
| 733 } |
| 734 |
| 735 #else // XPCOM_GLUE_AVOID_NSPR |
| 736 |
| 737 #define NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 738 THREADSAFE_ISUPPORTS_NOT_AVAILABLE_IN_STANDALONE_GLUE; |
| 739 |
| 740 #define NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 741 THREADSAFE_ISUPPORTS_NOT_AVAILABLE_IN_STANDALONE_GLUE; |
| 742 |
| 743 #endif |
| 744 |
| 745 #define NS_IMPL_THREADSAFE_ISUPPORTS0(_class) \ |
| 746 NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 747 NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 748 NS_IMPL_THREADSAFE_QUERY_INTERFACE0(_class) |
| 749 |
| 750 #define NS_IMPL_THREADSAFE_ISUPPORTS1(_class, _interface) \ |
| 751 NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 752 NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 753 NS_IMPL_THREADSAFE_QUERY_INTERFACE1(_class, _interface) |
| 754 |
| 755 #define NS_IMPL_THREADSAFE_ISUPPORTS2(_class, _i1, _i2) \ |
| 756 NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 757 NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 758 NS_IMPL_THREADSAFE_QUERY_INTERFACE2(_class, _i1, _i2) |
| 759 |
| 760 #define NS_IMPL_THREADSAFE_ISUPPORTS3(_class, _i1, _i2, _i3) \ |
| 761 NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 762 NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 763 NS_IMPL_THREADSAFE_QUERY_INTERFACE3(_class, _i1, _i2, _i3) |
| 764 |
| 765 #define NS_IMPL_THREADSAFE_ISUPPORTS4(_class, _i1, _i2, _i3, _i4) \ |
| 766 NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 767 NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 768 NS_IMPL_THREADSAFE_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4) |
| 769 |
| 770 #define NS_IMPL_THREADSAFE_ISUPPORTS5(_class, _i1, _i2, _i3, _i4, _i5) \ |
| 771 NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 772 NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 773 NS_IMPL_THREADSAFE_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5) |
| 774 |
| 775 #define NS_IMPL_THREADSAFE_ISUPPORTS6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \ |
| 776 NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 777 NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 778 NS_IMPL_THREADSAFE_QUERY_INTERFACE6(_class, _i1, _i2, _i3, _i4, _i5, _i6) |
| 779 |
| 780 #define NS_IMPL_THREADSAFE_ISUPPORTS7(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 781 _i7) \ |
| 782 NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 783 NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 784 NS_IMPL_THREADSAFE_QUERY_INTERFACE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 785 _i7) |
| 786 |
| 787 #define NS_IMPL_THREADSAFE_ISUPPORTS8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 788 _i7, _i8) \ |
| 789 NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 790 NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 791 NS_IMPL_THREADSAFE_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 792 _i7, _i8) |
| 793 |
| 794 #define NS_IMPL_THREADSAFE_ISUPPORTS9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 795 _i7, _i8, _i9) \ |
| 796 NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 797 NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 798 NS_IMPL_THREADSAFE_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 799 _i7, _i8, _i9) |
| 800 |
| 801 #define NS_IMPL_THREADSAFE_ISUPPORTS10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 802 _i7, _i8, _i9, _i10) \ |
| 803 NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 804 NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 805 NS_IMPL_THREADSAFE_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 806 _i7, _i8, _i9, _i10) |
| 807 |
| 808 #define NS_IMPL_THREADSAFE_ISUPPORTS11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 809 _i7, _i8, _i9, _i10, _i11) \ |
| 810 NS_IMPL_THREADSAFE_ADDREF(_class) \ |
| 811 NS_IMPL_THREADSAFE_RELEASE(_class) \ |
| 812 NS_IMPL_THREADSAFE_QUERY_INTERFACE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 813 _i7, _i8, _i9, _i10, _i11) |
| 814 |
| 815 /////////////////////////////////////////////////////////////////////////////// |
| 816 // Macros for implementing nsIClassInfo-related stuff. |
| 817 /////////////////////////////////////////////////////////////////////////////// |
| 818 |
| 819 // include here instead of at the top because it requires the nsISupport decl |
| 820 #include "nsIClassInfo.h" |
| 821 |
| 822 #define NS_CLASSINFO_NAME(_class) _class##_classInfoGlobal |
| 823 #define NS_CI_INTERFACE_GETTER_NAME(_class) _class##_GetInterfacesHelper |
| 824 |
| 825 #define NS_DECL_CI_INTERFACE_GETTER(_class) \ |
| 826 extern NS_IMETHODIMP NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *, \ |
| 827 nsIID ***); |
| 828 |
| 829 #define NS_DECL_CLASSINFO(_class) \ |
| 830 NS_DECL_CI_INTERFACE_GETTER(_class) \ |
| 831 nsIClassInfo *NS_CLASSINFO_NAME(_class); |
| 832 |
| 833 #define NS_IMPL_QUERY_CLASSINFO(_class) \ |
| 834 if ( aIID.Equals(NS_GET_IID(nsIClassInfo)) ) { \ |
| 835 extern nsIClassInfo *NS_CLASSINFO_NAME(_class); \ |
| 836 foundInterface = NS_STATIC_CAST(nsIClassInfo*, NS_CLASSINFO_NAME(_class));\ |
| 837 } else |
| 838 |
| 839 #define NS_CLASSINFO_HELPER_BEGIN(_class, _c) \ |
| 840 NS_IMETHODIMP \ |
| 841 NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *count, nsIID ***array) \ |
| 842 { \ |
| 843 *count = _c; \ |
| 844 *array = (nsIID **)nsMemory::Alloc(sizeof (nsIID *) * _c); |
| 845 |
| 846 #define NS_CLASSINFO_HELPER_ENTRY(_i, _interface) \ |
| 847 (*array)[_i] = (nsIID *)nsMemory::Clone(&NS_GET_IID(_interface), \ |
| 848 sizeof(nsIID)); |
| 849 |
| 850 #define NS_CLASSINFO_HELPER_END \ |
| 851 return NS_OK; \ |
| 852 } |
| 853 |
| 854 #define NS_IMPL_CI_INTERFACE_GETTER1(_class, _interface) \ |
| 855 NS_CLASSINFO_HELPER_BEGIN(_class, 1) \ |
| 856 NS_CLASSINFO_HELPER_ENTRY(0, _interface) \ |
| 857 NS_CLASSINFO_HELPER_END |
| 858 |
| 859 #define NS_IMPL_QUERY_INTERFACE1_CI(_class, _i1) \ |
| 860 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 861 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 862 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 863 NS_IMPL_QUERY_CLASSINFO(_class) \ |
| 864 NS_INTERFACE_MAP_END |
| 865 |
| 866 #define NS_IMPL_ISUPPORTS1_CI(_class, _interface) \ |
| 867 NS_IMPL_ADDREF(_class) \ |
| 868 NS_IMPL_RELEASE(_class) \ |
| 869 NS_IMPL_QUERY_INTERFACE1_CI(_class, _interface) \ |
| 870 NS_IMPL_CI_INTERFACE_GETTER1(_class, _interface) |
| 871 |
| 872 #define NS_IMPL_CI_INTERFACE_GETTER2(_class, _i1, _i2) \ |
| 873 NS_CLASSINFO_HELPER_BEGIN(_class, 2) \ |
| 874 NS_CLASSINFO_HELPER_ENTRY(0, _i1) \ |
| 875 NS_CLASSINFO_HELPER_ENTRY(1, _i2) \ |
| 876 NS_CLASSINFO_HELPER_END |
| 877 |
| 878 #define NS_IMPL_QUERY_INTERFACE2_CI(_class, _i1, _i2) \ |
| 879 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 880 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 881 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 882 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 883 NS_IMPL_QUERY_CLASSINFO(_class) \ |
| 884 NS_INTERFACE_MAP_END |
| 885 |
| 886 #define NS_IMPL_ISUPPORTS2_CI(_class, _i1, _i2) \ |
| 887 NS_IMPL_ADDREF(_class) \ |
| 888 NS_IMPL_RELEASE(_class) \ |
| 889 NS_IMPL_QUERY_INTERFACE2_CI(_class, _i1, _i2) \ |
| 890 NS_IMPL_CI_INTERFACE_GETTER2(_class, _i1, _i2) |
| 891 |
| 892 #define NS_IMPL_CI_INTERFACE_GETTER3(_class, _i1, _i2, _i3) \ |
| 893 NS_CLASSINFO_HELPER_BEGIN(_class, 3) \ |
| 894 NS_CLASSINFO_HELPER_ENTRY(0, _i1) \ |
| 895 NS_CLASSINFO_HELPER_ENTRY(1, _i2) \ |
| 896 NS_CLASSINFO_HELPER_ENTRY(2, _i3) \ |
| 897 NS_CLASSINFO_HELPER_END |
| 898 |
| 899 #define NS_IMPL_QUERY_INTERFACE3_CI(_class, _i1, _i2, _i3) \ |
| 900 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 901 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 902 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 903 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 904 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 905 NS_IMPL_QUERY_CLASSINFO(_class) \ |
| 906 NS_INTERFACE_MAP_END |
| 907 |
| 908 #define NS_IMPL_ISUPPORTS3_CI(_class, _i1, _i2, _i3) \ |
| 909 NS_IMPL_ADDREF(_class) \ |
| 910 NS_IMPL_RELEASE(_class) \ |
| 911 NS_IMPL_QUERY_INTERFACE3_CI(_class, _i1, _i2, _i3) \ |
| 912 NS_IMPL_CI_INTERFACE_GETTER3(_class, _i1, _i2, _i3) |
| 913 |
| 914 #define NS_IMPL_CI_INTERFACE_GETTER4(_class, _i1, _i2, _i3, _i4) \ |
| 915 NS_CLASSINFO_HELPER_BEGIN(_class, 4) \ |
| 916 NS_CLASSINFO_HELPER_ENTRY(0, _i1) \ |
| 917 NS_CLASSINFO_HELPER_ENTRY(1, _i2) \ |
| 918 NS_CLASSINFO_HELPER_ENTRY(2, _i3) \ |
| 919 NS_CLASSINFO_HELPER_ENTRY(3, _i4) \ |
| 920 NS_CLASSINFO_HELPER_END |
| 921 |
| 922 #define NS_IMPL_QUERY_INTERFACE4_CI(_class, _i1, _i2, _i3, _i4) \ |
| 923 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 924 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 925 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 926 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 927 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 928 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 929 NS_IMPL_QUERY_CLASSINFO(_class) \ |
| 930 NS_INTERFACE_MAP_END |
| 931 |
| 932 #define NS_IMPL_ISUPPORTS4_CI(_class, _i1, _i2, _i3, _i4) \ |
| 933 NS_IMPL_ADDREF(_class) \ |
| 934 NS_IMPL_RELEASE(_class) \ |
| 935 NS_IMPL_QUERY_INTERFACE4_CI(_class, _i1, _i2, _i3, _i4) \ |
| 936 NS_IMPL_CI_INTERFACE_GETTER4(_class, _i1, _i2, _i3, _i4) |
| 937 |
| 938 #define NS_IMPL_CI_INTERFACE_GETTER5(_class, _i1, _i2, _i3, _i4, _i5) \ |
| 939 NS_CLASSINFO_HELPER_BEGIN(_class, 5) \ |
| 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_END |
| 946 |
| 947 #define NS_IMPL_QUERY_INTERFACE5_CI(_class, _i1, _i2, _i3, _i4, _i5) \ |
| 948 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 949 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 950 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 951 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 952 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 953 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 954 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 955 NS_IMPL_QUERY_CLASSINFO(_class) \ |
| 956 NS_INTERFACE_MAP_END |
| 957 |
| 958 #define NS_IMPL_ISUPPORTS5_CI(_class, _i1, _i2, _i3, _i4, _i5) \ |
| 959 NS_IMPL_ADDREF(_class) \ |
| 960 NS_IMPL_RELEASE(_class) \ |
| 961 NS_IMPL_QUERY_INTERFACE5_CI(_class, _i1, _i2, _i3, _i4, _i5) \ |
| 962 NS_IMPL_CI_INTERFACE_GETTER5(_class, _i1, _i2, _i3, _i4, _i5) |
| 963 |
| 964 #define NS_IMPL_CI_INTERFACE_GETTER6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \ |
| 965 NS_CLASSINFO_HELPER_BEGIN(_class, 6) \ |
| 966 NS_CLASSINFO_HELPER_ENTRY(0, _i1) \ |
| 967 NS_CLASSINFO_HELPER_ENTRY(1, _i2) \ |
| 968 NS_CLASSINFO_HELPER_ENTRY(2, _i3) \ |
| 969 NS_CLASSINFO_HELPER_ENTRY(3, _i4) \ |
| 970 NS_CLASSINFO_HELPER_ENTRY(4, _i5) \ |
| 971 NS_CLASSINFO_HELPER_ENTRY(5, _i6) \ |
| 972 NS_CLASSINFO_HELPER_END |
| 973 |
| 974 #define NS_IMPL_QUERY_INTERFACE6_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6) \ |
| 975 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 976 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 977 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 978 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 979 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 980 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 981 NS_INTERFACE_MAP_ENTRY(_i6) \ |
| 982 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 983 NS_IMPL_QUERY_CLASSINFO(_class) \ |
| 984 NS_INTERFACE_MAP_END |
| 985 |
| 986 #define NS_IMPL_ISUPPORTS6_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6) \ |
| 987 NS_IMPL_ADDREF(_class) \ |
| 988 NS_IMPL_RELEASE(_class) \ |
| 989 NS_IMPL_QUERY_INTERFACE6_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6) \ |
| 990 NS_IMPL_CI_INTERFACE_GETTER6(_class, _i1, _i2, _i3, _i4, _i5, _i6) |
| 991 |
| 992 #define NS_IMPL_CI_INTERFACE_GETTER7(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 993 _i7) \ |
| 994 NS_CLASSINFO_HELPER_BEGIN(_class, 7) \ |
| 995 NS_CLASSINFO_HELPER_ENTRY(0, _i1) \ |
| 996 NS_CLASSINFO_HELPER_ENTRY(1, _i2) \ |
| 997 NS_CLASSINFO_HELPER_ENTRY(2, _i3) \ |
| 998 NS_CLASSINFO_HELPER_ENTRY(3, _i4) \ |
| 999 NS_CLASSINFO_HELPER_ENTRY(4, _i5) \ |
| 1000 NS_CLASSINFO_HELPER_ENTRY(5, _i6) \ |
| 1001 NS_CLASSINFO_HELPER_ENTRY(6, _i7) \ |
| 1002 NS_CLASSINFO_HELPER_END |
| 1003 |
| 1004 #define NS_IMPL_QUERY_INTERFACE7_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 1005 _i7) \ |
| 1006 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 1007 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 1008 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 1009 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 1010 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 1011 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 1012 NS_INTERFACE_MAP_ENTRY(_i6) \ |
| 1013 NS_INTERFACE_MAP_ENTRY(_i7) \ |
| 1014 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 1015 NS_IMPL_QUERY_CLASSINFO(_class) \ |
| 1016 NS_INTERFACE_MAP_END |
| 1017 |
| 1018 #define NS_IMPL_ISUPPORTS7_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \ |
| 1019 NS_IMPL_ADDREF(_class) \ |
| 1020 NS_IMPL_RELEASE(_class) \ |
| 1021 NS_IMPL_QUERY_INTERFACE7_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \ |
| 1022 NS_IMPL_CI_INTERFACE_GETTER7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) |
| 1023 |
| 1024 #define NS_IMPL_CI_INTERFACE_GETTER8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 1025 _i7, _i8) \ |
| 1026 NS_CLASSINFO_HELPER_BEGIN(_class, 8) \ |
| 1027 NS_CLASSINFO_HELPER_ENTRY(0, _i1) \ |
| 1028 NS_CLASSINFO_HELPER_ENTRY(1, _i2) \ |
| 1029 NS_CLASSINFO_HELPER_ENTRY(2, _i3) \ |
| 1030 NS_CLASSINFO_HELPER_ENTRY(3, _i4) \ |
| 1031 NS_CLASSINFO_HELPER_ENTRY(4, _i5) \ |
| 1032 NS_CLASSINFO_HELPER_ENTRY(5, _i6) \ |
| 1033 NS_CLASSINFO_HELPER_ENTRY(6, _i7) \ |
| 1034 NS_CLASSINFO_HELPER_ENTRY(7, _i8) \ |
| 1035 NS_CLASSINFO_HELPER_END |
| 1036 |
| 1037 #define NS_IMPL_QUERY_INTERFACE8_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 1038 _i7, _i8) \ |
| 1039 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 1040 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 1041 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 1042 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 1043 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 1044 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 1045 NS_INTERFACE_MAP_ENTRY(_i6) \ |
| 1046 NS_INTERFACE_MAP_ENTRY(_i7) \ |
| 1047 NS_INTERFACE_MAP_ENTRY(_i8) \ |
| 1048 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 1049 NS_IMPL_QUERY_CLASSINFO(_class) \ |
| 1050 NS_INTERFACE_MAP_END |
| 1051 |
| 1052 #define NS_IMPL_ISUPPORTS8_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \ |
| 1053 NS_IMPL_ADDREF(_class) \ |
| 1054 NS_IMPL_RELEASE(_class) \ |
| 1055 NS_IMPL_QUERY_INTERFACE8_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \ |
| 1056 NS_IMPL_CI_INTERFACE_GETTER8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) |
| 1057 |
| 1058 #define NS_IMPL_CI_INTERFACE_GETTER9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 1059 _i7, _i8, _i9) \ |
| 1060 NS_CLASSINFO_HELPER_BEGIN(_class, 9) \ |
| 1061 NS_CLASSINFO_HELPER_ENTRY(0, _i1) \ |
| 1062 NS_CLASSINFO_HELPER_ENTRY(1, _i2) \ |
| 1063 NS_CLASSINFO_HELPER_ENTRY(2, _i3) \ |
| 1064 NS_CLASSINFO_HELPER_ENTRY(3, _i4) \ |
| 1065 NS_CLASSINFO_HELPER_ENTRY(4, _i5) \ |
| 1066 NS_CLASSINFO_HELPER_ENTRY(5, _i6) \ |
| 1067 NS_CLASSINFO_HELPER_ENTRY(6, _i7) \ |
| 1068 NS_CLASSINFO_HELPER_ENTRY(7, _i8) \ |
| 1069 NS_CLASSINFO_HELPER_ENTRY(8, _i9) \ |
| 1070 NS_CLASSINFO_HELPER_END |
| 1071 |
| 1072 #define NS_IMPL_QUERY_INTERFACE9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 1073 _i7, _i8, _i9) \ |
| 1074 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 1075 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 1076 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 1077 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 1078 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 1079 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 1080 NS_INTERFACE_MAP_ENTRY(_i6) \ |
| 1081 NS_INTERFACE_MAP_ENTRY(_i7) \ |
| 1082 NS_INTERFACE_MAP_ENTRY(_i8) \ |
| 1083 NS_INTERFACE_MAP_ENTRY(_i9) \ |
| 1084 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 1085 NS_IMPL_QUERY_CLASSINFO(_class) \ |
| 1086 NS_INTERFACE_MAP_END |
| 1087 |
| 1088 #define NS_IMPL_ISUPPORTS9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \ |
| 1089 _i8, _i9) \ |
| 1090 NS_IMPL_ADDREF(_class) \ |
| 1091 NS_IMPL_RELEASE(_class) \ |
| 1092 NS_IMPL_QUERY_INTERFACE9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \ |
| 1093 _i8, _i9) \ |
| 1094 NS_IMPL_CI_INTERFACE_GETTER9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \ |
| 1095 _i8, _i9) |
| 1096 |
| 1097 #define NS_IMPL_CI_INTERFACE_GETTER10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 1098 _i7, _i8, _i9, _i10) \ |
| 1099 NS_CLASSINFO_HELPER_BEGIN(_class, 10) \ |
| 1100 NS_CLASSINFO_HELPER_ENTRY(0, _i1) \ |
| 1101 NS_CLASSINFO_HELPER_ENTRY(1, _i2) \ |
| 1102 NS_CLASSINFO_HELPER_ENTRY(2, _i3) \ |
| 1103 NS_CLASSINFO_HELPER_ENTRY(3, _i4) \ |
| 1104 NS_CLASSINFO_HELPER_ENTRY(4, _i5) \ |
| 1105 NS_CLASSINFO_HELPER_ENTRY(5, _i6) \ |
| 1106 NS_CLASSINFO_HELPER_ENTRY(6, _i7) \ |
| 1107 NS_CLASSINFO_HELPER_ENTRY(7, _i8) \ |
| 1108 NS_CLASSINFO_HELPER_ENTRY(8, _i9) \ |
| 1109 NS_CLASSINFO_HELPER_ENTRY(9, _i10) \ |
| 1110 NS_CLASSINFO_HELPER_END |
| 1111 |
| 1112 #define NS_IMPL_CI_INTERFACE_GETTER11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 1113 _i7, _i8, _i9, _i10, _i11) \ |
| 1114 NS_CLASSINFO_HELPER_BEGIN(_class, 11) \ |
| 1115 NS_CLASSINFO_HELPER_ENTRY(0, _i1) \ |
| 1116 NS_CLASSINFO_HELPER_ENTRY(1, _i2) \ |
| 1117 NS_CLASSINFO_HELPER_ENTRY(2, _i3) \ |
| 1118 NS_CLASSINFO_HELPER_ENTRY(3, _i4) \ |
| 1119 NS_CLASSINFO_HELPER_ENTRY(4, _i5) \ |
| 1120 NS_CLASSINFO_HELPER_ENTRY(5, _i6) \ |
| 1121 NS_CLASSINFO_HELPER_ENTRY(6, _i7) \ |
| 1122 NS_CLASSINFO_HELPER_ENTRY(7, _i8) \ |
| 1123 NS_CLASSINFO_HELPER_ENTRY(8, _i9) \ |
| 1124 NS_CLASSINFO_HELPER_ENTRY(9, _i10) \ |
| 1125 NS_CLASSINFO_HELPER_ENTRY(10, _i11) \ |
| 1126 NS_CLASSINFO_HELPER_END |
| 1127 |
| 1128 #define NS_IMPL_QUERY_INTERFACE10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 1129 _i7, _i8, _i9, _i10) \ |
| 1130 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 1131 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 1132 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 1133 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 1134 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 1135 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 1136 NS_INTERFACE_MAP_ENTRY(_i6) \ |
| 1137 NS_INTERFACE_MAP_ENTRY(_i7) \ |
| 1138 NS_INTERFACE_MAP_ENTRY(_i8) \ |
| 1139 NS_INTERFACE_MAP_ENTRY(_i9) \ |
| 1140 NS_INTERFACE_MAP_ENTRY(_i10) \ |
| 1141 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 1142 NS_IMPL_QUERY_CLASSINFO(_class) \ |
| 1143 NS_INTERFACE_MAP_END |
| 1144 |
| 1145 #define NS_IMPL_QUERY_INTERFACE11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ |
| 1146 _i7, _i8, _i9, _i10, _i11) \ |
| 1147 NS_INTERFACE_MAP_BEGIN(_class) \ |
| 1148 NS_INTERFACE_MAP_ENTRY(_i1) \ |
| 1149 NS_INTERFACE_MAP_ENTRY(_i2) \ |
| 1150 NS_INTERFACE_MAP_ENTRY(_i3) \ |
| 1151 NS_INTERFACE_MAP_ENTRY(_i4) \ |
| 1152 NS_INTERFACE_MAP_ENTRY(_i5) \ |
| 1153 NS_INTERFACE_MAP_ENTRY(_i6) \ |
| 1154 NS_INTERFACE_MAP_ENTRY(_i7) \ |
| 1155 NS_INTERFACE_MAP_ENTRY(_i8) \ |
| 1156 NS_INTERFACE_MAP_ENTRY(_i9) \ |
| 1157 NS_INTERFACE_MAP_ENTRY(_i10) \ |
| 1158 NS_INTERFACE_MAP_ENTRY(_i11) \ |
| 1159 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \ |
| 1160 NS_IMPL_QUERY_CLASSINFO(_class) \ |
| 1161 NS_INTERFACE_MAP_END |
| 1162 |
| 1163 #define NS_IMPL_ISUPPORTS10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \ |
| 1164 _i8, _i9, _i10) \ |
| 1165 NS_IMPL_ADDREF(_class) \ |
| 1166 NS_IMPL_RELEASE(_class) \ |
| 1167 NS_IMPL_QUERY_INTERFACE10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \ |
| 1168 _i8, _i9, _i10) \ |
| 1169 NS_IMPL_CI_INTERFACE_GETTER10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \ |
| 1170 _i8, _i9, _i10) |
| 1171 |
| 1172 #define NS_IMPL_ISUPPORTS11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \ |
| 1173 _i8, _i9, _i10, _i11) \ |
| 1174 NS_IMPL_ADDREF(_class) \ |
| 1175 NS_IMPL_RELEASE(_class) \ |
| 1176 NS_IMPL_QUERY_INTERFACE11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \ |
| 1177 _i8, _i9, _i10, _i11) \ |
| 1178 NS_IMPL_CI_INTERFACE_GETTER11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \ |
| 1179 _i8, _i9, _i10, _i11) |
| 1180 |
| 1181 #define NS_INTERFACE_MAP_END_THREADSAFE NS_IMPL_QUERY_TAIL_GUTS |
| 1182 |
| 1183 #endif |
OLD | NEW |