mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Make refcount logging usable from C. b=317481 r=bsmedberg
This commit is contained in:
parent
5659c2fa63
commit
ec43dae0ab
@ -40,20 +40,18 @@
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
|
||||
class nsISupports;
|
||||
|
||||
// By default refcnt logging is not part of the build.
|
||||
/* By default refcnt logging is not part of the build. */
|
||||
#undef NS_BUILD_REFCNT_LOGGING
|
||||
|
||||
#if (defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING))
|
||||
// Make refcnt logging part of the build. This doesn't mean that
|
||||
// actual logging will occur (that requires a separate enable; see
|
||||
// nsTraceRefcnt.h for more information).
|
||||
/* Make refcnt logging part of the build. This doesn't mean that
|
||||
* actual logging will occur (that requires a separate enable; see
|
||||
* nsTraceRefcnt.h for more information). */
|
||||
#define NS_BUILD_REFCNT_LOGGING 1
|
||||
#endif
|
||||
|
||||
// If NO_BUILD_REFCNT_LOGGING is defined then disable refcnt logging
|
||||
// in the build. This overrides FORCE_BUILD_REFCNT_LOGGING.
|
||||
/* If NO_BUILD_REFCNT_LOGGING is defined then disable refcnt logging
|
||||
* in the build. This overrides FORCE_BUILD_REFCNT_LOGGING. */
|
||||
#if defined(NO_BUILD_REFCNT_LOGGING)
|
||||
#undef NS_BUILD_REFCNT_LOGGING
|
||||
#endif
|
||||
@ -78,9 +76,9 @@ PR_BEGIN_MACRO \
|
||||
NS_LogDtor((void*)this, #_type, sizeof(*this)); \
|
||||
PR_END_MACRO
|
||||
|
||||
// nsCOMPtr.h allows these macros to be defined by clients
|
||||
// These logging functions require dynamic_cast<void *>, so we don't
|
||||
// define these macros if we don't have dynamic_cast.
|
||||
/* nsCOMPtr.h allows these macros to be defined by clients
|
||||
* These logging functions require dynamic_cast<void*>, so they don't
|
||||
* do anything useful if we don't have dynamic_cast<void*>. */
|
||||
#define NSCAP_LOG_ASSIGNMENT(_c, _p) \
|
||||
if (_p) \
|
||||
NS_LogCOMPtrAddRef((_c),NS_STATIC_CAST(nsISupports*,_p))
|
||||
@ -99,6 +97,8 @@ PR_END_MACRO
|
||||
|
||||
#endif /* NS_BUILD_REFCNT_LOGGING */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
class nsTraceRefcnt {
|
||||
public:
|
||||
inline static void LogAddRef(void* aPtr, nsrefcnt aNewRefCnt,
|
||||
@ -130,4 +130,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* defined(__cplusplus) */
|
||||
|
||||
#endif /* nsTraceRefcnt_h___ */
|
||||
|
Loading…
Reference in New Issue
Block a user