Bug 974089 - Destroy the streams from the main thread.
☠☠ backed out by 42c0f3d737f1 ☠ ☠
authorPaul Adenot <paul@paul.cx>
Thu, 11 Jun 2015 18:46:44 +0200
changeset 279124 1dcfd15bb387e6343520ebb65f6f0844299cd0cd
parent 279123 a97be435ed02e6915bc1e93888cfa735a3584602
child 279125 4a267ce23dff0ebfb431828fee2094c4174aacd3
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs974089
milestone41.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 974089 - Destroy the streams from the main thread.
dom/media/webaudio/AudioBufferSourceNode.cpp
dom/media/webaudio/OscillatorNode.cpp
--- a/dom/media/webaudio/AudioBufferSourceNode.cpp
+++ b/dom/media/webaudio/AudioBufferSourceNode.cpp
@@ -724,26 +724,28 @@ AudioBufferSourceNode::NotifyMainThreadS
     {
       // If it's not safe to run scripts right now, schedule this to run later
       if (!nsContentUtils::IsSafeToRunScript()) {
         nsContentUtils::AddScriptRunner(this);
         return NS_OK;
       }
 
       mNode->DispatchTrustedEvent(NS_LITERAL_STRING("ended"));
+
+      // Release stream resources.
+      //
+      // DestroyMediaStream() will remove this stream listener.
+      mNode->DestroyMediaStream();
       return NS_OK;
     }
   private:
     nsRefPtr<AudioBufferSourceNode> mNode;
   };
 
   NS_DispatchToMainThread(new EndedEventDispatcher(this));
-  // Release stream resources.
-  // DestroyMediaStream() will remove this stream listener.
-  DestroyMediaStream();
 
   // Drop the playing reference
   // Warning: The below line might delete this.
   MarkInactive();
 }
 
 void
 AudioBufferSourceNode::SendPlaybackRateToStream(AudioNode* aNode)
--- a/dom/media/webaudio/OscillatorNode.cpp
+++ b/dom/media/webaudio/OscillatorNode.cpp
@@ -533,26 +533,28 @@ OscillatorNode::NotifyMainThreadStreamFi
     {
       // If it's not safe to run scripts right now, schedule this to run later
       if (!nsContentUtils::IsSafeToRunScript()) {
         nsContentUtils::AddScriptRunner(this);
         return NS_OK;
       }
 
       mNode->DispatchTrustedEvent(NS_LITERAL_STRING("ended"));
+
+      // Release stream resources.
+      // DestroyMediaStream() will remove this stream listener.
+      mNode->DestroyMediaStream();
+
       return NS_OK;
     }
   private:
     nsRefPtr<OscillatorNode> mNode;
   };
 
   NS_DispatchToMainThread(new EndedEventDispatcher(this));
-  // Release stream resources.
-  // DestroyMediaStream() will remove this stream listener.
-  DestroyMediaStream();
 
   // Drop the playing reference
   // Warning: The below line might delete this.
   MarkInactive();
 }
 
 }
 }