merge
authorDaniel Holbert <dholbert@cs.stanford.edu>
Thu, 01 Apr 2010 09:45:19 -0700
changeset 40103 4bd4aee44c44542bbdcf469e6158f3285d6bdfd2
parent 40101 223913ea24067f98c282c728d49303e02da87dae (current diff)
parent 40102 df2717c37e7f70da06d2e1f46a288743b3414264 (diff)
child 40104 b6ed13dd46cb8ffe639c9f2de00318f470f92826
push idunknown
push userunknown
push dateunknown
milestone1.9.3a4pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
merge
gfx/thebes/public/gfxTypes.h
xpcom/glue/nsISupportsImpl.h
--- a/gfx/thebes/public/gfxTypes.h
+++ b/gfx/thebes/public/gfxTypes.h
@@ -93,17 +93,37 @@ enum gfxBreakPriority {
 /**
  * Define refcounting for Thebes.  For now use the stuff from nsISupportsImpl
  * even though it forces the functions to be virtual...
  */
 #include "nsISupportsImpl.h"
 #include "nsAutoPtr.h"
 
 #define THEBES_INLINE_DECL_REFCOUNTING(_class)                                \
-    NS_INLINE_DECL_REFCOUNTING(_class)
+public:                                                                       \
+    nsrefcnt AddRef(void) {                                                   \
+        NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt");             \
+        ++mRefCnt;                                                            \
+        NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this));                 \
+        return mRefCnt;                                                       \
+    }                                                                         \
+    nsrefcnt Release(void) {                                                  \
+        NS_PRECONDITION(0 != mRefCnt, "dup release");                         \
+        --mRefCnt;                                                            \
+        NS_LOG_RELEASE(this, mRefCnt, #_class);                               \
+        if (mRefCnt == 0) {                                                   \
+            mRefCnt = 1; /* stabilize */                                      \
+            NS_DELETEXPCOM(this);                                             \
+            return 0;                                                         \
+        }                                                                     \
+        return mRefCnt;                                                       \
+    }                                                                         \
+protected:                                                                    \
+    nsAutoRefCnt mRefCnt;                                                     \
+public:
 
 #define THEBES_INLINE_DECL_THREADSAFE_REFCOUNTING(_class)                     \
 public:                                                                       \
     nsrefcnt AddRef(void) {                                                   \
         NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt");             \
         nsrefcnt count = PR_AtomicIncrement((PRInt32*)&mRefCnt);              \
         NS_LOG_ADDREF(this, count, #_class, sizeof(*this));                   \
         return count;                                                         \
--- a/xpcom/glue/nsISupportsImpl.h
+++ b/xpcom/glue/nsISupportsImpl.h
@@ -299,45 +299,16 @@ public:
 /**
  * Previously used to initialize the reference count, but no longer needed.
  *
  * DEPRECATED.
  */
 #define NS_INIT_ISUPPORTS() ((void)0)
 
 /**
- * Use this macro to declare and implement the AddRef & Release methods for a
- * given non-XPCOM <i>_class</i>.
- *
- * The implementations here should match NS_IMPL_ADDREF/NS_IMPL_RELEASE, minus
- * the nsrefcnt return-value and the NS_ASSERT_OWNINGTHREAD() call.
- *
- * @param _class The name of the class implementing the method
- */
-#define NS_INLINE_DECL_REFCOUNTING(_class)                                    \
-public:                                                                       \
-  void AddRef(void) {                                                         \
-    NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt");                 \
-    ++mRefCnt;                                                                \
-    NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this));                     \
-  }                                                                           \
-  void Release(void) {                                                        \
-    NS_PRECONDITION(0 != mRefCnt, "dup release");                             \
-    --mRefCnt;                                                                \
-    NS_LOG_RELEASE(this, mRefCnt, #_class);                                   \
-    if (mRefCnt == 0) {                                                       \
-      mRefCnt = 1; /* stabilize */                                            \
-      NS_DELETEXPCOM(this);                                                   \
-    }                                                                         \
-  }                                                                           \
-protected:                                                                    \
-  nsAutoRefCnt mRefCnt;                                                       \
-public:
-
-/**
  * Use this macro to implement the AddRef method for a given <i>_class</i>
  * @param _class The name of the class implementing the method
  */
 #define NS_IMPL_ADDREF(_class)                                                \
 NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void)                                 \
 {                                                                             \
   NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt");                   \
   NS_ASSERT_OWNINGTHREAD(_class);                                             \
--- a/xpcom/glue/nsISupportsUtils.h
+++ b/xpcom/glue/nsISupportsUtils.h
@@ -103,22 +103,20 @@ extern "C++" {
 // ...because some one is accidentally including this file inside
 // an |extern "C"|
 
 
 // Making this a |inline| |template| allows |expr| to be evaluated only once,
 // yet still denies you the ability to |AddRef()| an |nsCOMPtr|.
 template <class T>
 inline
-void
+nsrefcnt
 ns_if_addref( T expr )
 {
-    if (expr) {
-        expr->AddRef();
-    }
+    return expr ? expr->AddRef() : 0;
 }
 
 } /* extern "C++" */
 
 /**
  * Macro for adding a reference to an interface that checks for NULL.
  * @param _expr The interface pointer.
  */