Bug 1404997 - P24. Make AutoTaskQueue deliver runnables to nsIEventTarget. r?gerald
Similar to
bug 1300118 for TaskQueue.
MozReview-Commit-ID: 8jIifvs2r4U
--- a/dom/media/VideoUtils.h
+++ b/dom/media/VideoUtils.h
@@ -13,16 +13,17 @@
#include "VideoLimits.h"
#include "mozilla/gfx/Point.h" // for gfx::IntSize
#include "mozilla/AbstractThread.h"
#include "mozilla/Attributes.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/MozPromise.h"
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/RefPtr.h"
+#include "mozilla/SharedThreadPool.h"
#include "mozilla/UniquePtr.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsINamed.h"
#include "nsIThread.h"
#include "nsITimer.h"
#include "nsThreadUtils.h"
@@ -180,18 +181,16 @@ public:
~AutoSetOnScopeExit() {
mVar = mValue;
}
private:
T& mVar;
const T mValue;
};
-class SharedThreadPool;
-
// The MediaDataDecoder API blocks, with implementations waiting on platform
// decoder tasks. These platform decoder tasks are queued on a separate
// thread pool to ensure they can run when the MediaDataDecoder clients'
// thread pool is blocked. Tasks on the PLATFORM_DECODER thread pool must not
// wait on tasks in the PLAYBACK thread pool.
//
// No new dependencies on this mechanism should be added, as methods are being
// made async supported by MozPromise, making this unnecessary and
--- a/dom/media/mediasource/AutoTaskQueue.h
+++ b/dom/media/mediasource/AutoTaskQueue.h
@@ -3,33 +3,34 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_AUTOTASKQUEUE_H_
#define MOZILLA_AUTOTASKQUEUE_H_
#include "mozilla/RefPtr.h"
-#include "mozilla/SharedThreadPool.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/TaskQueue.h"
+class nsIEventTarget;
+
namespace mozilla {
// A convenience TaskQueue not requiring explicit shutdown.
class AutoTaskQueue : public AbstractThread
{
public:
- explicit AutoTaskQueue(already_AddRefed<SharedThreadPool> aPool,
+ explicit AutoTaskQueue(already_AddRefed<nsIEventTarget> aPool,
bool aSupportsTailDispatch = false)
: AbstractThread(aSupportsTailDispatch)
, mTaskQueue(new TaskQueue(Move(aPool), aSupportsTailDispatch))
{}
- AutoTaskQueue(already_AddRefed<SharedThreadPool> aPool,
+ AutoTaskQueue(already_AddRefed<nsIEventTarget> aPool,
const char* aName,
bool aSupportsTailDispatch = false)
: AbstractThread(aSupportsTailDispatch)
, mTaskQueue(new TaskQueue(Move(aPool), aName, aSupportsTailDispatch))
{}
TaskDispatcher& TailDispatcher() override
{
--- a/dom/media/mediasource/MediaSourceDemuxer.cpp
+++ b/dom/media/mediasource/MediaSourceDemuxer.cpp
@@ -5,16 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MediaSourceDemuxer.h"
#include "MediaSourceUtils.h"
#include "OpusDecoder.h"
#include "SourceBufferList.h"
#include "VorbisDecoder.h"
+#include "VideoUtils.h"
#include "nsPrintfCString.h"
#include <algorithm>
#include <limits>
#include <stdint.h>
namespace mozilla {