зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1300118 P0 Rename NS_DISPATCH_TAIL to NS_DISPATCH_AT_END to avoid confusion with AbstractThread::TailDispatch. r=bholley
This commit is contained in:
Родитель
c0fc17d9f4
Коммит
46960c09a1
|
@ -58,7 +58,10 @@ public:
|
|||
// Call this when dispatching from an event on the same
|
||||
// threadpool that is about to complete. We should not create a new thread
|
||||
// in that case since a thread is about to become idle.
|
||||
nsresult TailDispatch(nsIRunnable *event) { return Dispatch(event, NS_DISPATCH_TAIL); }
|
||||
nsresult DispatchFromEndOfTaskInThisPool(nsIRunnable *event)
|
||||
{
|
||||
return Dispatch(event, NS_DISPATCH_AT_END);
|
||||
}
|
||||
|
||||
NS_IMETHOD DispatchFromScript(nsIRunnable *event, uint32_t flags) override {
|
||||
return Dispatch(event, flags);
|
||||
|
|
|
@ -195,7 +195,7 @@ TaskQueue::Runner::Run()
|
|||
// run in a loop here so that we don't hog the thread pool. This means we may
|
||||
// run on another thread next time, but we rely on the memory fences from
|
||||
// mQueueMonitor for thread safety of non-threadsafe tasks.
|
||||
nsresult rv = mQueue->mPool->TailDispatch(this);
|
||||
nsresult rv = mQueue->mPool->DispatchFromEndOfTaskInThisPool(this);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Failed to dispatch, shutdown!
|
||||
MonitorAutoLock mon(mQueue->mQueueMonitor);
|
||||
|
|
|
@ -50,7 +50,7 @@ interface nsIEventTarget : nsISupports
|
|||
*
|
||||
* These events are always async.
|
||||
*/
|
||||
const unsigned long DISPATCH_TAIL = 2;
|
||||
const unsigned long DISPATCH_AT_END = 2;
|
||||
|
||||
/**
|
||||
* Check to see if this event target is associated with the current thread.
|
||||
|
@ -123,5 +123,5 @@ interface nsIEventTarget : nsISupports
|
|||
// convenient aliases:
|
||||
#define NS_DISPATCH_NORMAL nsIEventTarget::DISPATCH_NORMAL
|
||||
#define NS_DISPATCH_SYNC nsIEventTarget::DISPATCH_SYNC
|
||||
#define NS_DISPATCH_TAIL nsIEventTarget::DISPATCH_TAIL
|
||||
#define NS_DISPATCH_AT_END nsIEventTarget::DISPATCH_AT_END
|
||||
%}
|
||||
|
|
|
@ -86,7 +86,7 @@ nsThreadPool::PutEvent(already_AddRefed<nsIRunnable> aEvent, uint32_t aFlags)
|
|||
|
||||
// Make sure we have a thread to service this event.
|
||||
if (mThreads.Count() < (int32_t)mThreadLimit &&
|
||||
!(aFlags & NS_DISPATCH_TAIL) &&
|
||||
!(aFlags & NS_DISPATCH_AT_END) &&
|
||||
// Spawn a new thread if we don't have enough idle threads to serve
|
||||
// pending events immediately.
|
||||
mEvents.Count(lock) >= mIdleCount) {
|
||||
|
@ -270,7 +270,7 @@ nsThreadPool::Dispatch(already_AddRefed<nsIRunnable> aEvent, uint32_t aFlags)
|
|||
}
|
||||
} else {
|
||||
NS_ASSERTION(aFlags == NS_DISPATCH_NORMAL ||
|
||||
aFlags == NS_DISPATCH_TAIL, "unexpected dispatch flags");
|
||||
aFlags == NS_DISPATCH_AT_END, "unexpected dispatch flags");
|
||||
PutEvent(Move(aEvent), aFlags);
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче