Bug 1343732 - use SystemGroup::Dispatch() in ~AutoTaskQueue(). r=jya

MozReview-Commit-ID: IWFs5e8U7VQ

--HG--
extra : rebase_source : e71ae9b777ad8fd421d5a66cefc0086b28af8967
extra : source : 221546a238788a744703380c6023efdf741c48cb
This commit is contained in:
JW Wang 2017-03-01 13:02:29 +08:00
Родитель 7187ccc58f
Коммит d6ee299185
3 изменённых файлов: 4 добавлений и 11 удалений

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

@ -652,10 +652,9 @@ class MediaFormatReader::DemuxerProxy
class Wrapper;
public:
explicit DemuxerProxy(MediaDataDemuxer* aDemuxer, AbstractThread* aMainThread)
explicit DemuxerProxy(MediaDataDemuxer* aDemuxer)
: mTaskQueue(new AutoTaskQueue(
GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER),
aMainThread))
GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER)))
, mData(new Data(aDemuxer))
{
MOZ_COUNT_CTOR(DemuxerProxy);
@ -992,9 +991,7 @@ MediaFormatReader::MediaFormatReader(AbstractMediaDecoder* aDecoder,
Preferences::GetUint("media.audio-max-decode-error", 3))
, mVideo(this, MediaData::VIDEO_DATA,
Preferences::GetUint("media.video-max-decode-error", 2))
, mDemuxer(new DemuxerProxy(aDemuxer, aDecoder
? aDecoder->AbstractMainThread()
: AbstractThread::MainThread()))
, mDemuxer(new DemuxerProxy(aDemuxer))
, mDemuxerInitDone(false)
, mLastReportedNumDecodedFrames(0)
, mPreviousDecodedKeyframeTime_us(sNoPreviousDecodedKeyframe)

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

@ -18,11 +18,9 @@ class AutoTaskQueue : public AbstractThread
{
public:
explicit AutoTaskQueue(already_AddRefed<SharedThreadPool> aPool,
AbstractThread* aAbstractMainThread,
bool aSupportsTailDispatch = false)
: AbstractThread(aSupportsTailDispatch)
, mTaskQueue(new TaskQueue(Move(aPool), aSupportsTailDispatch))
, mAbstractMainThread(aAbstractMainThread)
{}
TaskDispatcher& TailDispatcher() override
@ -52,10 +50,9 @@ private:
RefPtr<TaskQueue> taskqueue = mTaskQueue;
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableFunction([taskqueue]() { taskqueue->BeginShutdown(); });
mAbstractMainThread->Dispatch(task.forget());
SystemGroup::Dispatch("~AutoTaskQueue", TaskCategory::Other, task.forget());
}
RefPtr<TaskQueue> mTaskQueue;
const RefPtr<AbstractThread> mAbstractMainThread;
};
} // namespace mozilla

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

@ -22,7 +22,6 @@ using media::TimeIntervals;
MediaSourceDemuxer::MediaSourceDemuxer(AbstractThread* aAbstractMainThread)
: mTaskQueue(new AutoTaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
aAbstractMainThread,
/* aSupportsTailDispatch = */ false))
, mMonitor("MediaSourceDemuxer")
{