author | Bobby Holley <bobbyholley@gmail.com> |
Fri, 07 Aug 2015 16:59:54 -0700 | |
changeset 257243 | 9f162f396c26b23cf09b88ccdbc2a21bc5ae0200 |
parent 257242 | 446acb1f222c8c3172d5656c43b877bcc750b750 |
child 257244 | 030f756097026386cce95b67b6110f51985b2ef1 |
push id | 29210 |
push user | kwierso@gmail.com |
push date | Tue, 11 Aug 2015 22:35:38 +0000 |
treeherder | mozilla-central@7dcecc8a395d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | cpearce |
bugs | 1190495 |
milestone | 43.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
dom/media/TaskQueue.cpp | file | annotate | diff | comparison | revisions | |
dom/media/TaskQueue.h | file | annotate | diff | comparison | revisions |
--- a/dom/media/TaskQueue.cpp +++ b/dom/media/TaskQueue.cpp @@ -68,63 +68,16 @@ TaskQueue::DispatchLocked(already_AddRef NS_WARNING("Failed to dispatch runnable to run TaskQueue"); return rv; } mIsRunning = true; 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() { MonitorAutoLock mon(mQueueMonitor); AwaitIdleLocked(); } void
--- a/dom/media/TaskQueue.h +++ b/dom/media/TaskQueue.h @@ -44,20 +44,16 @@ public: DispatchReason aReason = NormalDispatch) override { MonitorAutoLock mon(mQueueMonitor); nsresult rv = DispatchLocked(Move(aRunnable), AbortIfFlushing, aFailureHandling, aReason); MOZ_DIAGNOSTIC_ASSERT(aFailureHandling == DontAssertDispatchSuccess || NS_SUCCEEDED(rv)); 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 // by the threadpool event queue when the task queue is non-empty. // // The returned promise is resolved when the queue goes empty. nsRefPtr<ShutdownPromise> BeginShutdown();