Bug 338734 - Make nsProxyRelease available to frozen-linkage code, r=darin

git-svn-id: svn://10.0.0.236/trunk@198151 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
benjamin%smedbergs.us
2006-05-22 14:19:13 +00:00
parent 36f2699cdb
commit 2ccd07283d
6 changed files with 31 additions and 8 deletions

View File

@@ -86,7 +86,6 @@ SDK_HEADERS = \
nsTHashtable.h \
nsVoidArray.h \
nsTArray.h \
nsThreadUtils.h \
nsTWeakRef.h \
nsID.h \
nsIGenericFactory.h \
@@ -107,6 +106,11 @@ SDK_HEADERS = \
nsIClassInfoImpl.h \
$(NULL)
EXPORTS = \
nsThreadUtils.h \
nsProxyRelease.h \
$(NULL)
SDK_LIBRARY = \
$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(NULL)

View File

@@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Benjamin Smedberg <benjamin@smedbergs.us>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@@ -39,8 +40,26 @@
#define nsProxyRelease_h__
#include "nsIEventTarget.h"
#include "pratom.h"
#include "prmem.h"
#include "nsCOMPtr.h"
#ifdef XPCOM_GLUE_AVOID_NSPR
#error NS_ProxyRelease implementation depends on NSPR.
#endif
/**
* Ensure that a nsCOMPtr is released on the target thread.
*
* @see NS_ProxyRelease(nsIEventTarget*, nsISupports*, PRBool)
*/
template <class T>
inline NS_HIDDEN_(nsresult)
NS_ProxyRelease
(nsIEventTarget *target, nsCOMPtr<T> &doomed, PRBool alwaysProxy=PR_FALSE)
{
T* raw = nsnull;
doomed.swap(raw);
return NS_ProxyRelease(target, doomed, alwaysProxy);
}
/**
* Ensures that the delete of a nsISupports object occurs on the target thread.
@@ -52,10 +71,11 @@
* @param alwaysProxy
* normally, if NS_ProxyRelease is called on the target thread, then the
* doomed object will released directly. however, if this parameter is
* true, then a PLEvent will always be posted to the target thread and
* the release will happen when that PLEvent is handled.
* true, then an event will always be posted to the target thread for
* asynchronous release.
*/
NS_COM nsresult NS_ProxyRelease
NS_COM_GLUE nsresult
NS_ProxyRelease
(nsIEventTarget *target, nsISupports *doomed, PRBool alwaysProxy=PR_FALSE);
#endif

View File

@@ -69,6 +69,7 @@ XPCOM_GLUE_SRC_CPPSRCS = $(addprefix $(topsrcdir)/xpcom/glue/, $(XPCOM_GLUE_SRC_
XPCOM_GLUENS_SRC_LCPPSRCS = \
nsGenericFactory.cpp \
nsProxyRelease.cpp \
$(NULL)
XPCOM_GLUENS_SRC_CPPSRCS = $(addprefix $(topsrcdir)/xpcom/glue/,$(XPCOM_GLUENS_SRC_LCPPSRCS))

View File

@@ -50,7 +50,6 @@ XPIDL_MODULE = proxyObjInst
endif
EXPORTS = \
nsProxyRelease.h \
nsProxiedService.h \
$(NULL)

View File

@@ -54,7 +54,6 @@ CPPSRCS = \
nsProxyEventClass.cpp \
nsProxyEventObject.cpp \
nsProxyObjectManager.cpp \
nsProxyRelease.cpp \
$(NULL)
DEFINES += -D_IMPL_NS_COM -DEXPORT_XPTC_API