Log addref/release for nsHostResolver and nsHostRecord. Bug 302724, r+sr=darin

This commit is contained in:
bzbarsky%mit.edu 2005-11-15 17:30:50 +00:00
Родитель ad6fcd5dfd
Коммит b511cb188c
1 изменённых файлов: 17 добавлений и 14 удалений

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

@ -51,18 +51,21 @@ class nsHostRecord;
class nsResolveHostCallback;
/* XXX move this someplace more generic */
#define NS_DECL_REFCOUNTED_THREADSAFE \
private: \
nsAutoRefCnt _refc; \
public: \
PRInt32 AddRef() { \
return PR_AtomicIncrement((PRInt32*)&_refc); \
} \
PRInt32 Release() { \
PRInt32 n = PR_AtomicDecrement((PRInt32*)&_refc); \
if (n == 0) \
delete this; \
return n; \
#define NS_DECL_REFCOUNTED_THREADSAFE(classname) \
private: \
nsAutoRefCnt _refc; \
public: \
PRInt32 AddRef() { \
PRInt32 n = PR_AtomicIncrement((PRInt32*)&_refc); \
NS_LOG_ADDREF(this, n, #classname, sizeof(classname)); \
return n; \
} \
PRInt32 Release() { \
PRInt32 n = PR_AtomicDecrement((PRInt32*)&_refc); \
NS_LOG_RELEASE(this, n, #classname); \
if (n == 0) \
delete this; \
return n; \
}
struct nsHostKey
@ -78,7 +81,7 @@ struct nsHostKey
class nsHostRecord : public PRCList, public nsHostKey
{
public:
NS_DECL_REFCOUNTED_THREADSAFE
NS_DECL_REFCOUNTED_THREADSAFE(nsHostRecord)
/* instantiates a new host record */
static nsresult Create(const nsHostKey *key, nsHostRecord **record);
@ -148,7 +151,7 @@ public:
/**
* host resolver instances are reference counted.
*/
NS_DECL_REFCOUNTED_THREADSAFE
NS_DECL_REFCOUNTED_THREADSAFE(nsHostResolver)
/**
* creates an addref'd instance of a nsHostResolver object.