Committing the changes to support the new nsIEventQueue interface and
nested queues in the event queue service. git-svn-id: svn://10.0.0.236/trunk@30290 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
106
mozilla/xpcom/threads/nsEventQueue.cpp
Normal file
106
mozilla/xpcom/threads/nsEventQueue.cpp
Normal file
@@ -0,0 +1,106 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "nsEventQueue.h"
|
||||
|
||||
nsEventQueueImpl::nsEventQueueImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mEventQueue = NULL;
|
||||
|
||||
}
|
||||
|
||||
nsEventQueueImpl::~nsEventQueueImpl()
|
||||
{
|
||||
if (NULL != mEventQueue) {
|
||||
PL_DestroyEventQueue(mEventQueue);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventQueueImpl::Init()
|
||||
{
|
||||
mEventQueue = PL_CreateNativeEventQueue("Thread event queue...", PR_GetCurrentThread());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventQueueImpl::InitFromPLQueue(PLEventQueue* aQueue)
|
||||
{
|
||||
mEventQueue = aQueue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsISupports interface implementation... */
|
||||
NS_IMPL_ISUPPORTS(nsEventQueueImpl,kIEventQueueIID);
|
||||
|
||||
/* nsIEventQueue interface implementation... */
|
||||
|
||||
NS_IMETHODIMP_(PRStatus)
|
||||
nsEventQueueImpl::PostEvent(PLEvent* aEvent)
|
||||
{
|
||||
return PL_PostEvent(mEventQueue, aEvent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventQueueImpl::PostSynchronousEvent(PLEvent* aEvent)
|
||||
{
|
||||
PL_PostSynchronousEvent(mEventQueue, aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventQueueImpl::ProcessPendingEvents()
|
||||
{
|
||||
PL_ProcessPendingEvents(mEventQueue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventQueueImpl::EventAvailable(PRBool& aResult)
|
||||
{
|
||||
aResult = PL_EventAvailable(mEventQueue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventQueueImpl::GetEvent(PLEvent** aResult)
|
||||
{
|
||||
*aResult = PL_GetEvent(mEventQueue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(PRInt32)
|
||||
nsEventQueueImpl::GetEventQueueSelectFD()
|
||||
{
|
||||
return PL_GetEventQueueSelectFD(mEventQueue);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsEventQueueImpl::Create(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsEventQueueImpl* evt = new nsEventQueueImpl();
|
||||
if (evt == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsresult rv = evt->QueryInterface(aIID, aResult);
|
||||
return rv;
|
||||
}
|
||||
Reference in New Issue
Block a user