Switching from PLEventQueues to nsIEventQueues.

This commit is contained in:
hyatt%netscape.com 1999-05-04 23:34:41 +00:00
Родитель a6a8a9170d
Коммит d5d409566a
17 изменённых файлов: 172 добавлений и 109 удалений

Просмотреть файл

@ -19,6 +19,8 @@
#ifndef nsIImapProtocol_h___
#define nsIImapProtocol_h___
#include "nsIEventQueueService.h"
#include "nsIStreamListener.h"
#include "nsIOutputStream.h"
#include "plevent.h"
@ -76,9 +78,9 @@ public:
// or more importantly the event queue of the consumer of the imap
// protocol data. The protocol also needs a host session list.
/////////////////////////////////////////////////////////////////////////
NS_IMETHOD Initialize(nsIImapHostSessionList * aHostSessionList, PLEventQueue * aSinkEventQueue) = 0;
NS_IMETHOD Initialize(nsIImapHostSessionList * aHostSessionList, nsIEventQueue * aSinkEventQueue) = 0;
NS_IMETHOD GetThreadEventQueue(PLEventQueue **aEventQueue) = 0;
NS_IMETHOD GetThreadEventQueue(nsIEventQueue **aEventQueue) = 0;
NS_IMETHOD NotifyFEEventCompletion() = 0;

Просмотреть файл

