Backed out 3 changesets (bug 974089) for causing OSX/Windows test_bug867104.html permafail.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 11 Jun 2015 15:10:06 -0400
changeset 248395 42c0f3d737f1227011127701f10282836bea48cf
parent 248394 7792819983848a6c82e9cbb322c0b763cb635c64
child 248396 99d6da0042f3c290393e97c5709f449a9129bdc5
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, 867104
milestone41.0a1
backs out1dcfd15bb387e6343520ebb65f6f0844299cd0cd
8c6a7d5efe3a6f439502afbbccec86a4e85e3d3e
e511c79f221109c3cc07c5c16387be39c0797bec
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
Backed out 3 changesets (bug 974089) for causing OSX/Windows test_bug867104.html permafail. Backed out changeset 1dcfd15bb387 (bug 974089) Backed out changeset 8c6a7d5efe3a (bug 974089) Backed out changeset e511c79f2211 (bug 974089) CLOSED TREE
dom/media/MediaStreamGraph.cpp
dom/media/MediaStreamGraphImpl.h
dom/media/webaudio/AudioBufferSourceNode.cpp
dom/media/webaudio/AudioNode.cpp
dom/media/webaudio/AudioNode.h
dom/media/webaudio/OscillatorNode.cpp
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -122,34 +122,28 @@ MediaStreamGraphImpl::AddStream(MediaStr
     mStreams.AppendElement(aStream);
     STREAM_LOG(LogLevel::Debug, ("Adding media stream %p to the graph", aStream));
   }
 
   SetStreamOrderDirty();
 }
 
 void
