mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1409664 - P8. Make explicit shutdown of TaskQueue optional. r=gerald
Summary: With this change TaskQueue no longer requires an explicit call to BeginShutdown(). The taskqueue will automatically shutdown once it's now longer referenced. Depends on D1620 Tags: #secure-revision Bug #: 1409664 Differential Revision: https://phabricator.services.mozilla.com/D1621
This commit is contained in:
parent
84177fa544
commit
1fc1c669ce
@ -89,8 +89,8 @@ TaskQueue::TaskQueue(already_AddRefed<nsIEventTarget> aTarget,
|
||||
|
||||
TaskQueue::~TaskQueue()
|
||||
{
|
||||
MonitorAutoLock mon(mQueueMonitor);
|
||||
MOZ_ASSERT(mIsShutdown);
|
||||
// No one is referencing this TaskQueue anymore, meaning no tasks can be
|
||||
// pending as all Runner hold a reference to this TaskQueue.
|
||||
}
|
||||
|
||||
TaskDispatcher&
|
||||
@ -178,7 +178,6 @@ TaskQueue::BeginShutdown()
|
||||
if (AbstractThread* currentThread = AbstractThread::GetCurrent()) {
|
||||
currentThread->TailDispatchTasksFor(this);
|
||||
}
|
||||
|
||||
MonitorAutoLock mon(mQueueMonitor);
|
||||
mIsShutdown = true;
|
||||
RefPtr<ShutdownPromise> p = mShutdownPromise.Ensure(__func__);
|
||||
|
@ -45,6 +45,10 @@ typedef MozPromise<bool, bool, false> ShutdownPromise;
|
||||
// This arrangement lets you prioritize work by dispatching runnables directly
|
||||
// to TQ1. You can issue many runnables for important work. Meanwhile the TQ2
|
||||
// and TQ3 work will always execute at most one runnable and then yield.
|
||||
//
|
||||
// A TaskQueue does not require explicit shutdown, however it provides a
|
||||
// BeginShutdown() method that places TaskQueue in a shut down state and returns
|
||||
// a promise that gets resolved once all pending tasks have completed
|
||||
class TaskQueue : public AbstractThread
|
||||
{
|
||||
class EventTargetWrapper;
|
||||
|
Loading…
Reference in New Issue
Block a user