* Changes to observers and service manager APIs.

* Use nsIComponentManagerObsolete.
* Fix weak reference leaks
* Cache interface infos better for significant perf increase.
* Better tests for leaks

Not part of the build.


git-svn-id: svn://10.0.0.236/trunk@111534 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
markh%activestate.com
2002-01-08 01:58:58 +00:00
parent 12ab2a809c
commit 2e157b2b2a
14 changed files with 217 additions and 77 deletions

View File

@@ -34,6 +34,14 @@ PyXPCOM_GatewayWeakReference::PyXPCOM_GatewayWeakReference( PyG_Base *base )
{
m_pBase = base;
NS_INIT_REFCNT();
#ifdef NS_BUILD_REFCNT_LOGGING
// bloat view uses 40 chars - stick "(WR)" at the end of this position.
strncpy(refcntLogRepr, m_pBase->refcntLogRepr, sizeof(refcntLogRepr));
refcntLogRepr[sizeof(refcntLogRepr)-1] = '\0';
char *dest = refcntLogRepr + ((strlen(refcntLogRepr) > 36) ? 36 : strlen(refcntLogRepr));
strcpy(dest, "(WR)");
#endif // NS_BUILD_REFCNT_LOGGING
}
PyXPCOM_GatewayWeakReference::~PyXPCOM_GatewayWeakReference()
@@ -45,7 +53,29 @@ PyXPCOM_GatewayWeakReference::~PyXPCOM_GatewayWeakReference()
m_pBase = NULL;
}
NS_IMPL_THREADSAFE_ISUPPORTS1(PyXPCOM_GatewayWeakReference, nsIWeakReference)
nsrefcnt
PyXPCOM_GatewayWeakReference::AddRef(void)
{
nsrefcnt cnt = (nsrefcnt) PR_AtomicIncrement((PRInt32*)&mRefCnt);
#ifdef NS_BUILD_REFCNT_LOGGING
NS_LOG_ADDREF(this, cnt, refcntLogRepr, sizeof(*this));
#endif
return cnt;
}
nsrefcnt
PyXPCOM_GatewayWeakReference::Release(void)
{
nsrefcnt cnt = (nsrefcnt) PR_AtomicDecrement((PRInt32*)&mRefCnt);
#ifdef NS_BUILD_REFCNT_LOGGING
NS_LOG_RELEASE(this, cnt, refcntLogRepr);
#endif
if ( cnt == 0 )
delete this;
return cnt;
}
NS_IMPL_THREADSAFE_QUERY_INTERFACE1(PyXPCOM_GatewayWeakReference, nsIWeakReference);
NS_IMETHODIMP
PyXPCOM_GatewayWeakReference::QueryReferent(REFNSIID iid, void * *ret)