we now use the cached, correct, event queue when firing our Async*() channel api calls from the FTP thread. this allows other applications to spin up FTP threads.
git-svn-id: svn://10.0.0.236/trunk@66303 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -22,9 +22,6 @@
|
||||
|
||||
#include "nsAsyncEvent.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
|
||||
static NS_DEFINE_CID(eventQCID, NS_EVENTQUEUESERVICE_CID);
|
||||
|
||||
nsAsyncEvent::nsAsyncEvent(nsIChannel* channel, nsISupports* context)
|
||||
: mChannel(channel), mContext(context), mEvent(nsnull)
|
||||
@@ -58,16 +55,9 @@ void PR_CALLBACK nsAsyncEvent::DestroyPLEvent(PLEvent* aEvent)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAsyncEvent::Fire()
|
||||
nsAsyncEvent::Fire(nsIEventQueue *aEventQ)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIEventQueueService> eqServ = do_GetService(eventQCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIEventQueue> eventQ;
|
||||
|
||||
rv = eqServ->GetThreadEventQueue(NS_UI_THREAD, getter_AddRefs(eventQ));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
NS_ASSERTION(aEventQ, "need the event queue");
|
||||
NS_PRECONDITION(nsnull == mEvent, "Init plevent only once.");
|
||||
|
||||
mEvent = new PLEvent;
|
||||
@@ -77,7 +67,7 @@ nsAsyncEvent::Fire()
|
||||
(PLHandleEventProc) nsAsyncEvent::HandlePLEvent,
|
||||
(PLDestroyEventProc) nsAsyncEvent::DestroyPLEvent);
|
||||
|
||||
PRStatus status = eventQ->PostEvent(mEvent);
|
||||
PRStatus status = aEventQ->PostEvent(mEvent);
|
||||
return status == PR_SUCCESS ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
nsAsyncEvent(nsIChannel* channel, nsISupports* context);
|
||||
virtual ~nsAsyncEvent();
|
||||
|
||||
nsresult Fire();
|
||||
nsresult Fire(nsIEventQueue *aEventQ);
|
||||
|
||||
NS_IMETHOD HandleEvent() = 0;
|
||||
|
||||
|
||||
@@ -1180,7 +1180,7 @@ nsFtpConnectionThread::S_list() {
|
||||
mListenerContext);
|
||||
if (!event) return NS_ERROR_OUT_OF_MEMORY;
|
||||
mFireCallbacks = PR_FALSE; // listener callbacks will be handled by the transport.
|
||||
return event->Fire();
|
||||
return event->Fire(mEventQueue);
|
||||
}
|
||||
|
||||
FTP_STATE
|
||||
@@ -1210,7 +1210,7 @@ nsFtpConnectionThread::S_retr() {
|
||||
mListenerContext);
|
||||
if (!event) return NS_ERROR_OUT_OF_MEMORY;
|
||||
mFireCallbacks = PR_FALSE; // listener callbacks will be handled by the transport.
|
||||
return event->Fire();
|
||||
return event->Fire(mEventQueue);
|
||||
}
|
||||
|
||||
FTP_STATE
|
||||
@@ -1261,7 +1261,7 @@ nsFtpConnectionThread::S_stor() {
|
||||
mObserverContext);
|
||||
if (!event) return NS_ERROR_OUT_OF_MEMORY;
|
||||
mFireCallbacks = PR_FALSE; // observer callbacks will be handled by the transport.
|
||||
return event->Fire();
|
||||
return event->Fire(mEventQueue);
|
||||
}
|
||||
|
||||
FTP_STATE
|
||||
|
||||
Reference in New Issue
Block a user