Bug 1317501 - Don't notify dom objects synchronously from MSG runnables in DOMMediaStream. r=padenot a=gchang
☠☠ backed out by 818666e181d6 ☠ ☠
authorAndreas Pehrson <pehrsons@gmail.com>
Wed, 07 Dec 2016 08:56:14 +0100
changeset 353045 242d8710b25abbfb6138a4b5d0233caac7b94d51
parent 353044 44a934bd6938f1bd2622f216bd20b4d8776ab1a0
child 353046 99a215091429f05ac28d48b9e0cc62c80c805bea
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot, gchang
bugs1317501
milestone52.0a2
Bug 1317501 - Don't notify dom objects synchronously from MSG runnables in DOMMediaStream. r=padenot a=gchang
dom/media/DOMMediaStream.cpp
--- a/dom/media/DOMMediaStream.cpp
+++ b/dom/media/DOMMediaStream.cpp
@@ -195,17 +195,18 @@ public:
     }
 
     RefPtr<MediaStreamTrack> track =
       mStream->FindOwnedDOMTrack(aInputStream, aInputTrackID, aTrackID);
     NS_ASSERTION(track, "Owned MediaStreamTracks must be known by the DOMMediaStream");
     if (track) {
       LOG(LogLevel::Debug, ("DOMMediaStream %p MediaStreamTrack %p ended at the source. Marking it ended.",
                             mStream, track.get()));
-      track->OverrideEnded();
+      NS_DispatchToMainThread(NewRunnableMethod(
+        track, &MediaStreamTrack::OverrideEnded));
     }
   }
 
   void NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID,
                                 StreamTime aTrackOffset, TrackEventCommand aTrackEvents,
                                 const MediaSegment& aQueuedMedia,
                                 MediaStream* aInputStream,
                                 TrackID aInputTrackID) override
@@ -265,17 +266,18 @@ public:
   void DoNotifyFinished()
   {
     MOZ_ASSERT(NS_IsMainThread());
 
     if (!mStream) {
       return;
     }
 
-    mStream->NotifyFinished();
+    NS_DispatchToMainThread(NewRunnableMethod(
+      mStream, &DOMMediaStream::NotifyFinished));
   }
 
   // The methods below are called on the MediaStreamGraph thread.
 
   void NotifyFinishedTrackCreation(MediaStreamGraph* aGraph) override
   {
     nsCOMPtr<nsIRunnable> runnable =
       NewRunnableMethod(this, &PlaybackStreamListener::DoNotifyFinishedTrackCreation);