Bug 299664 - add support for XPCOM_GLUE_USE_NSPR for various embedders who need to continue using the THREADSAFE_ISUPPORTS macros and don't care about the NSPR dependency, r=darin a=asa

This commit is contained in:
bsmedberg%covad.net 2005-07-07 15:40:24 +00:00
Родитель 815892fa38
Коммит 9a61950459
1 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -45,10 +45,17 @@
#include "nsISupportsBase.h"
#endif
#ifndef XPCOM_GLUE
#if defined(XPCOM_GLUE) && !defined(XPCOM_GLUE_USE_NSPR)
// If we're being linked as standalone glue, we don't want a dynamic dependency
// on NSPR libs, so we skip the debug thread-safety checks.
// on NSPR libs, so we skip the debug thread-safety checks, and we cannot use
// the THREADSAFE_ISUPPORTS macros.
#define XPCOM_GLUE_AVOID_NSPR
#endif
#if !defined(XPCOM_GLUE_AVOID_NSPR)
#include "prthread.h" /* needed for thread-safety checks */
#include "pratom.h" /* needed for PR_AtomicIncrement and PR_AtomicDecrement */
#endif
@ -59,7 +66,7 @@
////////////////////////////////////////////////////////////////////////////////
// Macros to help detect thread-safety:
#if defined(NS_DEBUG) && !defined(XPCOM_GLUE)
#if defined(NS_DEBUG) && !defined(XPCOM_GLUE_AVOID_NSPR)
class nsAutoOwningThread {
public:
@ -74,12 +81,12 @@ private:
#define NS_ASSERT_OWNINGTHREAD(_class) \
NS_CheckThreadSafe(_mOwningThread.GetThread(), #_class " not thread-safe")
#else // !(defined(NS_DEBUG) && !defined(XPCOM_GLUE))
#else // !NS_DEBUG
#define NS_DECL_OWNINGTHREAD /* nothing */
#define NS_ASSERT_OWNINGTHREAD(_class) ((void)0)
#endif // !(defined(NS_DEBUG))
#endif // NS_DEBUG
class nsAutoRefCnt {
@ -686,7 +693,7 @@ NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \
* because the implementation requires PR_ symbols.
*/
#ifndef XPCOM_GLUE
#if !defined(XPCOM_GLUE_AVOID_NSPR)
/**
* Use this macro to implement the AddRef method for a given <i>_class</i>
@ -725,14 +732,15 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
return count; \
}
#else // XPCOM_GLUE
#else // XPCOM_GLUE_AVOID_NSPR
#define NS_IMPL_THREADSAFE_ADDREF(_class) \
THREADSAFE_ISUPPORTS_NOT_AVAILABLE_IN_STANDALONE_GLUE;
#define NS_IMPL_THREADSAFE_RELEASE(_class) \
THREADSAFE_ISUPPORTS_NOT_AVAILABLE_IN_STANDALONE_GLUE;
#endif // XPCOM_GLUE
#endif
#define NS_IMPL_THREADSAFE_ISUPPORTS0(_class) \
NS_IMPL_THREADSAFE_ADDREF(_class) \