Bug 1161901 - Use ProxyMediaCall instead of MDSM::ShutdownReader. r=jww
authorBobby Holley <bobbyholley@gmail.com>
Tue, 05 May 2015 17:59:02 -0700
changeset 274206 5baf534b8355ba5e143e38c3abcf57d5e178f3c0
parent 274205 70ac70374cf793cad2b8231b10049fc50c239061
child 274207 f31c310ad85a75fad8b4c9dff7cb5391fbfd3940
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjww
bugs1161901
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1161901 - Use ProxyMediaCall instead of MDSM::ShutdownReader. r=jww
dom/media/MediaDecoderStateMachine.cpp
dom/media/MediaDecoderStateMachine.h
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2515,25 +2515,16 @@ public:
 
 private:
   virtual ~DecoderDisposer() {}
   nsRefPtr<MediaDecoder> mDecoder;
   nsRefPtr<MediaDecoderStateMachine> mStateMachine;
 };
 
 void
-MediaDecoderStateMachine::ShutdownReader()
-{
-  MOZ_ASSERT(OnDecodeTaskQueue());
-  mReader->Shutdown()->Then(TaskQueue(), __func__, this,
-                            &MediaDecoderStateMachine::FinishShutdown,
-                            &MediaDecoderStateMachine::FinishShutdown);
-}
-
-void
 MediaDecoderStateMachine::FinishShutdown()
 {
   MOZ_ASSERT(OnTaskQueue());
   ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
 
   // The reader's listeners hold references to the state machine,
   // creating a cycle which keeps the state machine and its shared
   // thread pools alive. So break it here.
@@ -2609,20 +2600,20 @@ nsresult MediaDecoderStateMachine::RunSt
       if (IsPlaying()) {
         StopPlayback();
       }
 
       Reset();
 
       // Put a task in the decode queue to shutdown the reader.
       // the queue to spin down.
-      nsCOMPtr<nsIRunnable> task
-        = NS_NewRunnableMethod(this, &MediaDecoderStateMachine::ShutdownReader);
-      DecodeTaskQueue()->Dispatch(task.forget());
-
+      ProxyMediaCall(DecodeTaskQueue(), mReader.get(), __func__, &MediaDecoderReader::Shutdown)
+        ->Then(TaskQueue(), __func__, this,
+               &MediaDecoderStateMachine::FinishShutdown,
+               &MediaDecoderStateMachine::FinishShutdown);
       DECODER_LOG("Shutdown started");
       return NS_OK;
     }
 
     case DECODER_STATE_DORMANT: {
       return NS_OK;
     }
 
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -181,17 +181,16 @@ private:
   void Shutdown();
 public:
 
   void DispatchShutdown()
   {
     TaskQueue()->Dispatch(NS_NewRunnableMethod(this, &MediaDecoderStateMachine::Shutdown));
   }
 
-  void ShutdownReader();
   void FinishShutdown();
 
   bool IsRealTime() const;
 
   // Called from the main thread to get the duration. The decoder monitor
   // must be obtained before calling this. It is in units of microseconds.
   int64_t GetDuration();