зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1190495 - Remove TaskQueue::SyncDispatch. r=cpearce
Looks like the last consumers of this went away. \o/
This commit is contained in:
Родитель
bdf89c24e4
Коммит
a7bc4c7844
|
@ -73,53 +73,6 @@ TaskQueue::DispatchLocked(already_AddRefed<nsIRunnable> aRunnable,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
class TaskQueueSyncRunnable : public nsRunnable {
|
||||
public:
|
||||
explicit TaskQueueSyncRunnable(already_AddRefed<nsIRunnable> aRunnable)
|
||||
: mRunnable(aRunnable)
|
||||
, mMonitor("TaskQueueSyncRunnable")
|
||||
, mDone(false)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD Run() {
|
||||
nsresult rv = mRunnable->Run();
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
mDone = true;
|
||||
mon.NotifyAll();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void WaitUntilDone() {
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
while (!mDone) {
|
||||
mon.Wait();
|
||||
}
|
||||
}
|
||||
private:
|
||||
RefPtr<nsIRunnable> mRunnable;
|
||||
Monitor mMonitor;
|
||||
bool mDone;
|
||||
};
|
||||
|
||||
void
|
||||
TaskQueue::SyncDispatch(already_AddRefed<nsIRunnable> aRunnable) {
|
||||
NS_WARNING("TaskQueue::SyncDispatch is dangerous and deprecated. Stop using this!");
|
||||
nsRefPtr<TaskQueueSyncRunnable> task(new TaskQueueSyncRunnable(Move(aRunnable)));
|
||||
|
||||
// Tail dispatchers don't interact nicely with sync dispatch. We require that
|
||||
// nothing is already in the tail dispatcher, and then sidestep it for this
|
||||
// task.
|
||||
MOZ_ASSERT_IF(AbstractThread::GetCurrent(),
|
||||
!AbstractThread::GetCurrent()->TailDispatcher().HasTasksFor(this));
|
||||
nsRefPtr<TaskQueueSyncRunnable> taskRef = task;
|
||||
Dispatch(taskRef.forget(), AssertDispatchSuccess, TailDispatch);
|
||||
|
||||
task->WaitUntilDone();
|
||||
}
|
||||
|
||||
void
|
||||
TaskQueue::AwaitIdle()
|
||||
{
|
||||
|
|
|
@ -49,10 +49,6 @@ public:
|
|||
unused << rv;
|
||||
}
|
||||
|
||||
// DEPRECATED! Do not us, if a flush happens at the same time, this function
|
||||
// can hang and block forever!
|
||||
void SyncDispatch(already_AddRefed<nsIRunnable> aRunnable);
|
||||
|
||||
// Puts the queue in a shutdown state and returns immediately. The queue will
|
||||
// remain alive at least until all the events are drained, because the Runners
|
||||
// hold a strong reference to the task queue, and one of them is always held
|
||||
|
|
Загрузка…
Ссылка в новой задаче