зеркало из https://github.com/mozilla/gecko-dev.git
Log addref/release for nsHostResolver and nsHostRecord. Bug 302724, r+sr=darin
This commit is contained in:
Родитель
ad6fcd5dfd
Коммит
b511cb188c
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче