Fix for 18078. R=mstoltz,warren

git-svn-id: svn://10.0.0.236/trunk@54638 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dougt%netscape.com
1999-11-30 00:14:55 +00:00
parent 54aadbcdf0
commit 69329e38fe
8 changed files with 76 additions and 47 deletions

View File

@@ -27,6 +27,7 @@
#include "nsISupports.h"
#include "nsIFactory.h"
#include "nsIEventQueue.h"
#include "nsIEventQueueService.h"
#include "nsHashtable.h"

View File

@@ -218,7 +218,7 @@ nsProxyObject::PostAndWait(nsProxyObjectCallInfo *proxyInfo)
return rv;
nsCOMPtr<nsIEventQueue> eventQ;
rv = eventQService->GetThreadEventQueue(PR_CurrentThread(), getter_AddRefs(eventQ));
rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(eventQ));
if (NS_FAILED(rv))
{
rv = eventQService->CreateThreadEventQueue();
@@ -226,7 +226,7 @@ nsProxyObject::PostAndWait(nsProxyObjectCallInfo *proxyInfo)
if (NS_FAILED(rv))
return rv;
rv = eventQService->GetThreadEventQueue(PR_CurrentThread(), getter_AddRefs(eventQ));
rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(eventQ));
}
else
{
@@ -564,7 +564,7 @@ AutoProxyParameterList(PRUint32 methodIndex, nsXPTMethodInfo *methodInfo, nsXPTC
if ( NS_FAILED( rv ) )
return rv;
rv = eventQService->GetThreadEventQueue(PR_CurrentThread(), &eventQ);
rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQ);
if ( NS_FAILED( rv ) )
{
// the caller does not have an eventQ of their own. bad.

View File

@@ -132,36 +132,21 @@ NS_IMETHODIMP
nsProxyObjectManager::GetProxyObject(nsIEventQueue *destQueue, REFNSIID aIID, nsISupports* aObj, PRInt32 proxyType, void** aProxyObject)
{
nsresult rv;
nsCOMPtr<nsIEventQueue> postQ(do_QueryInterface(destQueue));
nsCOMPtr<nsIEventQueue> postQ;
*aProxyObject = nsnull;
// post to primordial thread event queue if no queue specified
if (postQ == nsnull)
{
nsCOMPtr<nsIThread> mainIThread;
PRThread *mainThread;
// Get the primordial thread
rv = nsIThread::GetMainThread(getter_AddRefs(mainIThread));
if ( NS_FAILED( rv ) )
return NS_ERROR_UNEXPECTED;
rv = mainIThread->GetPRThread(&mainThread);
if ( NS_FAILED( rv ) )
return NS_ERROR_UNEXPECTED;
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueServiceCID, &rv);
if ( NS_FAILED( rv ) )
return NS_ERROR_UNEXPECTED;
rv = eventQService->GetThreadEventQueue(mainThread, getter_AddRefs(postQ));
if ( NS_FAILED( rv ) )
return NS_ERROR_UNEXPECTED;
}
// check to see if the destination Q is a special case.
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueServiceCID, &rv);
if (NS_FAILED(rv))
return rv;
rv = eventQService->ResolveEventQueue(destQueue, getter_AddRefs(postQ));
if (NS_FAILED(rv))
return rv;
// check to see if the eventQ is on our thread. If so, just return the real object.
if (postQ != nsnull && !(proxyType & PROXY_ASYNC) && !(proxyType & PROXY_ALWAYS))

View File

@@ -298,13 +298,13 @@ void TestCase_NestedLoop(void *arg)
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueServiceCID, &rv);
if (NS_SUCCEEDED(rv))
{
rv = eventQService->GetThreadEventQueue(PR_CurrentThread(), &eventQ);
rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQ);
if (NS_FAILED(rv))
rv = eventQService->CreateThreadEventQueue();
if (NS_FAILED(rv))
return;
else
rv = eventQService->GetThreadEventQueue(PR_CurrentThread(), &eventQ);
rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQ);
printf("Thread (%d) Prior to calling proxyObject->Test.\n", threadNumber);
rv = proxyObject->Test((PRInt32)eventQ, 0, &retval);
@@ -416,13 +416,13 @@ static void PR_CALLBACK EventLoop( void *arg )
nsIEventQueue* eventQ;
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueServiceCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = eventQService->GetThreadEventQueue(PR_CurrentThread(), &eventQ);
rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQ);
if (NS_FAILED(rv))
rv = eventQService->CreateThreadEventQueue();
if (NS_FAILED(rv))
return;
else
rv = eventQService->GetThreadEventQueue(PR_CurrentThread(), &eventQ);
rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQ);
}
if (NS_FAILED(rv)) return;