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:
valeski%netscape.com
2000-04-18 20:56:04 +00:00
parent 6f896464be
commit 4a3d32cfa5
3 changed files with 7 additions and 17 deletions

View File

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

View File

@@ -36,7 +36,7 @@ public:
nsAsyncEvent(nsIChannel* channel, nsISupports* context);
virtual ~nsAsyncEvent();
nsresult Fire();
nsresult Fire(nsIEventQueue *aEventQ);
NS_IMETHOD HandleEvent() = 0;

View File

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