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:
Ben Kelly 2016-09-13 20:12:15 -07:00
Родитель c0fc17d9f4
Коммит 46960c09a1
4 изменённых файлов: 9 добавлений и 6 удалений

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

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