diff --git a/mozilla/content/base/src/nsSyncLoadService.cpp b/mozilla/content/base/src/nsSyncLoadService.cpp index e2fbf32d24b..fc0a3bc0646 100644 --- a/mozilla/content/base/src/nsSyncLoadService.cpp +++ b/mozilla/content/base/src/nsSyncLoadService.cpp @@ -422,7 +422,7 @@ nsSyncLoader::PushAsyncStream(nsIStreamListener* aListener) // process events until we're finished. mLoading = PR_TRUE; while (mLoading && NS_SUCCEEDED(rv)) - rv = thread->RunNextTask(nsIThread::RUN_NORMAL); + rv = thread->ProcessNextEvent(); } return rv; diff --git a/mozilla/content/xml/document/src/nsXMLDocument.cpp b/mozilla/content/xml/document/src/nsXMLDocument.cpp index 7e26e943ed9..705657f8ae1 100644 --- a/mozilla/content/xml/document/src/nsXMLDocument.cpp +++ b/mozilla/content/xml/document/src/nsXMLDocument.cpp @@ -513,7 +513,7 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) mLoopingForSyncLoad = PR_TRUE; while (mLoopingForSyncLoad && NS_SUCCEEDED(rv)) { - rv = thread->RunNextTask(nsIThread::RUN_NORMAL); + rv = thread->ProcessNextEvent(); } // We set return to true unless there was a parsing error diff --git a/mozilla/extensions/pref/autoconfig/src/nsAutoConfig.cpp b/mozilla/extensions/pref/autoconfig/src/nsAutoConfig.cpp index 2278bc31ea2..adfaaa31074 100644 --- a/mozilla/extensions/pref/autoconfig/src/nsAutoConfig.cpp +++ b/mozilla/extensions/pref/autoconfig/src/nsAutoConfig.cpp @@ -368,7 +368,7 @@ nsresult nsAutoConfig::downloadAutoConfig() */ while (!mLoaded) { - rv = thread->RunNextTask(nsIThread::RUN_NORMAL); + rv = thread->ProcessNextEvent(); if (NS_FAILED(rv)) return rv; } diff --git a/mozilla/extensions/webservices/security/src/nsWSAUtils.cpp b/mozilla/extensions/webservices/security/src/nsWSAUtils.cpp index adc5d7b27ce..e8b73bb52e7 100755 --- a/mozilla/extensions/webservices/security/src/nsWSAUtils.cpp +++ b/mozilla/extensions/webservices/security/src/nsWSAUtils.cpp @@ -245,7 +245,7 @@ nsWSAUtils::GetOfficialHostName(nsIURI* aServiceURI, listener, thread, getter_AddRefs(dummy)); while (NS_SUCCEEDED(rv) && !listener->mLookupFinished) - rv = thread->RunNextTask(nsIThread::RUN_NORMAL); + rv = thread->ProcessNextEvent(); aResult.Assign(listener->mOfficialHostName); return rv; diff --git a/mozilla/extensions/xmlextras/base/src/nsDOMParser.cpp b/mozilla/extensions/xmlextras/base/src/nsDOMParser.cpp index 8f137d8273c..94c5533524c 100644 --- a/mozilla/extensions/xmlextras/base/src/nsDOMParser.cpp +++ b/mozilla/extensions/xmlextras/base/src/nsDOMParser.cpp @@ -371,7 +371,7 @@ nsDOMParser::ParseFromStream(nsIInputStream *stream, // document object. That event may have already fired. while (NS_SUCCEEDED(rv) && mLoopingForSyncLoad) { - rv = thread->RunNextTask(nsIThread::RUN_NORMAL); + rv = thread->ProcessNextEvent(); } *_retval = domDocument; diff --git a/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp b/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp index 39bd7d88a09..9727ffb55d4 100644 --- a/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp +++ b/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp @@ -1631,7 +1631,7 @@ nsXMLHttpRequest::Send(nsIVariant *aBody) // If we're synchronous, spin an event loop here and wait if (!(mState & XML_HTTP_REQUEST_ASYNC)) { while (NS_SUCCEEDED(rv) && mState & XML_HTTP_REQUEST_SYNCLOOPING) - rv = thread->RunNextTask(nsIThread::RUN_NORMAL); + rv = thread->ProcessNextEvent(); } if (!mChannel) { diff --git a/mozilla/js/jsd/jsd_xpc.cpp b/mozilla/js/jsd/jsd_xpc.cpp index 15fc80db0ac..23f22ac406a 100644 --- a/mozilla/js/jsd/jsd_xpc.cpp +++ b/mozilla/js/jsd/jsd_xpc.cpp @@ -2955,7 +2955,7 @@ jsdService::EnterNestedEventLoop (jsdINestCallback *callback, PRUint32 *_rval) } while (NS_SUCCEEDED(rv) && mNestedLoopLevel >= nestLevel) - rv = thread->RunNextTask(nsIThread::RUN_NORMAL); + rv = thread->ProcessNextEvent(); JSContext* cx; stack->Pop(&cx); diff --git a/mozilla/layout/style/nsCSSLoader.cpp b/mozilla/layout/style/nsCSSLoader.cpp index a587c893549..dc5d77fec9a 100644 --- a/mozilla/layout/style/nsCSSLoader.cpp +++ b/mozilla/layout/style/nsCSSLoader.cpp @@ -135,7 +135,7 @@ static const char* const gStateStrings[] = { /******************************** * SheetLoadData implementation * ********************************/ -NS_IMPL_ISUPPORTS1(SheetLoadData, nsIUnicharStreamLoaderObserver) +NS_IMPL_ISUPPORTS2(SheetLoadData, nsIUnicharStreamLoaderObserver, nsIRunnable) SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, const nsSubstring& aTitle, diff --git a/mozilla/netwerk/base/public/nsIAsyncStreamCopier.idl b/mozilla/netwerk/base/public/nsIAsyncStreamCopier.idl index 39440939fb4..febfcef8cc7 100644 --- a/mozilla/netwerk/base/public/nsIAsyncStreamCopier.idl +++ b/mozilla/netwerk/base/public/nsIAsyncStreamCopier.idl @@ -40,7 +40,7 @@ interface nsIInputStream; interface nsIOutputStream; interface nsIRequestObserver; -interface nsIDispatchTarget; +interface nsIEventTarget; [scriptable, uuid(72e515de-a91e-4154-bb78-e5244cbaae74)] interface nsIAsyncStreamCopier : nsIRequest @@ -69,7 +69,7 @@ interface nsIAsyncStreamCopier : nsIRequest */ void init(in nsIInputStream aSource, in nsIOutputStream aSink, - in nsIDispatchTarget aTarget, + in nsIEventTarget aTarget, in boolean aSourceBuffered, in boolean aSinkBuffered, in unsigned long aChunkSize); diff --git a/mozilla/netwerk/base/public/nsIInputStreamPump.idl b/mozilla/netwerk/base/public/nsIInputStreamPump.idl index 1a6a6d9ad42..5505e389821 100644 --- a/mozilla/netwerk/base/public/nsIInputStreamPump.idl +++ b/mozilla/netwerk/base/public/nsIInputStreamPump.idl @@ -47,7 +47,7 @@ interface nsIStreamListener; * This interface provides a means to configure and use a input stream pump * instance. The input stream pump will asynchronously read from a input * stream, and push data to a nsIStreamListener instance. It utilizes the - * current thread's nsIDispatchTarget in order to make reading from the stream + * current thread's nsIEventTarget in order to make reading from the stream * asynchronous. * * If the given stream supports nsIAsyncInputStream, then the stream pump will diff --git a/mozilla/netwerk/base/public/nsIRequestObserverProxy.idl b/mozilla/netwerk/base/public/nsIRequestObserverProxy.idl index 752ea1014af..81033885630 100644 --- a/mozilla/netwerk/base/public/nsIRequestObserverProxy.idl +++ b/mozilla/netwerk/base/public/nsIRequestObserverProxy.idl @@ -38,7 +38,7 @@ #include "nsIRequestObserver.idl" -interface nsIDispatchTarget; +interface nsIEventTarget; /** * A request observer proxy is used to ship data over to another thread @@ -55,8 +55,8 @@ interface nsIRequestObserverProxy : nsIRequestObserver * Initializes an nsIRequestObserverProxy. * * @param observer - receives observer notifications on the other thread - * @param target - may be NULL indicating the calling thread's dispatch target + * @param target - may be NULL indicating the calling thread's event target */ void init(in nsIRequestObserver observer, - in nsIDispatchTarget eventQ); + in nsIEventTarget target); }; diff --git a/mozilla/netwerk/base/public/nsIServerSocket.idl b/mozilla/netwerk/base/public/nsIServerSocket.idl index e9f3be9a043..38bd20b160f 100644 --- a/mozilla/netwerk/base/public/nsIServerSocket.idl +++ b/mozilla/netwerk/base/public/nsIServerSocket.idl @@ -103,8 +103,7 @@ interface nsIServerSocket : nsISupports * asynchronously listen for and accept client connections. The listener * will be notified once for each client connection that is accepted. The * listener's onSocketAccepted method will be called on the same thread - * that called asyncListen (the calling thread must have a - * nsIDispatchTarget). + * that called asyncListen (the calling thread must have a nsIEventTarget). * * The listener will be passed a reference to an already connected socket * transport (nsISocketTransport). See below for more details. diff --git a/mozilla/netwerk/base/public/nsITransport.idl b/mozilla/netwerk/base/public/nsITransport.idl index b9fcf5b65f5..40f1c3267ad 100644 --- a/mozilla/netwerk/base/public/nsITransport.idl +++ b/mozilla/netwerk/base/public/nsITransport.idl @@ -40,7 +40,7 @@ interface nsIInputStream; interface nsIOutputStream; interface nsITransportEventSink; -interface nsIDispatchTarget; +interface nsIEventTarget; /** * nsITransport @@ -149,13 +149,13 @@ interface nsITransport : nsISupports * * @param aSink * receives transport layer notifications - * @param aDispatchTarget - * indicates the dispatch target to which the notifications should + * @param aEventTarget + * indicates the event target to which the notifications should * be delivered. if NULL, then the notifications may occur on * any thread. */ void setEventSink(in nsITransportEventSink aSink, - in nsIDispatchTarget aDispatchTarget); + in nsIEventTarget aEventTarget); /** * Generic nsITransportEventSink status codes. nsITransport diff --git a/mozilla/netwerk/base/public/nsNetUtil.h b/mozilla/netwerk/base/public/nsNetUtil.h index e7148ff3df4..906f4f9a062 100644 --- a/mozilla/netwerk/base/public/nsNetUtil.h +++ b/mozilla/netwerk/base/public/nsNetUtil.h @@ -367,7 +367,7 @@ inline nsresult NS_NewAsyncStreamCopier(nsIAsyncStreamCopier **result, nsIInputStream *source, nsIOutputStream *sink, - nsIDispatchTarget *target, + nsIEventTarget *target, PRBool sourceBuffered = PR_TRUE, PRBool sinkBuffered = PR_TRUE, PRUint32 chunkSize = 0) @@ -532,7 +532,7 @@ NS_ImplementChannelOpen(nsIChannel *channel, inline nsresult NS_NewRequestObserverProxy(nsIRequestObserver **result, nsIRequestObserver *observer, - nsIDispatchTarget *target = nsnull) + nsIEventTarget *target = nsnull) { nsresult rv; nsCOMPtr proxy = diff --git a/mozilla/netwerk/base/src/nsAsyncStreamCopier.cpp b/mozilla/netwerk/base/src/nsAsyncStreamCopier.cpp index eca61d41e50..5430d15187b 100644 --- a/mozilla/netwerk/base/src/nsAsyncStreamCopier.cpp +++ b/mozilla/netwerk/base/src/nsAsyncStreamCopier.cpp @@ -36,7 +36,7 @@ * ***** END LICENSE BLOCK ***** */ #include "nsAsyncStreamCopier.h" -#include "nsIDispatchTarget.h" +#include "nsIEventTarget.h" #include "nsStreamUtils.h" #include "nsNetSegmentUtils.h" #include "nsNetUtil.h" @@ -221,7 +221,7 @@ nsAsyncStreamCopier::SetLoadGroup(nsILoadGroup *aLoadGroup) NS_IMETHODIMP nsAsyncStreamCopier::Init(nsIInputStream *source, nsIOutputStream *sink, - nsIDispatchTarget *target, + nsIEventTarget *target, PRBool sourceBuffered, PRBool sinkBuffered, PRUint32 chunkSize) diff --git a/mozilla/netwerk/base/src/nsAsyncStreamCopier.h b/mozilla/netwerk/base/src/nsAsyncStreamCopier.h index c005564d69f..a103c349388 100644 --- a/mozilla/netwerk/base/src/nsAsyncStreamCopier.h +++ b/mozilla/netwerk/base/src/nsAsyncStreamCopier.h @@ -74,7 +74,7 @@ private: nsCOMPtr mObserver; nsCOMPtr mObserverContext; - nsCOMPtr mTarget; + nsCOMPtr mTarget; PRLock *mLock; diff --git a/mozilla/netwerk/base/src/nsBaseContentStream.cpp b/mozilla/netwerk/base/src/nsBaseContentStream.cpp index 0ba4215e937..8e4f63e4392 100644 --- a/mozilla/netwerk/base/src/nsBaseContentStream.cpp +++ b/mozilla/netwerk/base/src/nsBaseContentStream.cpp @@ -136,7 +136,7 @@ nsBaseContentStream::CloseWithStatus(nsresult status) NS_IMETHODIMP nsBaseContentStream::AsyncWait(nsIInputStreamCallback *callback, PRUint32 flags, PRUint32 requestedCount, - nsIDispatchTarget *target) + nsIEventTarget *target) { // Our _only_ consumer is nsInputStreamPump, so we simplify things here by // making assumptions about how we will be called. diff --git a/mozilla/netwerk/base/src/nsBaseContentStream.h b/mozilla/netwerk/base/src/nsBaseContentStream.h index 14d0ea42859..7d2f6bd4188 100644 --- a/mozilla/netwerk/base/src/nsBaseContentStream.h +++ b/mozilla/netwerk/base/src/nsBaseContentStream.h @@ -39,7 +39,7 @@ #define nsBaseContentStream_h__ #include "nsIAsyncInputStream.h" -#include "nsIDispatchTarget.h" +#include "nsIEventTarget.h" #include "nsCOMPtr.h" //----------------------------------------------------------------------------- @@ -85,7 +85,7 @@ public: PRBool HasPendingCallback() { return mCallback != nsnull; } // The current dispatch target (may be null) for the pending callback if any. - nsIDispatchTarget *CallbackTarget() { return mCallbackTarget; } + nsIEventTarget *CallbackTarget() { return mCallbackTarget; } // Called to dispatch a pending callback. If there is no pending callback, // then this function does nothing. Pass true to this function to cause the @@ -98,7 +98,7 @@ public: private: nsCOMPtr mCallback; - nsCOMPtr mCallbackTarget; + nsCOMPtr mCallbackTarget; nsresult mStatus; PRPackedBool mNonBlocking; }; diff --git a/mozilla/netwerk/base/src/nsRequestObserverProxy.cpp b/mozilla/netwerk/base/src/nsRequestObserverProxy.cpp index c146acaadc0..0f7f8fb58bd 100644 --- a/mozilla/netwerk/base/src/nsRequestObserverProxy.cpp +++ b/mozilla/netwerk/base/src/nsRequestObserverProxy.cpp @@ -223,7 +223,7 @@ nsRequestObserverProxy::OnStopRequest(nsIRequest *request, NS_IMETHODIMP nsRequestObserverProxy::Init(nsIRequestObserver *observer, - nsIDispatchTarget *target) + nsIEventTarget *target) { NS_ENSURE_ARG_POINTER(observer); diff --git a/mozilla/netwerk/base/src/nsRequestObserverProxy.h b/mozilla/netwerk/base/src/nsRequestObserverProxy.h index e99a3f674d0..83a2f054f18 100644 --- a/mozilla/netwerk/base/src/nsRequestObserverProxy.h +++ b/mozilla/netwerk/base/src/nsRequestObserverProxy.h @@ -59,14 +59,14 @@ public: nsIRequestObserver *Observer() { return mObserver; } nsresult FireEvent(nsARequestObserverEvent *); - nsIDispatchTarget *Target() { return mTarget; } // debugging aid - void SetTarget(nsIDispatchTarget *target) { mTarget = target; } + nsIEventTarget *Target() { return mTarget; } // debugging aid + void SetTarget(nsIEventTarget *target) { mTarget = target; } protected: virtual ~nsRequestObserverProxy(); nsCOMPtr mObserver; - nsCOMPtr mTarget; + nsCOMPtr mTarget; friend class nsOnStartRequestEvent; friend class nsOnStopRequestEvent; diff --git a/mozilla/netwerk/base/src/nsSocketTransport2.cpp b/mozilla/netwerk/base/src/nsSocketTransport2.cpp index 63f34292fe7..bfb812f216e 100644 --- a/mozilla/netwerk/base/src/nsSocketTransport2.cpp +++ b/mozilla/netwerk/base/src/nsSocketTransport2.cpp @@ -399,7 +399,7 @@ NS_IMETHODIMP nsSocketInputStream::AsyncWait(nsIInputStreamCallback *callback, PRUint32 flags, PRUint32 amount, - nsIDispatchTarget *target) + nsIEventTarget *target) { LOG(("nsSocketInputStream::AsyncWait [this=%x]\n", this)); @@ -630,7 +630,7 @@ NS_IMETHODIMP nsSocketOutputStream::AsyncWait(nsIOutputStreamCallback *callback, PRUint32 flags, PRUint32 amount, - nsIDispatchTarget *target) + nsIEventTarget *target) { LOG(("nsSocketOutputStream::AsyncWait [this=%x]\n", this)); @@ -1693,7 +1693,7 @@ nsSocketTransport::SetSecurityCallbacks(nsIInterfaceRequestor *callbacks) NS_IMETHODIMP nsSocketTransport::SetEventSink(nsITransportEventSink *sink, - nsIDispatchTarget *target) + nsIEventTarget *target) { nsCOMPtr temp; if (target) { diff --git a/mozilla/netwerk/base/src/nsSocketTransportService2.cpp b/mozilla/netwerk/base/src/nsSocketTransportService2.cpp index 82d11bd31cd..e7879bdefd6 100644 --- a/mozilla/netwerk/base/src/nsSocketTransportService2.cpp +++ b/mozilla/netwerk/base/src/nsSocketTransportService2.cpp @@ -97,12 +97,12 @@ nsSocketTransportService::~nsSocketTransportService() // event queue (any thread) NS_IMETHODIMP -nsSocketTransportService::Dispatch(nsIRunnable *task, PRUint32 flags) +nsSocketTransportService::Dispatch(nsIRunnable *event, PRUint32 flags) { - LOG(("STS dispatch [%p]\n", task)); + LOG(("STS dispatch [%p]\n", event)); NS_ENSURE_TRUE(mThread, NS_ERROR_NOT_INITIALIZED); - return mThread->Dispatch(task, flags); + return mThread->Dispatch(event, flags); } NS_IMETHODIMP @@ -127,7 +127,7 @@ nsSocketTransportService::NotifyWhenCanAttachSocket(nsIRunnable *event) return Dispatch(event, NS_DISPATCH_NORMAL); } - mPendingSocketQ.PutTask(event); + mPendingSocketQ.PutEvent(event); return NS_OK; } @@ -173,11 +173,10 @@ nsSocketTransportService::DetachSocket(SocketContext *sock) // // notify the first element on the pending socket queue... // - //if (!PR_CLIST_IS_EMPTY(&mPendingSocketQ)) { - nsCOMPtr task; - if (mPendingSocketQ.GetPendingTask(getter_AddRefs(task))) { - // move task from pending queue to dispatch queue - return Dispatch(task, NS_DISPATCH_NORMAL); + nsCOMPtr event; + if (mPendingSocketQ.GetPendingEvent(getter_AddRefs(event))) { + // move event from pending queue to dispatch queue + return Dispatch(event, NS_DISPATCH_NORMAL); } return NS_OK; } @@ -335,7 +334,7 @@ nsSocketTransportService::Poll(PRBool wait, PRUint32 *interval) NS_IMPL_THREADSAFE_ISUPPORTS5(nsSocketTransportService, nsISocketTransportService, - nsIDispatchTarget, + nsIEventTarget, nsIThreadObserver, nsIRunnable, nsPISocketTransportService) @@ -445,7 +444,7 @@ nsSocketTransportService::SetAutodialEnabled(PRBool value) } NS_IMETHODIMP -nsSocketTransportService::OnNewTask(nsIThreadInternal *thread, PRUint32 flags) +nsSocketTransportService::OnDispatchEvent(nsIThreadInternal *thread, PRUint32 flags) { if (mThreadEvent) PR_SetPollableEvent(mThreadEvent); @@ -453,27 +452,22 @@ nsSocketTransportService::OnNewTask(nsIThreadInternal *thread, PRUint32 flags) } NS_IMETHODIMP -nsSocketTransportService::OnBeforeRunNextTask(nsIThreadInternal *thread, - PRUint32 flags) -{ - return NS_OK; -} - -NS_IMETHODIMP -nsSocketTransportService::OnAfterRunNextTask(nsIThreadInternal *thread, - PRUint32 flags, nsresult status) +nsSocketTransportService::OnEnterProcessNextEvent(nsIThreadInternal *thread, + PRBool mayWait) { + // Favor processing existing sockets before other events. DoPollIteration(PR_FALSE); + + PRBool val; + while (mayWait && NS_SUCCEEDED(thread->HasPendingEvents(&val)) && !val) + DoPollIteration(PR_TRUE); return NS_OK; } NS_IMETHODIMP -nsSocketTransportService::OnWaitNextTask(nsIThreadInternal *thread, - PRUint32 flags) +nsSocketTransportService::OnLeaveProcessNextEvent(nsIThreadInternal *thread, + nsresult status) { - PRBool val; - while (NS_SUCCEEDED(thread->HasPendingTask(&val)) && !val) - DoPollIteration(PR_TRUE); return NS_OK; } @@ -488,26 +482,25 @@ nsSocketTransportService::Run() mPollList[0].fd = mThreadEvent; mPollList[0].in_flags = PR_POLL_READ; - nsresult rv; nsCOMPtr thread = do_GetCurrentThread(); - // hook ourselves up to observe task processing for this thread + // hook ourselves up to observe event processing for this thread nsCOMPtr threadInternal = do_QueryInterface(mThread); threadInternal->SetObserver(this); for (;;) { - // process all pending tasks - NS_RunPendingTasks(thread); + // process all pending events + NS_ProcessPendingEvents(thread); - // now that our task queue is empty, check to see if we should exit + // now that our event queue is empty, check to see if we should exit { nsAutoLock lock(mLock); if (mShuttingDown) break; } - // wait for and process the next pending task - thread->RunNextTask(nsIThread::RUN_NORMAL); + // wait for and process the next pending event + thread->ProcessNextEvent(); } LOG(("STS shutting down thread\n")); @@ -521,7 +514,7 @@ nsSocketTransportService::Run() // Final pass over the event queue. This makes sure that events posted by // socket detach handlers get processed. - NS_RunPendingTasks(thread); + NS_ProcessPendingEvents(thread); gSocketThread = nsnull; diff --git a/mozilla/netwerk/base/src/nsSocketTransportService2.h b/mozilla/netwerk/base/src/nsSocketTransportService2.h index 5e56a3b118f..3d268c58738 100644 --- a/mozilla/netwerk/base/src/nsSocketTransportService2.h +++ b/mozilla/netwerk/base/src/nsSocketTransportService2.h @@ -42,7 +42,7 @@ #include "nsPISocketTransportService.h" #include "nsIThreadInternal.h" #include "nsThreadUtils.h" -#include "nsTaskQueue.h" +#include "nsEventQueue.h" #include "nsCOMPtr.h" #include "pldhash.h" #include "prinrval.h" @@ -125,7 +125,7 @@ public: //----------------------------------------------------------------------------- class nsSocketTransportService : public nsPISocketTransportService - , public nsIDispatchTarget + , public nsIEventTarget , public nsIThreadObserver , public nsIRunnable { @@ -133,7 +133,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSPISOCKETTRANSPORTSERVICE NS_DECL_NSISOCKETTRANSPORTSERVICE - NS_DECL_NSIDISPATCHTARGET + NS_DECL_NSIEVENTTARGET NS_DECL_NSITHREADOBSERVER NS_DECL_NSIRUNNABLE @@ -246,7 +246,7 @@ private: // pending socket queue - see NotifyWhenCanAttachSocket //------------------------------------------------------------------------- - nsTaskQueue mPendingSocketQ; // queue of nsIRunnable objects + nsEventQueue mPendingSocketQ; // queue of nsIRunnable objects }; extern nsSocketTransportService *gSocketTransportService; diff --git a/mozilla/netwerk/base/src/nsStreamTransportService.cpp b/mozilla/netwerk/base/src/nsStreamTransportService.cpp index 062daea926b..e054d61a848 100644 --- a/mozilla/netwerk/base/src/nsStreamTransportService.cpp +++ b/mozilla/netwerk/base/src/nsStreamTransportService.cpp @@ -52,7 +52,6 @@ #include "nsITransport.h" #include "nsIRunnable.h" #include "nsIProxyObjectManager.h" -#include "nsIDispatchTarget.h" //----------------------------------------------------------------------------- // nsInputStreamTransport @@ -119,7 +118,7 @@ nsInputStreamTransport::OpenInputStream(PRUint32 flags, NS_ENSURE_TRUE(!mInProgress, NS_ERROR_IN_PROGRESS); nsresult rv; - nsCOMPtr target = + nsCOMPtr target = do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; @@ -172,7 +171,7 @@ nsInputStreamTransport::Close(nsresult reason) NS_IMETHODIMP nsInputStreamTransport::SetEventSink(nsITransportEventSink *sink, - nsIDispatchTarget *target) + nsIEventTarget *target) { NS_ENSURE_TRUE(!mInProgress, NS_ERROR_IN_PROGRESS); @@ -332,7 +331,7 @@ nsOutputStreamTransport::OpenOutputStream(PRUint32 flags, NS_ENSURE_TRUE(!mInProgress, NS_ERROR_IN_PROGRESS); nsresult rv; - nsCOMPtr target = + nsCOMPtr target = do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; @@ -374,7 +373,7 @@ nsOutputStreamTransport::Close(nsresult reason) NS_IMETHODIMP nsOutputStreamTransport::SetEventSink(nsITransportEventSink *sink, - nsIDispatchTarget *target) + nsIEventTarget *target) { NS_ENSURE_TRUE(!mInProgress, NS_ERROR_IN_PROGRESS); @@ -491,7 +490,7 @@ nsStreamTransportService::Init() NS_IMPL_THREADSAFE_ISUPPORTS2(nsStreamTransportService, nsIStreamTransportService, - nsIDispatchTarget) + nsIEventTarget) NS_IMETHODIMP nsStreamTransportService::Dispatch(nsIRunnable *task, PRUint32 flags) diff --git a/mozilla/netwerk/base/src/nsStreamTransportService.h b/mozilla/netwerk/base/src/nsStreamTransportService.h index d323fade6a3..14044e8a984 100644 --- a/mozilla/netwerk/base/src/nsStreamTransportService.h +++ b/mozilla/netwerk/base/src/nsStreamTransportService.h @@ -36,17 +36,17 @@ * ***** END LICENSE BLOCK ***** */ #include "nsIStreamTransportService.h" -#include "nsIDispatchTarget.h" +#include "nsIEventTarget.h" #include "nsIThreadPool.h" #include "nsCOMPtr.h" class nsStreamTransportService : public nsIStreamTransportService - , public nsIDispatchTarget + , public nsIEventTarget { public: NS_DECL_ISUPPORTS NS_DECL_NSISTREAMTRANSPORTSERVICE - NS_DECL_NSIDISPATCHTARGET + NS_DECL_NSIEVENTTARGET nsresult Init(); diff --git a/mozilla/netwerk/base/src/nsSyncStreamListener.cpp b/mozilla/netwerk/base/src/nsSyncStreamListener.cpp index 42a1aa933e6..28479cd3aa4 100644 --- a/mozilla/netwerk/base/src/nsSyncStreamListener.cpp +++ b/mozilla/netwerk/base/src/nsSyncStreamListener.cpp @@ -62,7 +62,7 @@ nsSyncStreamListener::WaitForData() mKeepWaiting = PR_TRUE; while (mKeepWaiting) { - rv = mThread->RunNextTask(nsIThread::RUN_NORMAL); + rv = mThread->ProcessNextEvent(); if (NS_FAILED(rv)) return rv; } diff --git a/mozilla/netwerk/base/src/nsTransportUtils.cpp b/mozilla/netwerk/base/src/nsTransportUtils.cpp index fbbaaf90e5f..529a8d5e380 100644 --- a/mozilla/netwerk/base/src/nsTransportUtils.cpp +++ b/mozilla/netwerk/base/src/nsTransportUtils.cpp @@ -53,7 +53,7 @@ public: NS_DECL_NSITRANSPORTEVENTSINK nsTransportEventSinkProxy(nsITransportEventSink *sink, - nsIDispatchTarget *target, + nsIEventTarget *target, PRBool coalesceAll) : mSink(sink) , mTarget(target) @@ -75,7 +75,7 @@ public: } nsITransportEventSink *mSink; - nsCOMPtr mTarget; + nsCOMPtr mTarget; PRLock *mLock; nsTransportStatusEvent *mLastEvent; PRBool mCoalesceAll; @@ -166,7 +166,7 @@ nsTransportEventSinkProxy::OnTransportStatus(nsITransport *transport, nsresult net_NewTransportEventSinkProxy(nsITransportEventSink **result, nsITransportEventSink *sink, - nsIDispatchTarget *target, + nsIEventTarget *target, PRBool coalesceAll) { *result = new nsTransportEventSinkProxy(sink, target, coalesceAll); diff --git a/mozilla/netwerk/base/src/nsTransportUtils.h b/mozilla/netwerk/base/src/nsTransportUtils.h index a808c3a4c50..b579b0357b0 100644 --- a/mozilla/netwerk/base/src/nsTransportUtils.h +++ b/mozilla/netwerk/base/src/nsTransportUtils.h @@ -55,7 +55,7 @@ NS_HIDDEN_(nsresult) net_NewTransportEventSinkProxy(nsITransportEventSink **aResult, nsITransportEventSink *aSink, - nsIDispatchTarget *aTarget, + nsIEventTarget *aTarget, PRBool aCoalesceAllEvents = PR_FALSE); #endif // nsTransportUtils_h__ diff --git a/mozilla/netwerk/dns/public/nsIDNSService.idl b/mozilla/netwerk/dns/public/nsIDNSService.idl index 7699c0b77ec..d7d5e135c2b 100644 --- a/mozilla/netwerk/dns/public/nsIDNSService.idl +++ b/mozilla/netwerk/dns/public/nsIDNSService.idl @@ -39,7 +39,7 @@ #include "nsISupports.idl" interface nsICancelable; -interface nsIDispatchTarget; +interface nsIEventTarget; interface nsIDNSRecord; interface nsIDNSListener; @@ -60,7 +60,7 @@ interface nsIDNSService : nsISupports * the listener to be notified when the result is available. * @param aListenerTarget * optional parameter (may be null). if non-null, this parameter - * specifies the nsIDispatchTarget of the thread on which the + * specifies the nsIEventTarget of the thread on which the * listener's onLookupComplete should be called. however, if this * parameter is null, then onLookupComplete will be called on an * unspecified thread (possibly recursively). @@ -70,7 +70,7 @@ interface nsIDNSService : nsISupports nsICancelable asyncResolve(in AUTF8String aHostName, in unsigned long aFlags, in nsIDNSListener aListener, - in nsIDispatchTarget aListenerTarget); + in nsIEventTarget aListenerTarget); /** * called to synchronously resolve a hostname. warning this method may diff --git a/mozilla/netwerk/dns/src/nsDNSService2.cpp b/mozilla/netwerk/dns/src/nsDNSService2.cpp index 6aa567e1a93..c63d9c296dd 100644 --- a/mozilla/netwerk/dns/src/nsDNSService2.cpp +++ b/mozilla/netwerk/dns/src/nsDNSService2.cpp @@ -375,7 +375,7 @@ NS_IMETHODIMP nsDNSService::AsyncResolve(const nsACString &hostname, PRUint32 flags, nsIDNSListener *listener, - nsIDispatchTarget *target, + nsIEventTarget *target, nsICancelable **result) { // grab reference to global host resolver and IDN service. beware diff --git a/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp b/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp index 2a8708f1535..b1fb5c63cb5 100644 --- a/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp +++ b/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp @@ -74,7 +74,7 @@ public: // callback is dispatched when the file copy completes. nsresult Dispatch(nsIOutputStreamCallback *callback, nsITransportEventSink *sink, - nsIDispatchTarget *target); + nsIEventTarget *target); // Call this method to interrupt a file copy operation that is occuring on // a background thread. The status parameter passed to this function must @@ -151,7 +151,7 @@ nsFileCopyEvent::DoCopy() nsresult nsFileCopyEvent::Dispatch(nsIOutputStreamCallback *callback, nsITransportEventSink *sink, - nsIDispatchTarget *target) + nsIEventTarget *target) { // Use the supplied event target for all asynchronous operations. @@ -167,7 +167,7 @@ nsFileCopyEvent::Dispatch(nsIOutputStreamCallback *callback, return rv; // Dispatch ourselves to I/O thread pool... - nsCOMPtr pool = + nsCOMPtr pool = do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; @@ -199,7 +199,7 @@ public: NS_IMETHODIMP ReadSegments(nsWriteSegmentFun fun, void *closure, PRUint32 count, PRUint32 *result); NS_IMETHODIMP AsyncWait(nsIInputStreamCallback *callback, PRUint32 flags, - PRUint32 count, nsIDispatchTarget *target); + PRUint32 count, nsIEventTarget *target); private: nsFileCopyEvent mCopyEvent; @@ -236,7 +236,7 @@ nsFileUploadContentStream::ReadSegments(nsWriteSegmentFun fun, void *closure, NS_IMETHODIMP nsFileUploadContentStream::AsyncWait(nsIInputStreamCallback *callback, PRUint32 flags, PRUint32 count, - nsIDispatchTarget *target) + nsIEventTarget *target) { nsresult rv = nsBaseContentStream::AsyncWait(callback, flags, count, target); if (NS_FAILED(rv) || IsClosed()) diff --git a/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp index 265f0e560d4..c994b988445 100644 --- a/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp +++ b/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp @@ -1892,7 +1892,7 @@ nsFtpState::R_pasv() { // perform the data copy on the socket transport thread. we do this // because "output" is a socket output stream, so the result is that // all work will be done on the socket transport thread. - nsCOMPtr stTarget = do_GetService(kSocketTransportServiceCID, &rv); + nsCOMPtr stTarget = do_GetService(kSocketTransportServiceCID, &rv); if (NS_FAILED(rv)) return FTP_ERROR; nsCOMPtr copier; diff --git a/mozilla/netwerk/protocol/gopher/src/nsGopherChannel.cpp b/mozilla/netwerk/protocol/gopher/src/nsGopherChannel.cpp index 917d4bc0e1a..5e340f68883 100644 --- a/mozilla/netwerk/protocol/gopher/src/nsGopherChannel.cpp +++ b/mozilla/netwerk/protocol/gopher/src/nsGopherChannel.cpp @@ -81,14 +81,14 @@ public: PRUint32 count, PRUint32 *result); NS_IMETHOD CloseWithStatus(nsresult status); NS_IMETHOD AsyncWait(nsIInputStreamCallback *callback, PRUint32 flags, - PRUint32 count, nsIDispatchTarget *target); + PRUint32 count, nsIEventTarget *target); nsGopherContentStream(nsGopherChannel *channel) : nsBaseContentStream(PR_TRUE) // non-blocking , mChannel(channel) { } - nsresult OpenSocket(nsIDispatchTarget *target); + nsresult OpenSocket(nsIEventTarget *target); nsresult OnSocketWritable(); nsresult ParseTypeAndSelector(char &type, nsCString &selector); nsresult PromptForQueryString(nsCString &result); @@ -144,7 +144,7 @@ nsGopherContentStream::CloseWithStatus(nsresult status) NS_IMETHODIMP nsGopherContentStream::AsyncWait(nsIInputStreamCallback *callback, PRUint32 flags, - PRUint32 count, nsIDispatchTarget *target) + PRUint32 count, nsIEventTarget *target) { nsresult rv = nsBaseContentStream::AsyncWait(callback, flags, count, target); if (NS_FAILED(rv) && IsClosed()) @@ -185,7 +185,7 @@ nsGopherContentStream::OnOutputStreamReady(nsIAsyncOutputStream *stream) } nsresult -nsGopherContentStream::OpenSocket(nsIDispatchTarget *target) +nsGopherContentStream::OpenSocket(nsIEventTarget *target) { // This function is called to get things started. // diff --git a/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp b/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp index 4a635ca0e97..2dc38483c0c 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp @@ -106,7 +106,7 @@ nsHttpConnectionMgr::Init(PRUint16 maxConns, LOG(("nsHttpConnectionMgr::Init\n")); nsresult rv; - nsCOMPtr sts = do_GetService(kSocketTransportServiceCID, &rv); + nsCOMPtr sts = do_GetService(kSocketTransportServiceCID, &rv); if (NS_FAILED(rv)) return rv; nsAutoMonitor mon(mMonitor); @@ -222,7 +222,7 @@ nsHttpConnectionMgr::PruneDeadConnections() } nsresult -nsHttpConnectionMgr::GetSocketThreadTarget(nsIDispatchTarget **target) +nsHttpConnectionMgr::GetSocketThreadTarget(nsIEventTarget **target) { nsAutoMonitor mon(mMonitor); NS_IF_ADDREF(*target = mSocketThreadTarget); diff --git a/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.h b/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.h index 716e3b878e1..32a1e46e21e 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.h +++ b/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.h @@ -114,7 +114,7 @@ public: // called to get a reference to the socket transport service. the socket // transport service is not available when the connection manager is down. - nsresult GetSocketThreadTarget(nsIDispatchTarget **); + nsresult GetSocketThreadTarget(nsIEventTarget **); // called when a connection is done processing a transaction. if the // connection can be reused then it will be added to the idle list, else @@ -188,7 +188,7 @@ private: PRInt32 mRef; PRMonitor *mMonitor; - nsCOMPtr mSocketThreadTarget; + nsCOMPtr mSocketThreadTarget; // connection limits PRUint16 mMaxConns; diff --git a/mozilla/netwerk/protocol/http/src/nsHttpHandler.h b/mozilla/netwerk/protocol/http/src/nsHttpHandler.h index cce4ef12b82..6ee08e18f86 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpHandler.h +++ b/mozilla/netwerk/protocol/http/src/nsHttpHandler.h @@ -160,7 +160,7 @@ public: return mConnMgr->ProcessPendingQ(cinfo); } - nsresult GetSocketThreadTarget(nsIDispatchTarget **target) + nsresult GetSocketThreadTarget(nsIEventTarget **target) { return mConnMgr->GetSocketThreadTarget(target); } diff --git a/mozilla/netwerk/protocol/http/src/nsHttpTransaction.cpp b/mozilla/netwerk/protocol/http/src/nsHttpTransaction.cpp index 1073bf37d64..cc25f3d76f9 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpTransaction.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpTransaction.cpp @@ -165,7 +165,7 @@ nsHttpTransaction::Init(PRUint8 caps, nsHttpRequestHead *requestHead, nsIInputStream *requestBody, PRBool requestBodyHasHeaders, - nsIDispatchTarget *target, + nsIEventTarget *target, nsIInterfaceRequestor *callbacks, nsITransportEventSink *eventsink, nsIAsyncInputStream **responseBody) @@ -392,7 +392,7 @@ nsHttpTransaction::ReadSegments(nsAHttpSegmentReader *reader, nsCOMPtr asyncIn = do_QueryInterface(mRequestStream); if (asyncIn) { - nsCOMPtr target; + nsCOMPtr target; gHttpHandler->GetSocketThreadTarget(getter_AddRefs(target)); if (target) asyncIn->AsyncWait(this, 0, 0, target); @@ -456,7 +456,7 @@ nsHttpTransaction::WriteSegments(nsAHttpSegmentWriter *writer, // if pipe would block then we need to AsyncWait on it. have callback // occur on socket thread so we stay synchronized. if (rv == NS_BASE_STREAM_WOULD_BLOCK) { - nsCOMPtr target; + nsCOMPtr target; gHttpHandler->GetSocketThreadTarget(getter_AddRefs(target)); if (target) mPipeOut->AsyncWait(this, 0, 0, target); diff --git a/mozilla/netwerk/protocol/http/src/nsHttpTransaction.h b/mozilla/netwerk/protocol/http/src/nsHttpTransaction.h index 55655dc5c59..02829207fe2 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpTransaction.h +++ b/mozilla/netwerk/protocol/http/src/nsHttpTransaction.h @@ -52,7 +52,7 @@ #include "nsIInterfaceRequestor.h" #include "nsISocketTransportService.h" #include "nsITransport.h" -#include "nsIDispatchTarget.h" +#include "nsIEventTarget.h" //----------------------------------------------------------------------------- @@ -106,7 +106,7 @@ public: nsHttpRequestHead *reqHeaders, nsIInputStream *reqBody, PRBool reqBodyIncludesHeaders, - nsIDispatchTarget *consumerTarget, + nsIEventTarget *consumerTarget, nsIInterfaceRequestor *callbacks, nsITransportEventSink *eventsink, nsIAsyncInputStream **responseBody); @@ -119,7 +119,7 @@ public: nsISupports *SecurityInfo() { return mSecurityInfo; } nsIInterfaceRequestor *Callbacks() { return mCallbacks; } - nsIDispatchTarget *ConsumerTarget() { return mConsumerTarget; } + nsIEventTarget *ConsumerTarget() { return mConsumerTarget; } nsAHttpConnection *Connection() { return mConnection; } // Called to take ownership of the response headers; the transaction @@ -159,7 +159,7 @@ private: private: nsCOMPtr mCallbacks; nsCOMPtr mTransportSink; - nsCOMPtr mConsumerTarget; + nsCOMPtr mConsumerTarget; nsCOMPtr mSecurityInfo; nsCOMPtr mPipeIn; nsCOMPtr mPipeOut; diff --git a/mozilla/netwerk/streamconv/test/TestStreamConv.cpp b/mozilla/netwerk/streamconv/test/TestStreamConv.cpp index eac7ebddefb..e895ebd8adb 100644 --- a/mozilla/netwerk/streamconv/test/TestStreamConv.cpp +++ b/mozilla/netwerk/streamconv/test/TestStreamConv.cpp @@ -274,7 +274,7 @@ main(int argc, char* argv[]) // Enter the message pump to allow the URL load to proceed. while ( gKeepRunning ) { - rv = thread->RunNextTask(nsIThread::RUN_NORMAL); + rv = thread->ProcessNextEvent(); if (NS_FAILED(rv)) break; } diff --git a/mozilla/netwerk/test/TestCommon.h b/mozilla/netwerk/test/TestCommon.h index 8e78e62cc9e..0862dfc4b24 100644 --- a/mozilla/netwerk/test/TestCommon.h +++ b/mozilla/netwerk/test/TestCommon.h @@ -64,9 +64,9 @@ static void PumpEvents() gKeepPumpingEvents = PR_TRUE; while (gKeepPumpingEvents) - thread->RunNextTask(nsIThread::RUN_NORMAL); + thread->ProcessNextEvent(); - NS_RunPendingTasks(thread); + NS_ProcessPendingEvents(thread); } static void QuitPumpingEvents() diff --git a/mozilla/netwerk/test/TestIOThreads.cpp b/mozilla/netwerk/test/TestIOThreads.cpp index 59d7964b306..c60a154d592 100644 --- a/mozilla/netwerk/test/TestIOThreads.cpp +++ b/mozilla/netwerk/test/TestIOThreads.cpp @@ -38,7 +38,7 @@ #include "nsXPCOM.h" #include "nsIServiceManager.h" #include "nsServiceManagerUtils.h" -#include "nsIDispatchTarget.h" +#include "nsIEventTarget.h" #include "nsCOMPtr.h" #include "nsNetCID.h" #include "prlog.h" @@ -70,7 +70,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsIOEvent, nsIRunnable) static nsresult RunTest() { nsresult rv; - nsCOMPtr target = + nsCOMPtr target = do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/parser/htmlparser/tests/grabpage/grabpage.cpp b/mozilla/parser/htmlparser/tests/grabpage/grabpage.cpp index ddbdb69f4f8..9338f224618 100644 --- a/mozilla/parser/htmlparser/tests/grabpage/grabpage.cpp +++ b/mozilla/parser/htmlparser/tests/grabpage/grabpage.cpp @@ -262,7 +262,7 @@ PageGrabber::Grab(const nsCString& aURL) // Enter the message pump to allow the URL load to proceed. nsCOMPtr thread = do_GetCurrentThread(); while ( !copier->IsDone() ) { - rv = thread->RunNextTask(nsIThread::RUN_NORMAL); + rv = thread->ProcessNextEvent(); if (NS_FAILED(rv)) break; } diff --git a/mozilla/rdf/tests/rdfcat/rdfcat.cpp b/mozilla/rdf/tests/rdfcat/rdfcat.cpp index 634e45cc289..55b28f09fb1 100644 --- a/mozilla/rdf/tests/rdfcat/rdfcat.cpp +++ b/mozilla/rdf/tests/rdfcat/rdfcat.cpp @@ -169,7 +169,7 @@ main(int argc, char** argv) nsCOMPtr thread = do_GetCurrentThread(); PRBool done = PR_FALSE; while (!done) { - rv = thread->RunNextTask(nsIThread::RUN_NORMAL); + rv = thread->ProcessNextEvent(); if (NS_FAILED(rv)) return rv; remote->GetLoaded(&done); diff --git a/mozilla/rdf/tests/triplescat/triplescat.cpp b/mozilla/rdf/tests/triplescat/triplescat.cpp index 58bd766d176..2ee9cf64598 100644 --- a/mozilla/rdf/tests/triplescat/triplescat.cpp +++ b/mozilla/rdf/tests/triplescat/triplescat.cpp @@ -168,7 +168,7 @@ main(int argc, char** argv) nsCOMPtr thread = do_GetCurrentThread(); PRBool done = PR_FALSE; while (!done) { - rv = thread->RunNextTask(nsIThread::RUN_NORMAL); + rv = thread->ProcessNextEvent(); if (NS_FAILED(rv)) return rv; remote->GetLoaded(&done); diff --git a/mozilla/widget/src/gtk2/nsAppShell.cpp b/mozilla/widget/src/gtk2/nsAppShell.cpp index 938aff057ae..f45b3489f06 100644 --- a/mozilla/widget/src/gtk2/nsAppShell.cpp +++ b/mozilla/widget/src/gtk2/nsAppShell.cpp @@ -75,17 +75,19 @@ nsAppShell::Init(int *argc, char **argv) } NS_IMETHODIMP -nsAppShell::OnNewTask(nsIThreadInternal *thread, PRUint32 flags) +nsAppShell::OnDispatchEvent(nsIThreadInternal *thread, PRUint32 flags) { g_main_context_wakeup(NULL); return NS_OK; } NS_IMETHODIMP -nsAppShell::OnWaitNextTask(nsIThreadInternal *thread, PRUint32 flags) +nsAppShell::OnEnterProcessNextEvent(nsIThreadInternal *thread, PRBool mayWait) { PRBool val; - while (NS_SUCCEEDED(thread->HasPendingTask(&val)) && !val) - g_main_context_iteration(NULL, TRUE); + while (NS_SUCCEEDED(thread->HasPendingEvents(&val)) && !val) { + if (!g_main_context_iteration(NULL, mayWait) && !mayWait) + break; + } return NS_OK; } diff --git a/mozilla/widget/src/gtk2/nsAppShell.h b/mozilla/widget/src/gtk2/nsAppShell.h index 04240e26243..11dd050c2d5 100644 --- a/mozilla/widget/src/gtk2/nsAppShell.h +++ b/mozilla/widget/src/gtk2/nsAppShell.h @@ -50,8 +50,9 @@ public: NS_IMETHOD Init(int *argc, char **argv); // nsIThreadObserver overrides: - NS_IMETHOD OnNewTask(nsIThreadInternal *thread, PRUint32 flags); - NS_IMETHOD OnWaitNextTask(nsIThreadInternal *thread, PRUint32 flags); + NS_IMETHOD OnDispatchEvent(nsIThreadInternal *thread, PRUint32 flags); + NS_IMETHOD OnEnterProcessNextEvent(nsIThreadInternal *thread, + PRBool mayWait); private: virtual ~nsAppShell() {} diff --git a/mozilla/widget/src/xpwidgets/nsBaseAppShell.cpp b/mozilla/widget/src/xpwidgets/nsBaseAppShell.cpp index 5ebec6dab9e..3ead5242995 100644 --- a/mozilla/widget/src/xpwidgets/nsBaseAppShell.cpp +++ b/mozilla/widget/src/xpwidgets/nsBaseAppShell.cpp @@ -69,9 +69,9 @@ nsBaseAppShell::Run(void) ++mKeepGoing; while (mKeepGoing) - thread->RunNextTask(nsIThread::RUN_NORMAL); + thread->ProcessNextEvent(); - NS_RunPendingTasks(thread); + NS_ProcessPendingEvents(thread); return NS_OK; } @@ -95,26 +95,21 @@ nsBaseAppShell::FavorPerformanceHint(PRBool favorPerfOverStarvation, // nsIThreadObserver methods: NS_IMETHODIMP -nsBaseAppShell::OnNewTask(nsIThreadInternal *thr, PRUint32 flags) +nsBaseAppShell::OnDispatchEvent(nsIThreadInternal *thr, PRUint32 flags) { return NS_OK; } NS_IMETHODIMP -nsBaseAppShell::OnBeforeRunNextTask(nsIThreadInternal *thr, PRUint32 flags) +nsBaseAppShell::OnEnterProcessNextEvent(nsIThreadInternal *thr, + PRBool mayWait) { return NS_OK; } NS_IMETHODIMP -nsBaseAppShell::OnAfterRunNextTask(nsIThreadInternal *thr, PRUint32 flags, - nsresult status) -{ - return NS_OK; -} - -NS_IMETHODIMP -nsBaseAppShell::OnWaitNextTask(nsIThreadInternal *thr, PRUint32 flags) +nsBaseAppShell::OnLeaveProcessNextEvent(nsIThreadInternal *thr, + nsresult status) { return NS_OK; } diff --git a/mozilla/xpcom/proxy/tests/proxytests.cpp b/mozilla/xpcom/proxy/tests/proxytests.cpp index f6f71b97703..04411f34a2c 100644 --- a/mozilla/xpcom/proxy/tests/proxytests.cpp +++ b/mozilla/xpcom/proxy/tests/proxytests.cpp @@ -385,12 +385,12 @@ static void PR_CALLBACK EventLoop( void *arg ) while ( PR_SUCCESS == PR_Sleep( PR_MillisecondsToInterval(1)) ) { - rv = gEventThread->RunNextTask(nsIThread::RUN_NORMAL); + rv = gEventThread->ProcessNextEvent(); if (NS_FAILED(rv)) return; } - NS_RunPendingTasks(gEventThread); + NS_ProcessPendingEvents(gEventThread); printf("Closing down Event Thread.\n"); NS_RELEASE(gEventThread); diff --git a/mozilla/xpfe/appshell/src/nsXULWindow.cpp b/mozilla/xpfe/appshell/src/nsXULWindow.cpp index f32ef769e92..6b48bb92a90 100644 --- a/mozilla/xpfe/appshell/src/nsXULWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsXULWindow.cpp @@ -394,7 +394,7 @@ NS_IMETHODIMP nsXULWindow::ShowModal() nsresult rv = NS_OK; if (stack && NS_SUCCEEDED(stack->Push(nsnull))) { while (NS_SUCCEEDED(rv) && mContinueModalLoop) - rv = thread->RunNextTask(nsIThread::RUN_NORMAL); + rv = thread->ProcessNextEvent(); JSContext* cx; stack->Pop(&cx); NS_ASSERTION(cx == nsnull, "JSContextStack mismatch"); @@ -1771,7 +1771,7 @@ NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(PRInt32 aChromeFlags, if (stack && NS_SUCCEEDED(stack->Push(nsnull))) { nsresult looprv = NS_OK; while (NS_SUCCEEDED(looprv) && xulWin->IsLocked()) - looprv = thread->RunNextTask(nsIThread::RUN_NORMAL); + looprv = thread->ProcessNextEvent(); JSContext *cx; stack->Pop(&cx); NS_ASSERTION(cx == nsnull, "JSContextStack mismatch");