Bug 1346681 - Label runnables in dom/media/gmp/GMPVideoEncoderParent.cpp. r?jesup draft
authorJW Wang <jwwang@mozilla.com>
Fri, 10 Mar 2017 16:44:41 +0800
changeset 497257 9dac5e430681c9e807f5d05c5245a215de6b3b4a
parent 497255 6a1ba18bca51b18ba08957ebbef87c0ac2df01ac
child 497297 7a55188d7190ec5393631b28c3417276917eddab
push id48851
push userjwwang@mozilla.com
push dateMon, 13 Mar 2017 04:07:58 +0000
reviewersjesup
bugs1346681
milestone55.0a1
Bug 1346681 - Label runnables in dom/media/gmp/GMPVideoEncoderParent.cpp. r?jesup MozReview-Commit-ID: GZqomJdBKxB
dom/media/gmp/GMPVideoEncoderParent.cpp
--- a/dom/media/gmp/GMPVideoEncoderParent.cpp
+++ b/dom/media/gmp/GMPVideoEncoderParent.cpp
@@ -252,19 +252,19 @@ GMPVideoEncoderParent::ActorDestroy(Acto
   if (mCallback) {
     // May call Close() (and Shutdown()) immediately or with a delay
     mCallback->Terminated();
     mCallback = nullptr;
   }
   // Must be shut down before VideoEncoderDestroyed(), since this can recurse
   // the GMPThread event loop.  See bug 1049501
   if (mEncodedThread) {
-    NS_DispatchToMainThread(
-      WrapRunnableNM(&ShutdownEncodedThread, nsCOMPtr<nsIThread>(mEncodedThread))
-    );
+    nsCOMPtr<nsIRunnable> r = WrapRunnableNM(
+      &ShutdownEncodedThread, nsCOMPtr<nsIThread>(mEncodedThread));
+    SystemGroup::Dispatch("ShutdownEncodedThread", TaskCategory::Other, r.forget());
     mEncodedThread = nullptr;
   }
   if (mPlugin) {
     // Ignore any return code. It is OK for this to fail without killing the process.
     mPlugin->VideoEncoderDestroyed(this);
     mPlugin = nullptr;
   }
   mVideoHost.ActorDestroyed(); // same as DoneWithAPI