backing out patch for bug 337492 to fix tinderbox orange

git-svn-id: svn://10.0.0.236/trunk@196704 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%meer.net 2006-05-16 21:42:52 +00:00
parent 0982ec70c6
commit f0d82ccaaa
4 changed files with 14 additions and 59 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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 T>
class nsProxyReleaseCOMPtr : public nsCOMPtr<T> {
public:
typedef nsProxyReleaseCOMPtr<T> self_type;
nsProxyReleaseCOMPtr(nsIEventTarget *target) : mTarget(target) {
}
~nsProxyReleaseCOMPtr() {
if (nsCOMPtr<T>::get() && mTarget != NS_GetCurrentThread()) {
nsISupports *doomed = nsnull;
nsCOMPtr<T>::swap(doomed);
NSCAP_LOG_RELEASE(this, doomed);
NS_ProxyRelease(mTarget, doomed);
}
}
self_type&
operator=( const nsQueryInterfaceWithError& rhs ) {
*NS_STATIC_CAST(nsCOMPtr<T>*, 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<nsISupports> rootObject = do_QueryInterface(mProxyObject->mRealObject);
nsCOMPtr<nsISupports> 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<nsISupports> rootObject(target);
nsCOMPtr<nsISupports> 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<nsISupports> rawInterface(target);
nsCOMPtr<nsISupports> 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<nsISupports> rootTarget = do_QueryInterface(mProxyObject->mTarget);
nsProxyEventKey key(mRootObj, rootTarget, mProxyObject->mProxyType);
nsCOMPtr<nsISupports> rootObject = do_QueryInterface(mProxyObject->mRealObject);
nsCOMPtr<nsISupports> rootQueue = do_QueryInterface(mProxyObject->mTarget);
nsProxyEventKey key(rootObject, rootQueue, mProxyObject->mProxyType);
#ifdef DEBUG_dougt
void* value =
#endif

View File

@ -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<nsProxyEventClass> mClass;
nsRefPtr<nsProxyObject> mProxyObject;
nsISupports *mRootObj; // weak pointer
// Owning reference...
nsProxyEventObject *mRoot;