Bug 1254858: P2. Properly dispatch task on the right thread. r=kentuckyfriedtakahe
We were dispatching a task on the main thread, only to redispatch it immediately.
MozReview-Commit-ID: 4Hl6C5UEA82
--- a/dom/media/Benchmark.cpp
+++ b/dom/media/Benchmark.cpp
@@ -174,19 +174,19 @@ BenchmarkPlayback::InitDecoder(TrackInfo
RefPtr<PDMFactory> platform = new PDMFactory();
mDecoder = platform->CreateDecoder(aInfo, mDecoderTaskQueue, this);
if (!mDecoder) {
MainThreadShutdown();
return;
}
RefPtr<Benchmark> ref(mMainThreadState);
mDecoder->Init()->Then(
- ref->Thread(), __func__,
+ Thread(), __func__,
[this, ref](TrackInfo::TrackType aTrackType) {
- Dispatch(NS_NewRunnableFunction([this, ref]() { InputExhausted(); }));
+ InputExhausted();
},
[this, ref](MediaDataDecoder::DecoderFailureReason aReason) {
MainThreadShutdown();
});
}
void
BenchmarkPlayback::MainThreadShutdown()