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 248353 1dcfd15bb387e6343520ebb65f6f0844299cd0cd
parent 248352 a97be435ed02e6915bc1e93888cfa735a3584602
child 248354 4a267ce23dff0ebfb431828fee2094c4174aacd3
push id28893
push userkwierso@gmail.com
push dateFri, 12 Jun 2015 00:02:58 +0000
treeherdermozilla-central@8cf9d3e497f9 [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();
 }
 
 }
 }