Bug 1344621 - Label runnables in dom/media/MediaResource.cpp; r?jwwang
MozReview-Commit-ID: EEZoUIdKOkK
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -49,18 +49,21 @@ namespace mozilla {
void
MediaResource::Destroy()
{
// Ensures we only delete the MediaResource on the main thread.
if (NS_IsMainThread()) {
delete this;
return;
}
- MOZ_ALWAYS_SUCCEEDS(
- NS_DispatchToMainThread(NewNonOwningRunnableMethod(this, &MediaResource::Destroy)));
+ nsresult rv =
+ SystemGroup::Dispatch("MediaResource::Destroy",
+ TaskCategory::Other,
+ NewNonOwningRunnableMethod(this, &MediaResource::Destroy));
+ MOZ_ALWAYS_SUCCEEDS(rv);
}
NS_IMPL_ADDREF(MediaResource)
NS_IMPL_RELEASE_WITH_DESTROY(MediaResource, Destroy())
NS_IMPL_QUERY_INTERFACE0(MediaResource)
ChannelMediaResource::ChannelMediaResource(MediaResourceCallback* aCallback,
nsIChannel* aChannel,
@@ -861,17 +864,20 @@ ChannelMediaResource::CacheClientNotifyD
// block or do anything which might try to acquire a lock!
if (mDataReceivedEvent.IsPending())
return;
mDataReceivedEvent =
NewNonOwningRunnableMethod("ChannelMediaResource::DoNotifyDataReceived",
this, &ChannelMediaResource::DoNotifyDataReceived);
- NS_DispatchToMainThread(mDataReceivedEvent.get());
+
+ nsCOMPtr<nsIRunnable> event = mDataReceivedEvent.get();
+
+ SystemGroup::AbstractMainThreadFor(TaskCategory::Other)->Dispatch(event.forget());
}
void
ChannelMediaResource::CacheClientNotifyDataEnded(nsresult aStatus)
{
MOZ_ASSERT(NS_IsMainThread());
mCallback->NotifyDataEnded(aStatus);
}