@ -48,7 +48,7 @@ class nsIImapMessageSink;
class nsIUrlListener;
class nsIURL;
class nsIImapUrl;
struct PLEventQueue;
class nsIEventQueue;
class nsIMsgFolder;
class nsIImapService : public nsISupports
@ -56,87 +56,87 @@ class nsIImapService : public nsISupports
public:
static const nsIID& GetIID() { static nsIID iid = NS_IIMAPSERVICE_IID; return iid; }
NS_IMETHOD CreateImapConnection (PLEventQueue *aEventQueue, nsIImapUrl * aImapUrl,
NS_IMETHOD CreateImapConnection (nsIEventQueue *aEventQueue, nsIImapUrl * aImapUrl,
nsIImapProtocol ** aImapConnection) = 0;
// As always, you can pass in null for the url listener and the url if you don't require either.....
// aClientEventQueue is the event queue of the event sinks. We post events into this queue.
// mscott -- eventually this function will take in the account (identity/incoming server) associated with
// the request
NS_IMETHOD SelectFolder(PLEventQueue * aClientEventQueue,
NS_IMETHOD SelectFolder(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL) = 0;
NS_IMETHOD LiteSelectFolder(PLEventQueue * aClientEventQueue,
NS_IMETHOD LiteSelectFolder(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL) = 0;
NS_IMETHOD FetchMessage(PLEventQueue * aClientEventQueue,
NS_IMETHOD FetchMessage(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIImapMessageSink * aImapMessage,
nsIUrlListener * aUrlListener, nsIURL ** aURL,
nsISupports *aConsumer,
const char *messageIdentifierList,
PRBool messageIdsAreUID) = 0;
NS_IMETHOD Noop(PLEventQueue * aClientEventQueue,
NS_IMETHOD Noop(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener, nsIURL ** aURL) = 0;
NS_IMETHOD GetHeaders(PLEventQueue * aClientEventQueue,
NS_IMETHOD GetHeaders(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener, nsIURL ** aURL,
const char *messageIdentifierList,
PRBool messageIdsAreUID) = 0;
NS_IMETHOD Expunge(PLEventQueue * aClientEventQueue,
NS_IMETHOD Expunge(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener, nsIURL ** aURL) = 0;
NS_IMETHOD Biff(PLEventQueue * aClientEventQueue,
NS_IMETHOD Biff(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener, nsIURL ** aURL,
PRUint32 uidHighWater) = 0;
NS_IMETHOD DeleteMessages(PLEventQueue * aClientEventQueue,
NS_IMETHOD DeleteMessages(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener, nsIURL ** aURL,
const char *messageIdentifierList,
PRBool messageIdsAreUID) = 0;
NS_IMETHOD DeleteAllMessages(PLEventQueue * aClientEventQueue,
NS_IMETHOD DeleteAllMessages(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL) = 0;
NS_IMETHOD AddMessageFlags(PLEventQueue * aClientEventQueue,
NS_IMETHOD AddMessageFlags(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener, nsIURL ** aURL,
const char *messageIdentifierList,
imapMessageFlagsType flags,
PRBool messageIdsAreUID) = 0;
NS_IMETHOD SubtractMessageFlags(PLEventQueue * aClientEventQueue,
NS_IMETHOD SubtractMessageFlags(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
const char *messageIdentifierList,
imapMessageFlagsType flags,
PRBool messageIdsAreUID) = 0;
NS_IMETHOD SetMessageFlags(PLEventQueue * aClientEventQueue,
NS_IMETHOD SetMessageFlags(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener, nsIURL ** aURL,
const char *messageIdentifierList,
imapMessageFlagsType flags,
PRBool messageIdsAreUID) = 0;
NS_IMETHOD DiscoverAllFolders(PLEventQueue* aClientEventQueue,
NS_IMETHOD DiscoverAllFolders(nsIEventQueue* aClientEventQueue,
nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener,
nsIURL** aURL) = 0;
NS_IMETHOD DiscoverAllAndSubscribedFolders(PLEventQueue*
NS_IMETHOD DiscoverAllAndSubscribedFolders(nsIEventQueue*
aClientEventQueue,
nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener,
nsIURL** aURL) = 0;
NS_IMETHOD DiscoverChildren(PLEventQueue* aClientEventQueue,
NS_IMETHOD DiscoverChildren(nsIEventQueue* aClientEventQueue,
nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener,
nsIURL** aURL) = 0;
NS_IMETHOD DiscoverLevelChildren(PLEventQueue* aClientEventQueue,
NS_IMETHOD DiscoverLevelChildren(nsIEventQueue* aClientEventQueue,
nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener,
PRInt32 level,

Просмотреть файл

@ -111,6 +111,7 @@ nsImapMailFolder::~nsImapMailFolder()
{
if (m_mailDatabase)
m_mailDatabase->Close(PR_TRUE);
NS_IF_RELEASE(m_eventQueue);
}
NS_IMPL_ADDREF_INHERITED(nsImapMailFolder, nsMsgFolder)
@ -437,13 +438,13 @@ nsImapMailFolder::FindAndSelectFolder(nsISupports* aElement,
aImapMailFolder->GetDepth(&depth);
// Get current thread envent queue
PLEventQueue* eventQueue = nsnull;
nsCOMPtr<nsIEventQueue> eventQueue;
NS_WITH_SERVICE(nsIEventQueueService, pEventQService, kEventQueueServiceCID, &rv);
if (NS_SUCCEEDED(rv) && pEventQService)
pEventQService->GetThreadEventQueue(PR_GetCurrentThread(),
&eventQueue);
getter_AddRefs(eventQueue));
rv = aImapMailFolder->GetName(&folderName);
if (folderName && *folderName && PL_strcasecmp(folderName, target) == 0 &&

Просмотреть файл

@ -275,7 +275,7 @@ protected:
nsParseMailMessageState *m_msgParser;
nsMsgKey m_curMsgUid;
PRInt32 m_nextMessageByteLength;
PLEventQueue* m_eventQueue;
nsIEventQueue* m_eventQueue;
PRBool m_urlRunning;
// part of temporary libmime converstion trick......these should go away once MIME uses a new stream

Просмотреть файл

@ -21,6 +21,9 @@
#include <windows.h> // for InterlockedIncrement
#endif
#include "nsIEventQueueService.h"
#include "nsXPComCIID.h"
#include "nsImapCore.h"
#include "nsImapProtocol.h"
#include "nscore.h"
@ -65,6 +68,7 @@ const char *kImapTrashFolderName = "Trash"; // **** needs to be localized ****
static NS_DEFINE_CID(kNetServiceCID, NS_NETSERVICE_CID);
static NS_DEFINE_IID(kIWebShell, NS_IWEB_SHELL_IID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
#define OUTPUT_BUFFER_SIZE (4096*2) // mscott - i should be able to remove this if I can use nsMsgLineBuffer???
@ -248,7 +252,7 @@ nsImapProtocol::nsImapProtocol() :
IMAP = PR_NewLogModule("IMAP");
}
nsresult nsImapProtocol::Initialize(nsIImapHostSessionList * aHostSessionList, PLEventQueue * aSinkEventQueue)
nsresult nsImapProtocol::Initialize(nsIImapHostSessionList * aHostSessionList, nsIEventQueue * aSinkEventQueue)
{
NS_PRECONDITION(aSinkEventQueue && aHostSessionList,
"oops...trying to initalize with a null sink event queue!");
@ -257,6 +261,8 @@ nsresult nsImapProtocol::Initialize(nsIImapHostSessionList * aHostSessionList, P
m_displayConsumer = nsnull;
m_sinkEventQueue = aSinkEventQueue;
NS_IF_ADDREF(m_sinkEventQueue);
m_hostSessionList = aHostSessionList;
m_parser.SetHostSessionList(aHostSessionList);
m_parser.SetFlagState(&m_flagState);
@ -310,7 +316,7 @@ nsImapProtocol::~nsImapProtocol()
NS_ASSERTION(m_imapThreadIsRunning == PR_FALSE, "Oops, thread is still running.\n");
if (m_eventQueue)
{
PL_DestroyEventQueue(m_eventQueue);
NS_RELEASE(m_eventQueue);
m_eventQueue = nsnull;
}
@ -530,8 +536,26 @@ void nsImapProtocol::ImapThreadMain(void *aParm)
PR_CExitMonitor(me);
return;
}
me->m_eventQueue = PL_CreateEventQueue("ImapProtocolThread",
// Wrap the PLQueue we're going to make in an nsIEventQueue
nsIEventQueueService* pEventQService;
nsresult result = nsServiceManager::GetService(kEventQueueServiceCID,
nsIEventQueueService::GetIID(),
(nsISupports**)&pEventQService);
if (NS_FAILED(result))
return;
PLEventQueue* aPLQueue = PL_CreateEventQueue("ImapProtocolThread",
PR_GetCurrentThread());
if (NS_FAILED(result = pEventQService->CreateFromPLEventQueue(aPLQueue,
&me->m_eventQueue))) {
return;
}
// Release the eventqueueservice
nsServiceManager::ReleaseService(kEventQueueServiceCID, pEventQService);
NS_ASSERTION(me->m_eventQueue,
"Unable to create imap thread event queue.\n");
if (!me->m_eventQueue)
@ -545,7 +569,7 @@ void nsImapProtocol::ImapThreadMain(void *aParm)
// call the platform specific main loop ....
me->ImapThreadMainLoop();
PR_DestroyEventQueue(me->m_eventQueue);
NS_IF_RELEASE(me->m_eventQueue);
me->m_eventQueue = nsnull;
// ***** Important need to remove the connection out from the connection
@ -564,12 +588,14 @@ nsImapProtocol::ImapThreadIsRunning()
}
NS_IMETHODIMP
nsImapProtocol::GetThreadEventQueue(PLEventQueue **aEventQueue)
nsImapProtocol::GetThreadEventQueue(nsIEventQueue **aEventQueue)
{
// *** should subclassing PLEventQueue and ref count it ***
// *** need to find a way to prevent dangling pointer ***
// *** a callback mechanism or a semaphor control thingy ***
PR_CEnterMonitor(this);
NS_IF_ADDREF(m_eventQueue);
if (aEventQueue)
*aEventQueue = m_eventQueue;
PR_CExitMonitor(this);

Просмотреть файл

@ -65,8 +65,8 @@ public:
NS_IMETHOD LoadUrl(nsIURL * aURL, nsISupports * aConsumer);
NS_IMETHOD IsBusy(PRBool & aIsConnectionBusy);
NS_IMETHOD CanHandleUrl(nsIImapUrl * aImapUrl, PRBool & aCanRunUrl);
NS_IMETHOD Initialize(nsIImapHostSessionList * aHostSessionList, PLEventQueue * aSinkEventQueue);
NS_IMETHOD GetThreadEventQueue(PLEventQueue **aEventQueue);
NS_IMETHOD Initialize(nsIImapHostSessionList * aHostSessionList, nsIEventQueue * aSinkEventQueue);
NS_IMETHOD GetThreadEventQueue(nsIEventQueue **aEventQueue);
// Notify FE Event has been completed
NS_IMETHOD NotifyFEEventCompletion();
@ -283,8 +283,8 @@ private:
char * ReadNextLineFromInput(char * aDataBuffer,char *& aStartPos, PRUint32 aDataBufferSize, nsIInputStream * aInputStream);
// ******* Thread support *******
PLEventQueue *m_sinkEventQueue;
PLEventQueue *m_eventQueue;
nsIEventQueue *m_sinkEventQueue;
nsIEventQueue *m_eventQueue;
PRThread *m_thread;
PRMonitor *m_dataAvailableMonitor; // used to notify the arrival of data from the server
PRMonitor *m_urlReadyToRunMonitor; // used to notify the arrival of a new url to be processed

Просмотреть файл

@ -19,6 +19,9 @@
#include "nscore.h"
#include "msgCore.h" // precompiled header
#include "nspr.h"
#include "nsIEventQueueService.h"
#include "nsIImapMailFolderSink.h"
#include "nsIImapMessageSink.h"
#include "nsIImapExtensionSink.h"
@ -44,12 +47,12 @@ nsImapEvent::InitEvent()
}
void
nsImapEvent::PostEvent(PLEventQueue* aEventQ)
nsImapEvent::PostEvent(nsIEventQueue* aEventQ)
{
NS_PRECONDITION(nsnull != aEventQ, "PostEvent: aEventQ is null");
InitEvent();
PL_PostEvent(aEventQ, this);
aEventQ->PostEvent(this);
}
void PR_CALLBACK
@ -67,7 +70,7 @@ nsImapEvent::imap_event_destructor(PLEvent *aEvent)
}
nsImapProxyBase::nsImapProxyBase(nsIImapProtocol* aProtocol,
PLEventQueue* aEventQ,
nsIEventQueue* aEventQ,
PRThread* aThread)
{
NS_ASSERTION (aProtocol && aEventQ && aThread,
@ -77,17 +80,20 @@ nsImapProxyBase::nsImapProxyBase(nsIImapProtocol* aProtocol,
NS_IF_ADDREF(m_protocol);
m_eventQueue = aEventQ;
NS_IF_ADDREF(m_eventQueue);
m_thread = aThread;
}
nsImapProxyBase::~nsImapProxyBase()
{
NS_IF_RELEASE (m_protocol);
NS_IF_RELEASE(m_eventQueue);
}
nsImapLogProxy::nsImapLogProxy(nsIImapLog* aImapLog,
nsIImapProtocol* aProtocol,
PLEventQueue* aEventQ,
nsIEventQueue* aEventQ,
PRThread* aThread) :
nsImapProxyBase(aProtocol, aEventQ, aThread)
{
@ -166,7 +172,7 @@ nsImapLogProxyEvent::HandleEvent()
nsImapMailFolderSinkProxy::nsImapMailFolderSinkProxy(
nsIImapMailFolderSink* aImapMailFolderSink,
nsIImapProtocol* aProtocol,
PLEventQueue* aEventQ,
nsIEventQueue* aEventQ,
PRThread* aThread) : nsImapProxyBase(aProtocol, aEventQ, aThread)
{
NS_ASSERTION (aImapMailFolderSink,
@ -584,7 +590,7 @@ nsImapMailFolderSinkProxy::AbortHeaderParseStream(nsIImapProtocol* aProtocol)
nsImapMessageSinkProxy::nsImapMessageSinkProxy(nsIImapMessageSink* aImapMessageSink,
nsIImapProtocol* aProtocol,
PLEventQueue* aEventQ,
nsIEventQueue* aEventQ,
PRThread* aThread) :
nsImapProxyBase(aProtocol, aEventQ, aThread)
{
@ -863,7 +869,7 @@ nsImapMessageSinkProxy::GetMessageSizeFromDB(nsIImapProtocol* aProtocol,
nsImapExtensionSinkProxy::nsImapExtensionSinkProxy(nsIImapExtensionSink* aImapExtensionSink,
nsIImapProtocol* aProtocol,
PLEventQueue* aEventQ,
nsIEventQueue* aEventQ,
PRThread* aThread) :
nsImapProxyBase(aProtocol, aEventQ, aThread)
{
@ -1099,7 +1105,7 @@ nsImapExtensionSinkProxy::SetFolderAdminURL(nsIImapProtocol* aProtocol,
nsImapMiscellaneousSinkProxy::nsImapMiscellaneousSinkProxy(
nsIImapMiscellaneousSink* aImapMiscellaneousSink,
nsIImapProtocol* aProtocol,
PLEventQueue* aEventQ,
nsIEventQueue* aEventQ,
PRThread* aThread) : nsImapProxyBase(aProtocol, aEventQ, aThread)
{
NS_ASSERTION (aImapMiscellaneousSink,

Просмотреть файл

@ -33,11 +33,11 @@ class nsImapProxyBase
{
public:
nsImapProxyBase(nsIImapProtocol* aProtocol,
PLEventQueue* aEventQ,
nsIEventQueue* aEventQ,
PRThread* aThread);
virtual ~nsImapProxyBase();
PLEventQueue* m_eventQueue;
nsIEventQueue* m_eventQueue;
PRThread* m_thread;
nsIImapProtocol* m_protocol;
};
@ -48,7 +48,7 @@ class nsImapLogProxy : public nsIImapLog,
public:
nsImapLogProxy(nsIImapLog* aImapLog,
nsIImapProtocol* aProtocol,
PLEventQueue* aEventQ,
nsIEventQueue* aEventQ,
PRThread* aThread);
virtual ~nsImapLogProxy();
@ -65,7 +65,7 @@ class nsImapMailFolderSinkProxy : public nsIImapMailFolderSink,
public:
nsImapMailFolderSinkProxy(nsIImapMailFolderSink* aImapMailFolderSink,
nsIImapProtocol* aProtocol,
PLEventQueue* aEventQ,
nsIEventQueue* aEventQ,
PRThread* aThread);
virtual ~nsImapMailFolderSinkProxy();
@ -113,7 +113,7 @@ class nsImapMessageSinkProxy : public nsIImapMessageSink,
public:
nsImapMessageSinkProxy(nsIImapMessageSink* aImapMessageSink,
nsIImapProtocol* aProtocol,
PLEventQueue* aEventQ,
nsIEventQueue* aEventQ,
PRThread* aThread);
virtual ~nsImapMessageSinkProxy();
@ -156,7 +156,7 @@ class nsImapExtensionSinkProxy : public nsIImapExtensionSink,
public:
nsImapExtensionSinkProxy(nsIImapExtensionSink* aImapExtensionSink,
nsIImapProtocol* aProtocol,
PLEventQueue* aEventQ,
nsIEventQueue* aEventQ,
PRThread* aThread);
virtual ~nsImapExtensionSinkProxy();
@ -188,7 +188,7 @@ class nsImapMiscellaneousSinkProxy : public nsIImapMiscellaneousSink,
public:
nsImapMiscellaneousSinkProxy (nsIImapMiscellaneousSink* aImapMiscellaneousSink,
nsIImapProtocol* aProtocol,
PLEventQueue* aEventQ,
nsIEventQueue* aEventQ,
PRThread* aThread);
~nsImapMiscellaneousSinkProxy ();
@ -244,7 +244,7 @@ struct nsImapEvent : public PLEvent
virtual void InitEvent();
NS_IMETHOD HandleEvent() = 0;
void PostEvent(PLEventQueue* aEventQ);
void PostEvent(nsIEventQueue* aEventQ);
static void PR_CALLBACK imap_event_handler(PLEvent* aEvent);
static void PR_CALLBACK imap_event_destructor(PLEvent *aEvent);

Просмотреть файл

@ -104,7 +104,7 @@ nsresult nsImapService::QueryInterface(const nsIID &aIID, void** aInstancePtr)
}
NS_IMETHODIMP
nsImapService::CreateImapConnection(PLEventQueue *aEventQueue, nsIImapUrl * aImapUrl,
nsImapService::CreateImapConnection(nsIEventQueue *aEventQueue, nsIImapUrl * aImapUrl,
nsIImapProtocol ** aImapConnection)
{
nsresult rv = NS_OK;
@ -167,7 +167,7 @@ nsImapService::GetFolderName(nsIImapUrl* aImapUrl, nsIMsgFolder* aImapFolder,
}
NS_IMETHODIMP
nsImapService::SelectFolder(PLEventQueue * aClientEventQueue,
nsImapService::SelectFolder(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL)
@ -219,7 +219,7 @@ nsImapService::SelectFolder(PLEventQueue * aClientEventQueue,
// lite select, used to verify UIDVALIDITY while going on/offline
NS_IMETHODIMP
nsImapService::LiteSelectFolder(PLEventQueue * aClientEventQueue,
nsImapService::LiteSelectFolder(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL)
@ -279,12 +279,12 @@ NS_IMETHODIMP nsImapService::DisplayMessage(const char* aMessageURI, nsISupports
nsImapUrl * imapUrl = nsnull;
nsIImapUrl * url = nsnull;
nsresult rv = NS_OK;
PLEventQueue *queue;
nsCOMPtr<nsIEventQueue> queue;
// get the Event Queue for this thread...
NS_WITH_SERVICE(nsIEventQueueService, pEventQService, kEventQueueServiceCID, &rv);
if (NS_SUCCEEDED(rv) && pEventQService)
rv = pEventQService->GetThreadEventQueue(PR_GetCurrentThread(),&queue);
rv = pEventQService->GetThreadEventQueue(PR_GetCurrentThread(),getter_AddRefs(queue));
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
@ -329,7 +329,7 @@ nsImapService::CopyMessage(const char * aSrcMailboxURI, nsIStreamListener * aMai
/* 'x' is the message UID or sequence number list */
/* will set the 'SEEN' flag */
NS_IMETHODIMP
nsImapService::FetchMessage(PLEventQueue * aClientEventQueue,
nsImapService::FetchMessage(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIImapMessageSink * aImapMessage,
nsIUrlListener * aUrlListener, nsIURL ** aURL,
@ -386,7 +386,7 @@ nsImapService::FetchMessage(PLEventQueue * aClientEventQueue,
}
// utility function to handle basic setup - will probably change when the real connection stuff is done.
nsresult nsImapService::GetImapConnectionAndUrl(
PLEventQueue * aClientEventQueue, nsIImapUrl * &imapUrl,
nsIEventQueue * aClientEventQueue, nsIImapUrl * &imapUrl,
nsIMsgFolder* &aImapMailFolder, nsIImapProtocol * &protocolInstance,
nsString2 &urlSpec)
{
@ -448,7 +448,7 @@ nsresult nsImapService::CreateStartOfImapUrl(nsIImapUrl &imapUrl, nsString2
/* 'x' is the message UID or sequence number list */
/* will not affect the 'SEEN' flag */
NS_IMETHODIMP
nsImapService::GetHeaders(PLEventQueue * aClientEventQueue,
nsImapService::GetHeaders(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
@ -504,7 +504,7 @@ nsImapService::GetHeaders(PLEventQueue * aClientEventQueue,
// Noop, used to update a folder (causes server to send changes).
NS_IMETHODIMP
nsImapService::Noop(PLEventQueue * aClientEventQueue,
nsImapService::Noop(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL)
@ -550,7 +550,7 @@ nsImapService::Noop(PLEventQueue * aClientEventQueue,
// Expunge, used to "compress" an imap folder,removes deleted messages.
NS_IMETHODIMP
nsImapService::Expunge(PLEventQueue * aClientEventQueue,
nsImapService::Expunge(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL)
@ -596,7 +596,7 @@ nsImapService::Expunge(PLEventQueue * aClientEventQueue,
/* old-stle biff that doesn't download headers */
NS_IMETHODIMP
nsImapService::Biff(PLEventQueue * aClientEventQueue,
nsImapService::Biff(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
@ -646,7 +646,7 @@ nsImapService::Biff(PLEventQueue * aClientEventQueue,
}
NS_IMETHODIMP
nsImapService::DeleteMessages(PLEventQueue * aClientEventQueue,
nsImapService::DeleteMessages(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
@ -701,7 +701,7 @@ nsImapService::DeleteMessages(PLEventQueue * aClientEventQueue,
// Delete all messages in a folder, used to empty trash
NS_IMETHODIMP
nsImapService::DeleteAllMessages(PLEventQueue * aClientEventQueue,
nsImapService::DeleteAllMessages(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL)
@ -746,7 +746,7 @@ nsImapService::DeleteAllMessages(PLEventQueue * aClientEventQueue,
}
NS_IMETHODIMP
nsImapService::AddMessageFlags(PLEventQueue * aClientEventQueue,
nsImapService::AddMessageFlags(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
@ -759,7 +759,7 @@ nsImapService::AddMessageFlags(PLEventQueue * aClientEventQueue,
}
NS_IMETHODIMP
nsImapService::SubtractMessageFlags(PLEventQueue * aClientEventQueue,
nsImapService::SubtractMessageFlags(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
@ -772,7 +772,7 @@ nsImapService::SubtractMessageFlags(PLEventQueue * aClientEventQueue,
}
NS_IMETHODIMP
nsImapService::SetMessageFlags(PLEventQueue * aClientEventQueue,
nsImapService::SetMessageFlags(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
@ -788,7 +788,7 @@ nsImapService::SetMessageFlags(PLEventQueue * aClientEventQueue,
"setmsgflags", flags, messageIdsAreUID);
}
nsresult nsImapService::DiddleFlags(PLEventQueue * aClientEventQueue,
nsresult nsImapService::DiddleFlags(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
@ -896,7 +896,7 @@ nsImapService::SetImapUrlSink(nsIMsgFolder* aMsgFolder,
}
NS_IMETHODIMP
nsImapService::DiscoverAllFolders(PLEventQueue* aClientEventQueue,
nsImapService::DiscoverAllFolders(nsIEventQueue* aClientEventQueue,
nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener,
nsIURL** aURL)
@ -939,7 +939,7 @@ nsImapService::DiscoverAllFolders(PLEventQueue* aClientEventQueue,
}
NS_IMETHODIMP
nsImapService::DiscoverAllAndSubscribedFolders(PLEventQueue* aClientEventQueue,
nsImapService::DiscoverAllAndSubscribedFolders(nsIEventQueue* aClientEventQueue,
nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener,
nsIURL** aURL)
@ -982,7 +982,7 @@ nsImapService::DiscoverAllAndSubscribedFolders(PLEventQueue* aClientEventQueue,
}
NS_IMETHODIMP
nsImapService::DiscoverChildren(PLEventQueue* aClientEventQueue,
nsImapService::DiscoverChildren(nsIEventQueue* aClientEventQueue,
nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener,
nsIURL** aURL)
@ -1037,7 +1037,7 @@ nsImapService::DiscoverChildren(PLEventQueue* aClientEventQueue,
}
NS_IMETHODIMP
nsImapService::DiscoverLevelChildren(PLEventQueue* aClientEventQueue,
nsImapService::DiscoverLevelChildren(nsIEventQueue* aClientEventQueue,
nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener,
PRInt32 level,

Просмотреть файл

@ -42,18 +42,18 @@ public:
// we suppport the nsIImapService interface
////////////////////////////////////////////////////////////////////////////////////////
NS_IMETHOD CreateImapConnection (PLEventQueue *aEventQueue, nsIImapUrl * aImapUrl,
NS_IMETHOD CreateImapConnection (nsIEventQueue *aEventQueue, nsIImapUrl * aImapUrl,
nsIImapProtocol ** aImapConnection);
NS_IMETHOD SelectFolder(PLEventQueue * aClientEventQueue,
NS_IMETHOD SelectFolder(nsIEventQueue * aClientEventQueue,
nsIMsgFolder *aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL);
NS_IMETHOD LiteSelectFolder(PLEventQueue * aClientEventQueue,
NS_IMETHOD LiteSelectFolder(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL);
NS_IMETHOD FetchMessage(PLEventQueue * aClientEventQueue,
NS_IMETHOD FetchMessage(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIImapMessageSink * aImapMessage,
nsIUrlListener * aUrlListener,
@ -61,50 +61,50 @@ public:
nsISupports *aConsumer,
const char *messageIdentifierList,
PRBool messageIdsAreUID);
NS_IMETHOD Noop(PLEventQueue * aClientEventQueue,
NS_IMETHOD Noop(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL);
NS_IMETHOD GetHeaders(PLEventQueue * aClientEventQueue,
NS_IMETHOD GetHeaders(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
const char *messageIdentifierList,
PRBool messageIdsAreUID);
NS_IMETHOD Expunge(PLEventQueue * aClientEventQueue,
NS_IMETHOD Expunge(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL);
NS_IMETHOD Biff(PLEventQueue * aClientEventQueue,
NS_IMETHOD Biff(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
PRUint32 uidHighWater);
NS_IMETHOD DeleteMessages(PLEventQueue * aClientEventQueue,
NS_IMETHOD DeleteMessages(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
const char *messageIdentifierList,
PRBool messageIdsAreUID);
NS_IMETHOD DeleteAllMessages(PLEventQueue * aClientEventQueue,
NS_IMETHOD DeleteAllMessages(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL);;
NS_IMETHOD AddMessageFlags(PLEventQueue * aClientEventQueue,
NS_IMETHOD AddMessageFlags(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
const char *messageIdentifierList,
imapMessageFlagsType flags,
PRBool messageIdsAreUID);
NS_IMETHOD SubtractMessageFlags(PLEventQueue * aClientEventQueue,
NS_IMETHOD SubtractMessageFlags(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
const char *messageIdentifierList,
imapMessageFlagsType flags,
PRBool messageIdsAreUID);
NS_IMETHOD SetMessageFlags(PLEventQueue * aClientEventQueue,
NS_IMETHOD SetMessageFlags(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,
@ -112,20 +112,20 @@ public:
imapMessageFlagsType flags,
PRBool messageIdsAreUID);
NS_IMETHOD DiscoverAllFolders(PLEventQueue* aClientEventQueue,
NS_IMETHOD DiscoverAllFolders(nsIEventQueue* aClientEventQueue,
nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener,
nsIURL** aURL);
NS_IMETHOD DiscoverAllAndSubscribedFolders(PLEventQueue*
NS_IMETHOD DiscoverAllAndSubscribedFolders(nsIEventQueue*
aClientEventQueue,
nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener,
nsIURL** aURL);
NS_IMETHOD DiscoverChildren(PLEventQueue* aClientEventQueue,
NS_IMETHOD DiscoverChildren(nsIEventQueue* aClientEventQueue,
nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener,
nsIURL** aURL);
NS_IMETHOD DiscoverLevelChildren(PLEventQueue* aClientEventQueue,
NS_IMETHOD DiscoverLevelChildren(nsIEventQueue* aClientEventQueue,
nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener,
PRInt32 level,
@ -145,7 +145,7 @@ public:
protected:
nsresult GetFolderName(nsIImapUrl* aImapUrl, nsIMsgFolder* aImapFolder,
nsString2& folderName);
nsresult GetImapConnectionAndUrl(PLEventQueue * aClientEventQueue,
nsresult GetImapConnectionAndUrl(nsIEventQueue * aClientEventQueue,
nsIImapUrl * &imapUrl,
nsIMsgFolder* &aImapFolder,
nsIImapProtocol * &protocolInstance,
@ -157,7 +157,7 @@ protected:
const char* userName);
nsresult SetImapUrlSink(nsIMsgFolder* aMsgFolder,
nsIImapUrl* aImapUrl);
nsresult DiddleFlags(PLEventQueue * aClientEventQueue,
nsresult DiddleFlags(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIURL ** aURL,

Просмотреть файл

@ -22,6 +22,8 @@
#include <windows.h> // for InterlockedIncrement
#endif
#include "nsIEventQueueService.h"
#include "nsIURL.h"
#include "nsImapUrl.h"

Просмотреть файл

@ -131,7 +131,7 @@ public:
// nsIImapLog support
NS_IMETHOD HandleImapLogData (const char * aLogData);
nsIMAP4TestDriver(PLEventQueue *queue);
nsIMAP4TestDriver(nsIEventQueue *queue);
virtual ~nsIMAP4TestDriver();
// run driver initializes the instance, lists the commands, runs the command and when
@ -182,10 +182,10 @@ protected:
nsresult InitializeProtocol(const char * urlSpec);
PRBool m_protocolInitialized;
PLEventQueue *m_eventQueue;
nsIEventQueue *m_eventQueue;
};
nsIMAP4TestDriver::nsIMAP4TestDriver(PLEventQueue *queue)
nsIMAP4TestDriver::nsIMAP4TestDriver(nsIEventQueue *queue)
{
NS_INIT_REFCNT();
m_inbox = 0;
@ -196,6 +196,7 @@ nsIMAP4TestDriver::nsIMAP4TestDriver(PLEventQueue *queue)
m_runTestHarness = PR_TRUE;
m_runningURL = PR_FALSE;
m_eventQueue = queue;
NS_IF_ADDREF(queue);
m_IMAP4Protocol = nsnull; // we can't create it until we have a url...
m_msgParser = nsnull;
@ -262,6 +263,7 @@ nsresult nsIMAP4TestDriver::InitializeProtocol(const char * urlString)
nsIMAP4TestDriver::~nsIMAP4TestDriver()
{
NS_IF_RELEASE(m_eventQueue);
NS_IF_RELEASE(m_url);
NS_IF_RELEASE(m_IMAP4Protocol);
if (m_mailDB)
@ -682,7 +684,7 @@ nsresult nsIMAP4TestDriver::OnTestUrlParsing()
int main()
{
PLEventQueue *queue;
nsCOMPtr<nsIEventQueue> queue;
nsresult result;
// register all the components we might need - what's the imap service going to be called?
@ -707,7 +709,7 @@ int main()
if (NS_FAILED(result)) return result;
pEventQService->GetThreadEventQueue(PR_GetCurrentThread(),&queue);
pEventQService->GetThreadEventQueue(PR_GetCurrentThread(),getter_AddRefs(queue));
if (NS_FAILED(result) || !queue)
{
printf("unable to get event queue.\n");

Просмотреть файл

@ -19,6 +19,7 @@
#define nsIAppShell_h__
#include "nsString.h"
#include "nsIEventQueue.h"
/**
* Flags for the getNativeData function.
@ -67,13 +68,13 @@ public:
virtual nsresult Run() = 0;
/**
* Prepare to process events
* Prepare to process events.
*/
NS_IMETHOD Spinup() = 0;
/**
* Prepare to stop processing events
* Prepare to stop processing events.
*/
NS_IMETHOD Spindown() = 0;

Просмотреть файл

@ -78,8 +78,8 @@ static void event_processor_callback(gpointer data,
gint source,
GdkInputCondition condition)
{
PLEventQueue *event = (PLEventQueue*)data;
PR_ProcessPendingEvents(event);
nsIEventQueue *eventQueue = (nsIEventQueue*)data;
eventQueue->ProcessPendingEvents();
}
//-------------------------------------------------------------------------
@ -162,7 +162,7 @@ NS_METHOD nsAppShell::Run()
{
nsresult rv = NS_OK;
PLEventQueue * EQueue = nsnull;
nsIEventQueue * EQueue = nsnull;
// Get the event queue service
NS_WITH_SERVICE(nsIEventQueueService, mEventQService, kEventQueueServiceCID, &rv);
@ -176,7 +176,7 @@ NS_METHOD nsAppShell::Run()
rv = mEventQService->GetThreadEventQueue(PR_GetCurrentThread(), &EQueue);
// If a queue already present use it.
if (nsnull != EQueue)
if (EQueue)
goto done;
// Create the event queue for the thread
@ -195,13 +195,14 @@ NS_METHOD nsAppShell::Run()
done:
printf("Calling gdk_input with event queue\n");
gdk_input_add(PR_GetEventQueueSelectFD(EQueue),
gdk_input_add(EQueue->GetEventQueueSelectFD(),
GDK_INPUT_READ,
event_processor_callback,
EQueue);
gtk_main();
NS_IF_RELEASE(EQueue);
return NS_OK;
}

Просмотреть файл

@ -138,6 +138,7 @@ nsMacMessagePump::nsMacMessagePump(nsToolkit *aToolkit, nsMacMessageSink* aSink)
nsMacMessagePump::~nsMacMessagePump()
{
//¥TODO? release the toolkits and sinks? not if we use COM_auto_ptr.
NS_IF_RELEASE(mEventQueue);
}
//=================================================================
@ -267,6 +268,18 @@ PRBool nsMacMessagePump::GetEvent(EventRecord &theEvent)
return haveEvent;
}
//=================================================================
/* Set the event queue
* @param anEventQueue - the new queue to use for NSPR events
*/
void nsMacMessagePump::SetEventQueue(nsIEventQueue* aNewQueue)
{
NS_IF_RELEASE(mEventQueue);
mEventQueue = aNewQueue;
NS_IF_ADDREF(aNewQueue);
}
//=================================================================
/* Dispatch a single event
* @param theEvent - the event to dispatch
@ -334,8 +347,13 @@ void nsMacMessagePump::DispatchEvent(PRBool aRealEvent, EventRecord *anEvent)
Repeater::DoRepeaters(*anEvent);
// always process one NSPR event per time through the loop.
if (PL_EventAvailable(mEventQueue))
PL_HandleEvent(PL_GetEvent(mEventQueue));
PRBool eventAvailable;
mEventQueue->EventAvailable(eventAvailable);
if (eventAvailable) {
PLEvent* plEvent;
mEventQueue->GetEvent(&plEvent);
PL_HandleEvent(plEvent);
}
}
}

Просмотреть файл

@ -36,10 +36,10 @@
#include <Events.h>
#include "prtypes.h"
#include "nsIEventQueueService.h"
class nsToolkit;
class nsMacMessageSink;
struct PLEventQueue;
//================================================
@ -53,7 +53,7 @@ private:
PRBool mInBackground;
nsToolkit* mToolkit;
nsMacMessageSink* mMessageSink;
PLEventQueue* mEventQueue;
nsIEventQueue* mEventQueue;
// CLASS METHODS
@ -67,6 +67,8 @@ public:
void StartRunning() {mRunning = PR_TRUE;}
void StopRunning() {mRunning = PR_FALSE;}
void SetEventQueue(nsIEventQueue* aNewQueue);
private:
void DoMouseDown(EventRecord &anEvent);
void DoMouseUp(EventRecord &anEvent);

Просмотреть файл

@ -115,7 +115,7 @@ NS_METHOD nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListener)
nsresult nsAppShell::Run()
{
nsresult rv = NS_OK;
PLEventQueue *EQueue = nsnull;
nsIEventQueue *EQueue = nsnull;
int xlib_fd = -1;
int queue_fd = -1;
int max_fd;
@ -132,7 +132,7 @@ nsresult nsAppShell::Run()
}
rv = mEventQueueService->GetThreadEventQueue(PR_GetCurrentThread(), &EQueue);
// If a queue already present use it.
if (nsnull != EQueue)
if (EQueue)
goto done;
// Create the event queue for the thread
@ -150,7 +150,7 @@ nsresult nsAppShell::Run()
done:
printf("Getting the xlib connection number.\n");
xlib_fd = ConnectionNumber(gDisplay);
queue_fd = PR_GetEventQueueSelectFD(EQueue);
queue_fd = EQueue->GetEventQueueSelectFD();
if (xlib_fd >= queue_fd) {
max_fd = xlib_fd + 1;
} else {
@ -193,7 +193,7 @@ nsresult nsAppShell::Run()
// check to see if there's data avilable for the queue
if (FD_ISSET(queue_fd, &select_set)) {
//printf("queue data available.\n");
PR_ProcessPendingEvents(EQueue);
EQueue->ProcessPendingEvents();
}
// check to see if there's data avilable for
// xlib
@ -206,6 +206,8 @@ nsresult nsAppShell::Run()
NS_ProcessTimeouts();
}
}
NS_IF_RELEASE(EQueue);
return rv;
}