-MediaStreamGraphImpl::RemoveStream(MediaStream* aStream, bool aLocked)
+MediaStreamGraphImpl::RemoveStream(MediaStream* aStream)
 {
   // Remove references in mStreamUpdates before we allow aStream to die.
   // Pending updates are not needed (since the main thread has already given
   // up the stream) so we will just drop them.
-  if (aLocked) {
+  {
     MonitorAutoLock lock(mMonitor);
     for (uint32_t i = 0; i < mStreamUpdates.Length(); ++i) {
       if (mStreamUpdates[i].mStream == aStream) {
         mStreamUpdates[i].mStream = nullptr;
       }
     }
-  } else {
-    for (uint32_t i = 0; i < mStreamUpdates.Length(); ++i) {
-      if (mStreamUpdates[i].mStream == aStream) {
-        mStreamUpdates[i].mStream = nullptr;
-      }
-    }
   }
 
   // Ensure that mFirstCycleBreaker and mMixer are updated when necessary.
   SetStreamOrderDirty();
 
   mStreams.RemoveElement(aStream);
   mSuspendedStreams.RemoveElement(aStream);
 
@@ -1273,18 +1267,17 @@ MediaStreamGraphImpl::PrepareUpdatesToMa
   mMonitor.AssertCurrentThreadOwns();
 
   // We don't want to frequently update the main thread about timing update
   // when we are not running in realtime.
   if (aFinalUpdate || ShouldUpdateMainThread()) {
     mStreamUpdates.SetCapacity(mStreamUpdates.Length() + mStreams.Length());
     for (uint32_t i = 0; i < mStreams.Length(); ++i) {
       MediaStream* stream = mStreams[i];
-      if (!stream->MainThreadNeedsUpdates() ||
-          !stream->mGraph) { // destroyed on mainthread
+      if (!stream->MainThreadNeedsUpdates()) {
         continue;
       }
       StreamUpdate* update = mStreamUpdates.AppendElement();
       update->mGraphUpdateIndex = stream->mGraphUpdateIndices.GetAt(IterationEnd());
       update->mStream = stream;
       update->mNextMainThreadCurrentTime =
         GraphTimeToStreamTime(stream, IterationEnd());
       update->mNextMainThreadFinished = stream->mNotifiedFinished;
@@ -1544,19 +1537,18 @@ MediaStreamGraphImpl::OneIteration(Graph
 }
 
 void
 MediaStreamGraphImpl::ApplyStreamUpdate(StreamUpdate* aUpdate)
 {
   mMonitor.AssertCurrentThreadOwns();
 
   MediaStream* stream = aUpdate->mStream;
-  if (!stream || stream->IsDestroyed()) {
+  if (!stream)
     return;
-  }
   stream->mMainThreadCurrentTime = aUpdate->mNextMainThreadCurrentTime;
   stream->mMainThreadFinished = aUpdate->mNextMainThreadFinished;
 
   if (stream->ShouldNotifyStreamFinished()) {
     if (stream->mWrapper) {
       stream->mWrapper->NotifyStreamFinished();
     }
 
@@ -2090,24 +2082,17 @@ MediaStream::Destroy()
     virtual void Run()
     {
       mStream->RemoveAllListenersImpl();
       auto graph = mStream->GraphImpl();
       mStream->DestroyImpl();
       graph->RemoveStream(mStream);
     }
     virtual void RunDuringShutdown()
-    {
-      MOZ_ASSERT(NS_IsMainThread());
-      mStream->RemoveAllListenersImpl();
-      auto graph = mStream->GraphImpl();
-      mStream->DestroyImpl();
-      // Don't acquire the lock, this is during shutdown
-      graph->RemoveStream(mStream, false);
-    }
+    { Run(); }
   };
   mWrapper = nullptr;
   GraphImpl()->AppendMessage(new Message(this));
   // Message::RunDuringShutdown may have removed this stream from the graph,
   // but our kungFuDeathGrip above will have kept this stream alive if
   // necessary.
   mMainThreadDestroyed = true;
 }
--- a/dom/media/MediaStreamGraphImpl.h
+++ b/dom/media/MediaStreamGraphImpl.h
@@ -436,17 +436,17 @@ public:
   /**
    * Add aStream to the graph and initializes its graph-specific state.
    */
   void AddStream(MediaStream* aStream);
   /**
    * Remove aStream from the graph. Ensures that pending messages about the
    * stream back to the main thread are flushed.
    */
-  void RemoveStream(MediaStream* aStream, bool aLocked = true);
+  void RemoveStream(MediaStream* aStream);
   /**
    * Remove aPort from the graph and release it.
    */
   void DestroyPort(MediaInputPort* aPort);
   /**
    * Mark the media stream order as dirty.
    */
   void SetStreamOrderDirty()
--- a/dom/media/webaudio/AudioBufferSourceNode.cpp
+++ b/dom/media/webaudio/AudioBufferSourceNode.cpp
@@ -638,19 +638,17 @@ AudioBufferSourceNode::Start(double aWhe
     ns->SetDoubleParameter(START, mContext->DOMTimeToStreamTime(aWhen));
   }
 }
 
 void
 AudioBufferSourceNode::SendBufferParameterToStream(JSContext* aCx)
 {
   AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
-  if (!mStream) {
-    return;
-  }
+  MOZ_ASSERT(ns, "Why don't we have a stream here?");
 
   if (mBuffer) {
     float rate = mBuffer->SampleRate();
     nsRefPtr<ThreadSharedFloatArrayBufferList> data =
       mBuffer->GetThreadSharedChannelsForRate(aCx);
     ns->SetBuffer(data.forget());
     ns->SetInt32Parameter(SAMPLE_RATE, rate);
 
@@ -724,21 +722,16 @@ 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));
 
@@ -746,42 +739,35 @@ AudioBufferSourceNode::NotifyMainThreadS
   // Warning: The below line might delete this.
   MarkInactive();
 }
 
 void
 AudioBufferSourceNode::SendPlaybackRateToStream(AudioNode* aNode)
 {
   AudioBufferSourceNode* This = static_cast<AudioBufferSourceNode*>(aNode);
-  if (!This->mStream) {
-    return;
-  }
   SendTimelineParameterToStream(This, PLAYBACKRATE, *This->mPlaybackRate);
 }
 
 void
 AudioBufferSourceNode::SendDetuneToStream(AudioNode* aNode)
 {
   AudioBufferSourceNode* This = static_cast<AudioBufferSourceNode*>(aNode);
   SendTimelineParameterToStream(This, DETUNE, *This->mDetune);
 }
 
 void
 AudioBufferSourceNode::SendDopplerShiftToStream(double aDopplerShift)
 {
-  MOZ_ASSERT(mStream, "Should have disconnected panner if no stream");
   SendDoubleParameterToStream(DOPPLERSHIFT, aDopplerShift);
 }
 
 void
 AudioBufferSourceNode::SendLoopParametersToStream()
 {
-  if (!mStream) {
-    return;
-  }
   // Don't compute and set the loop parameters unnecessarily
   if (mLoop && mBuffer) {
     float rate = mBuffer->SampleRate();
     double length = (double(mBuffer->Length()) / mBuffer->SampleRate());
     double actualLoopStart, actualLoopEnd;
     if (mLoopStart >= 0.0 && mLoopEnd > 0.0 &&
         mLoopStart < mLoopEnd) {
       MOZ_ASSERT(mLoopStart != 0.0 || mLoopEnd != 0.0);
--- a/dom/media/webaudio/AudioNode.cpp
+++ b/dom/media/webaudio/AudioNode.cpp
@@ -347,22 +347,20 @@ AudioNode::Disconnect(uint32_t aOutput, 
       if (input.mInputNode == this && input.mOutputPort == aOutput) {
         // Destroying the InputNode here sends a message to the graph thread
         // to disconnect the streams, which should be sent before the
         // RunAfterPendingUpdates() call below.
         dest->mInputNodes.RemoveElementAt(j);
         // Remove one instance of 'dest' from mOutputNodes. There could be
         // others, and it's not correct to remove them all since some of them
         // could be for different output ports.
-        nsRefPtr<AudioNode> output = mOutputNodes[i].forget();
+        nsCOMPtr<nsIRunnable> runnable =
+          new RunnableRelease(mOutputNodes[i].forget());
         mOutputNodes.RemoveElementAt(i);
-        if (mStream) {
-          nsRefPtr<nsIRunnable> runnable = new RunnableRelease(output.forget());
-          mStream->RunAfterPendingUpdates(runnable.forget());
-        }
+        mStream->RunAfterPendingUpdates(runnable.forget());
         break;
       }
     }
   }
 
   for (int32_t i = mOutputParams.Length() - 1; i >= 0; --i) {
     AudioParam* dest = mOutputParams[i];
     for (int32_t j = dest->InputNodes().Length() - 1; j >= 0; --j) {
--- a/dom/media/webaudio/AudioNode.h
+++ b/dom/media/webaudio/AudioNode.h
@@ -215,17 +215,17 @@ protected:
   void SendChannelMixingParametersToStream();
   static void SendTimelineParameterToStream(AudioNode* aNode, uint32_t aIndex,
                                             const AudioParamTimeline& aValue);
 
 private:
   nsRefPtr<AudioContext> mContext;
 
 protected:
-  // Must be set in the constructor. Must not be null unless finished.
+  // Must be set in the constructor. Must not be null.
   // If MaxNumberOfInputs() is > 0, then mStream must be a ProcessedMediaStream.
   nsRefPtr<MediaStream> mStream;
 
 private:
   // For every InputNode, there is a corresponding entry in mOutputNodes of the
   // InputNode's mInputNode.
   nsTArray<InputNode> mInputNodes;
   // For every mOutputNode entry, there is a corresponding entry in mInputNodes
--- a/dom/media/webaudio/OscillatorNode.cpp
+++ b/dom/media/webaudio/OscillatorNode.cpp
@@ -420,38 +420,29 @@ OscillatorNode::WrapObject(JSContext* aC
 {
   return OscillatorNodeBinding::Wrap(aCx, this, aGivenProto);
 }
 
 void
 OscillatorNode::SendFrequencyToStream(AudioNode* aNode)
 {
   OscillatorNode* This = static_cast<OscillatorNode*>(aNode);
-  if (!This->mStream) {
-    return;
-  }
   SendTimelineParameterToStream(This, OscillatorNodeEngine::FREQUENCY, *This->mFrequency);
 }
 
 void
 OscillatorNode::SendDetuneToStream(AudioNode* aNode)
 {
   OscillatorNode* This = static_cast<OscillatorNode*>(aNode);
-  if (!This->mStream) {
-    return;
-  }
   SendTimelineParameterToStream(This, OscillatorNodeEngine::DETUNE, *This->mDetune);
 }
 
 void
 OscillatorNode::SendTypeToStream()
 {
-  if (!mStream) {
-    return;
-  }
   if (mType == OscillatorType::Custom) {
     // The engine assumes we'll send the custom data before updating the type.
     SendPeriodicWaveToStream();
   }
   SendInt32ParameterToStream(OscillatorNodeEngine::TYPE, static_cast<int32_t>(mType));
 }
 
 void OscillatorNode::SendPeriodicWaveToStream()
@@ -533,21 +524,16 @@ 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));