diff --git a/mozilla/xpcom/glue/Makefile.in b/mozilla/xpcom/glue/Makefile.in index 0e59db6e7ad..c52791542b1 100644 --- a/mozilla/xpcom/glue/Makefile.in +++ b/mozilla/xpcom/glue/Makefile.in @@ -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) diff --git a/mozilla/xpcom/proxy/src/nsProxyRelease.cpp b/mozilla/xpcom/glue/nsProxyRelease.cpp similarity index 100% rename from mozilla/xpcom/proxy/src/nsProxyRelease.cpp rename to mozilla/xpcom/glue/nsProxyRelease.cpp diff --git a/mozilla/xpcom/proxy/public/nsProxyRelease.h b/mozilla/xpcom/glue/nsProxyRelease.h similarity index 77% rename from mozilla/xpcom/proxy/public/nsProxyRelease.h rename to mozilla/xpcom/glue/nsProxyRelease.h index 5253f7e30fb..8358bf70a4d 100644 --- a/mozilla/xpcom/proxy/public/nsProxyRelease.h +++ b/mozilla/xpcom/glue/nsProxyRelease.h @@ -20,6 +20,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Benjamin Smedberg * * 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 +inline NS_HIDDEN_(nsresult) +NS_ProxyRelease + (nsIEventTarget *target, nsCOMPtr &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 diff --git a/mozilla/xpcom/glue/objs.mk b/mozilla/xpcom/glue/objs.mk index 0830e8b29f1..bdf19353432 100644 --- a/mozilla/xpcom/glue/objs.mk +++ b/mozilla/xpcom/glue/objs.mk @@ -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)) diff --git a/mozilla/xpcom/proxy/public/Makefile.in b/mozilla/xpcom/proxy/public/Makefile.in index 77c62a8f7ad..aa01a8e981e 100644 --- a/mozilla/xpcom/proxy/public/Makefile.in +++ b/mozilla/xpcom/proxy/public/Makefile.in @@ -50,7 +50,6 @@ XPIDL_MODULE = proxyObjInst endif EXPORTS = \ - nsProxyRelease.h \ nsProxiedService.h \ $(NULL) diff --git a/mozilla/xpcom/proxy/src/Makefile.in b/mozilla/xpcom/proxy/src/Makefile.in index 93ab33ac2a7..07320eddca2 100644 --- a/mozilla/xpcom/proxy/src/Makefile.in +++ b/mozilla/xpcom/proxy/src/Makefile.in @@ -54,7 +54,6 @@ CPPSRCS = \ nsProxyEventClass.cpp \ nsProxyEventObject.cpp \ nsProxyObjectManager.cpp \ - nsProxyRelease.cpp \ $(NULL) DEFINES += -D_IMPL_NS_COM -DEXPORT_XPTC_API