diff --git a/mozilla/xpcom/proxy/public/nsIProxyObjectManager.idl b/mozilla/xpcom/proxy/public/nsIProxyObjectManager.idl index 723d2e4b7f1..16f2e5e3b9c 100644 --- a/mozilla/xpcom/proxy/public/nsIProxyObjectManager.idl +++ b/mozilla/xpcom/proxy/public/nsIProxyObjectManager.idl @@ -93,9 +93,7 @@ interface nsIProxyObjectManager : nsISupports * Identifies the interface being proxied. The given object must QI to * this type. * @param object - * The object being proxied. The AddRef and QueryInterface methods for - * this object will be called on the current thread, but this object will - * only be released on the target thread. + * The object being proxied. * @param proxyType * Specifies the type of proxy to construct. Either INVOKE_SYNC or * INVOKE_ASYNC must be specified. FORCE_PROXY_CREATION may be bit-wise diff --git a/mozilla/xpcom/proxy/src/nsProxyEvent.cpp b/mozilla/xpcom/proxy/src/nsProxyEvent.cpp index 525f93e612f..41277034601 100644 --- a/mozilla/xpcom/proxy/src/nsProxyEvent.cpp +++ b/mozilla/xpcom/proxy/src/nsProxyEvent.cpp @@ -52,7 +52,6 @@ #include "nsProxyEvent.h" #include "nsProxyEventPrivate.h" -#include "nsProxyRelease.h" #include "nsIProxyObjectManager.h" #include "nsCRT.h" @@ -422,12 +421,7 @@ nsProxyObject::~nsProxyObject() // I am worried about order of destruction here. // do not remove assignments. - // Proxy the release of mRealObject to protect against it being deleted on - // the wrong thread. - nsISupports *doomed = nsnull; - mRealObject.swap(doomed); - NS_ProxyRelease(mTarget, doomed); - + mRealObject = 0; mTarget = 0; } diff --git a/mozilla/xpcom/proxy/src/nsProxyEventObject.cpp b/mozilla/xpcom/proxy/src/nsProxyEventObject.cpp index e9625480098..f1c577dbf4e 100644 --- a/mozilla/xpcom/proxy/src/nsProxyEventObject.cpp +++ b/mozilla/xpcom/proxy/src/nsProxyEventObject.cpp @@ -43,8 +43,6 @@ #include "nsProxyEvent.h" #include "nsIProxyObjectManager.h" #include "nsProxyEventPrivate.h" -#include "nsProxyRelease.h" -#include "nsThreadUtils.h" #include "nsServiceManagerUtils.h" @@ -59,36 +57,6 @@ static NS_DEFINE_IID(kProxyObject_Identity_Class_IID, NS_PROXYEVENT_IDENTITY_CLA //////////////////////////////////////////////////////////////////////////////// -// Make this more generic and move it someplace else so that it can be reused! -template -class nsProxyReleaseCOMPtr : public nsCOMPtr { -public: - typedef nsProxyReleaseCOMPtr self_type; - - nsProxyReleaseCOMPtr(nsIEventTarget *target) : mTarget(target) { - } - - ~nsProxyReleaseCOMPtr() { - if (nsCOMPtr::get() && mTarget != NS_GetCurrentThread()) { - nsISupports *doomed = nsnull; - nsCOMPtr::swap(doomed); - NSCAP_LOG_RELEASE(this, doomed); - NS_ProxyRelease(mTarget, doomed); - } - } - - self_type& - operator=( const nsQueryInterfaceWithError& rhs ) { - *NS_STATIC_CAST(nsCOMPtr*, this) = rhs; - return *this; - } - -private: - nsIEventTarget *mTarget; // weak ptr -}; - -//////////////////////////////////////////////////////////////////////////////// - class nsProxyEventKey : public nsHashKey { public: @@ -156,8 +124,9 @@ nsProxyEventObject::DebugDump(const char * message, PRUint32 hashKey) PRBool isRoot = mRoot == nsnull; printf("%s wrapper around @ %x\n", isRoot ? "ROOT":"non-root\n", GetRealObject()); + nsCOMPtr rootObject = do_QueryInterface(mProxyObject->mRealObject); nsCOMPtr rootQueue = do_QueryInterface(mProxyObject->mTarget); - nsProxyEventKey key(mRootObj, rootQueue, mProxyObject->mProxyType); + nsProxyEventKey key(rootObject, rootQueue, mProxyObject->mProxyType); printf("Hashkey: %d\n", key.HashCode()); char* name; @@ -248,7 +217,7 @@ nsProxyEventObject::GetNewOrUsedProxy(nsIEventTarget *target, // // Get the root nsISupports of the |real| object. // - nsProxyReleaseCOMPtr rootObject(target); + nsCOMPtr rootObject; rootObject = do_QueryInterface(rawObject, &rv); if (NS_FAILED(rv) || !rootObject) { @@ -327,7 +296,6 @@ nsProxyEventObject::GetNewOrUsedProxy(nsIEventTarget *target, peo = new nsProxyEventObject(target, proxyType, rootObject, - rootObject, rootClazz, nsnull); if(!peo) { @@ -369,19 +337,18 @@ nsProxyEventObject::GetNewOrUsedProxy(nsIEventTarget *target, } // Get the raw interface for this IID - nsProxyReleaseCOMPtr rawInterface(target); + nsCOMPtr rawInterface; - rawInterface = do_QueryInterface(rawObject, &rv); + rv = rawObject->QueryInterface(aIID, getter_AddRefs(rawInterface)); if (NS_FAILED(rv) || !rawInterface) { NS_ASSERTION(NS_FAILED(rv), "where did my rawInterface object go!"); return nsnull; } - peo = new nsProxyEventObject(target, - proxyType, - rawInterface, - rootObject, - proxyClazz, + peo = new nsProxyEventObject(target, + proxyType, + rawInterface, + proxyClazz, rootProxy); if (!peo) { // Ouch... Out of memory! @@ -430,17 +397,14 @@ nsProxyEventObject::nsProxyEventObject() nsProxyEventObject::nsProxyEventObject(nsIEventTarget *target, PRInt32 proxyType, nsISupports* aObj, - nsISupports* aRootObj, nsProxyEventClass* aClass, nsProxyEventObject* root) : mClass(aClass), - mRootObj(aRootObj), mRoot(root), mNext(nsnull) { NS_IF_ADDREF(mRoot); - // XXX protect against OOM errors mProxyObject = new nsProxyObject(target, proxyType, aObj); #ifdef DEBUG_xpcom_proxy @@ -482,8 +446,9 @@ nsProxyEventObject::~nsProxyEventObject() NS_ASSERTION(!mNext, "There are still proxies in the chain!"); if (realToProxyMap != nsnull) { - nsCOMPtr rootTarget = do_QueryInterface(mProxyObject->mTarget); - nsProxyEventKey key(mRootObj, rootTarget, mProxyObject->mProxyType); + nsCOMPtr rootObject = do_QueryInterface(mProxyObject->mRealObject); + nsCOMPtr rootQueue = do_QueryInterface(mProxyObject->mTarget); + nsProxyEventKey key(rootObject, rootQueue, mProxyObject->mProxyType); #ifdef DEBUG_dougt void* value = #endif diff --git a/mozilla/xpcom/proxy/src/nsProxyEventPrivate.h b/mozilla/xpcom/proxy/src/nsProxyEventPrivate.h index 0fc5c5aca34..42f1a134b2a 100644 --- a/mozilla/xpcom/proxy/src/nsProxyEventPrivate.h +++ b/mozilla/xpcom/proxy/src/nsProxyEventPrivate.h @@ -133,7 +133,6 @@ public: nsProxyEventObject(nsIEventTarget *target, PRInt32 proxyType, nsISupports* aObj, - nsISupports* aRootObj, // result of QI(nsISupports) nsProxyEventClass* aClass, nsProxyEventObject* root); @@ -152,7 +151,6 @@ protected: protected: nsCOMPtr mClass; nsRefPtr mProxyObject; - nsISupports *mRootObj; // weak pointer // Owning reference... nsProxyEventObject *mRoot;