mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 03:24:26 +00:00
1) #ifdefing out dll entry points from nsProxyObjectManager which should not
be used 2) Fix crashing bug in nsProxiedService when a CI fails. Converted this to use nsCOMPtrs 3) Fixing bug 18109. This involved changing what information about hash values we use. Tested FTP dir and file, and IMAP.
This commit is contained in:
parent
0b38786a86
commit
1946ba44ca
@ -72,32 +72,34 @@
|
||||
|
||||
class nsProxiedService
|
||||
{
|
||||
protected:
|
||||
nsISupports* mProxiedService;
|
||||
nsISupports* mService;
|
||||
public:
|
||||
nsProxiedService(const nsCID &aClass, const nsIID &aIID,
|
||||
nsIEventQueue* pIProxyQueue, nsresult*rv)
|
||||
: mProxiedService(nsnull)
|
||||
{
|
||||
|
||||
nsProxiedService(const nsCID &aClass, const nsIID &aIID,
|
||||
nsIEventQueue* pIProxyQueue, nsresult*rv)
|
||||
{
|
||||
static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
|
||||
|
||||
*rv = nsServiceManager::GetService(aClass, aIID, &mService);
|
||||
|
||||
*rv = nsServiceManager::GetService(aClass,
|
||||
aIID,
|
||||
getter_AddRefs(mService));
|
||||
if (NS_FAILED(*rv)) return;
|
||||
|
||||
NS_WITH_SERVICE(nsIProxyObjectManager, pIProxyObjectManager,
|
||||
kProxyObjectManagerCID, rv);
|
||||
if (NS_FAILED(*rv)) return;
|
||||
|
||||
*rv = pIProxyObjectManager->GetProxyObject(pIProxyQueue, aIID, mService,
|
||||
PROXY_SYNC, (void**)&mProxiedService);
|
||||
}
|
||||
|
||||
~nsProxiedService()
|
||||
{
|
||||
NS_IF_RELEASE(mProxiedService);
|
||||
NS_IF_RELEASE(mService);
|
||||
}
|
||||
*rv = pIProxyObjectManager->GetProxyObject(pIProxyQueue,
|
||||
aIID,
|
||||
mService,
|
||||
PROXY_SYNC,
|
||||
getter_AddRefs(mProxiedService));
|
||||
}
|
||||
|
||||
|
||||
~nsProxiedService()
|
||||
{
|
||||
}
|
||||
|
||||
nsISupports* operator->() const
|
||||
{
|
||||
@ -114,7 +116,12 @@ class nsProxiedService
|
||||
{
|
||||
return mProxiedService;
|
||||
}
|
||||
};
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsISupports> mProxiedService;
|
||||
nsCOMPtr<nsISupports> mService;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //__nsProxiedServiceManager_h_
|
||||
|
@ -20,6 +20,8 @@
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "prprf.h"
|
||||
#include "prmem.h"
|
||||
|
||||
#include "nsProxyEvent.h"
|
||||
#include "nsProxyObjectManager.h"
|
||||
@ -150,9 +152,16 @@ nsProxyEventObject::GetNewOrUsedProxy(nsIEventQueue *destQueue,
|
||||
if(NS_FAILED(aObj->QueryInterface(aIID, getter_AddRefs(requestedInterface))))
|
||||
return nsnull;
|
||||
|
||||
|
||||
|
||||
// this will be our key in the hash table.
|
||||
nsVoidKey rootkey( (void*) GetProxyHashKey(rootObject.get(), destQueue, proxyType) );
|
||||
|
||||
nsCOMPtr<nsISupports> destQRoot;
|
||||
if(NS_FAILED(destQueue->QueryInterface(nsCOMTypeInfo<nsISupports>::GetIID(), (void**)&destQueue)))
|
||||
return nsnull;
|
||||
|
||||
char* rootKeyString = PR_sprintf_append(nsnull, "%p.%p.%d", (PRUint32)rootObject.get(), (PRUint32)destQRoot.get(), proxyType);
|
||||
nsStringKey rootkey(rootKeyString);
|
||||
|
||||
|
||||
// find in our hash table
|
||||
if(realToProxyMap->Exists(&rootkey))
|
||||
@ -162,6 +171,7 @@ nsProxyEventObject::GetNewOrUsedProxy(nsIEventQueue *destQueue,
|
||||
|
||||
if(proxy)
|
||||
{
|
||||
PR_FREEIF(rootKeyString);
|
||||
peo = proxy;
|
||||
NS_ADDREF(peo);
|
||||
return peo;
|
||||
@ -178,12 +188,13 @@ nsProxyEventObject::GetNewOrUsedProxy(nsIEventQueue *destQueue,
|
||||
requestedInterface,
|
||||
clazz,
|
||||
nsnull,
|
||||
rootkey.HashValue());
|
||||
rootKeyString);
|
||||
|
||||
proxy = do_QueryInterface(peo);
|
||||
|
||||
if(proxy)
|
||||
{
|
||||
PR_FREEIF(rootKeyString);
|
||||
realToProxyMap->Put(&rootkey, peo);
|
||||
peo = proxy;
|
||||
NS_ADDREF(peo);
|
||||
@ -197,17 +208,23 @@ nsProxyEventObject::GetNewOrUsedProxy(nsIEventQueue *destQueue,
|
||||
nsCOMTypeInfo<nsISupports>::GetIID()) );
|
||||
|
||||
if (!rootClazz)
|
||||
{
|
||||
PR_FREEIF(rootKeyString);
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
peo = new nsProxyEventObject(destQueue,
|
||||
proxyType,
|
||||
rootObject,
|
||||
rootClazz,
|
||||
nsnull,
|
||||
rootkey.HashValue());
|
||||
rootKeyString);
|
||||
|
||||
if(!peo)
|
||||
{
|
||||
PR_FREEIF(rootKeyString);
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
root = do_QueryInterface(peo);
|
||||
|
||||
@ -225,17 +242,21 @@ nsProxyEventObject::GetNewOrUsedProxy(nsIEventQueue *destQueue,
|
||||
requestedInterface,
|
||||
clazz,
|
||||
root,
|
||||
0);
|
||||
"");
|
||||
|
||||
proxy = do_QueryInterface(peo);
|
||||
|
||||
if(!proxy)
|
||||
{
|
||||
PR_FREEIF(rootKeyString);
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
proxy->mNext = root->mNext;
|
||||
root->mNext = proxy;
|
||||
|
||||
PR_FREEIF(rootKeyString);
|
||||
peo = proxy;
|
||||
NS_ADDREF(peo);
|
||||
return peo;
|
||||
@ -243,7 +264,7 @@ nsProxyEventObject::GetNewOrUsedProxy(nsIEventQueue *destQueue,
|
||||
}
|
||||
nsProxyEventObject::nsProxyEventObject()
|
||||
: mNext(nsnull),
|
||||
mHashKey((void*)0)
|
||||
mHashKey("")
|
||||
{
|
||||
NS_WARNING("This constructor should never be called");
|
||||
}
|
||||
@ -253,9 +274,9 @@ nsProxyEventObject::nsProxyEventObject(nsIEventQueue *destQueue,
|
||||
nsISupports* aObj,
|
||||
nsProxyEventClass* aClass,
|
||||
nsProxyEventObject* root,
|
||||
PRUint32 hashValue)
|
||||
const char * hashStr)
|
||||
: mNext(nsnull),
|
||||
mHashKey((void*)hashValue)
|
||||
mHashKey(hashStr)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
@ -323,18 +344,6 @@ nsProxyEventObject::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
return mClass->DelegatedQueryInterface(this, aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsProxyEventObject::GetProxyHashKey(nsISupports *rootProxy, nsIEventQueue *destQueue, PRInt32 proxyType)
|
||||
{ // FIX I need to worry about nsCOMPtr for rootProxy, and destQueue!
|
||||
|
||||
nsISupports* destQRoot;
|
||||
if(NS_FAILED(destQueue->QueryInterface(nsCOMTypeInfo<nsISupports>::GetIID(), (void**)&destQRoot)))
|
||||
return 0;
|
||||
PRInt32 value = (PRUint32)rootProxy + (PRUint32)destQRoot + proxyType;
|
||||
NS_RELEASE(destQRoot);
|
||||
return value;
|
||||
}
|
||||
|
||||
nsProxyEventObject*
|
||||
nsProxyEventObject::Find(REFNSIID aIID)
|
||||
{
|
||||
|
@ -103,11 +103,6 @@ public:
|
||||
nsISupports *aObj,
|
||||
REFNSIID aIID);
|
||||
|
||||
static PRUint32 GetProxyHashKey( nsISupports *rootProxy,
|
||||
nsIEventQueue *destQueue,
|
||||
PRInt32 proxyType);
|
||||
|
||||
|
||||
|
||||
NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info);
|
||||
|
||||
@ -126,7 +121,7 @@ public:
|
||||
nsISupports* aObj,
|
||||
nsProxyEventClass* aClass,
|
||||
nsProxyEventObject* root,
|
||||
PRUint32 hashValue);
|
||||
const char * hashStr);
|
||||
|
||||
virtual ~nsProxyEventObject();
|
||||
|
||||
@ -137,7 +132,7 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsVoidKey mHashKey;
|
||||
nsStringKey mHashKey;
|
||||
|
||||
nsCOMPtr<nsProxyEventClass> mClass;
|
||||
nsCOMPtr<nsProxyObject> mProxyObject;
|
||||
|
@ -313,9 +313,7 @@ nsProxyEventFactory::LockFactory(PRBool aLock)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// DLL Entry Points:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -413,3 +411,4 @@ NSGetFactory(nsISupports* aServMgr,
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user