bug 1205558 remove unused AudioNodeStream* aSource parameter r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 22 Sep 2015 17:11:52 +1200
changeset 265114 983347f21a23dbfe7ebe8b11b7a23d4f786c81a5
parent 265113 13e85dc6b41bf1ce0a6f1d50e290b6159dd79786
child 265115 cd555b8702ca3c9efe768a5dba59adbb80e41dd3
push id29456
push usercbook@mozilla.com
push dateWed, 30 Sep 2015 10:48:50 +0000
treeherdermozilla-central@97e537f85183 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1205558
milestone44.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 1205558 remove unused AudioNodeStream* aSource parameter r=padenot
dom/media/webaudio/AudioBufferSourceNode.cpp
dom/media/webaudio/BiquadFilterNode.cpp
dom/media/webaudio/DelayNode.cpp
dom/media/webaudio/DynamicsCompressorNode.cpp
dom/media/webaudio/GainNode.cpp
dom/media/webaudio/OscillatorNode.cpp
dom/media/webaudio/StereoPannerNode.cpp
dom/media/webaudio/WebAudioUtils.cpp
dom/media/webaudio/WebAudioUtils.h
--- a/dom/media/webaudio/AudioBufferSourceNode.cpp
+++ b/dom/media/webaudio/AudioBufferSourceNode.cpp
@@ -64,19 +64,18 @@ public:
   void SetSourceStream(AudioNodeStream* aSource)
   {
     mSource = aSource;
   }
 
   virtual void RecvTimelineEvent(uint32_t aIndex,
                                  dom::AudioTimelineEvent& aEvent) override
   {
-    MOZ_ASSERT(mSource && mDestination);
+    MOZ_ASSERT(mDestination);
     WebAudioUtils::ConvertAudioTimelineEventToTicks(aEvent,
-                                                    mSource,
                                                     mDestination);
 
     switch (aIndex) {
     case AudioBufferSourceNode::PLAYBACKRATE:
       mPlaybackRateTimeline.InsertEvent<int64_t>(aEvent);
       break;
     case AudioBufferSourceNode::DETUNE:
       mDetuneTimeline.InsertEvent<int64_t>(aEvent);
--- a/dom/media/webaudio/BiquadFilterNode.cpp
+++ b/dom/media/webaudio/BiquadFilterNode.cpp
@@ -73,33 +73,27 @@ SetParamsOnBiquad(WebCore::Biquad& aBiqu
   }
 }
 
 class BiquadFilterNodeEngine final : public AudioNodeEngine
 {
 public:
   BiquadFilterNodeEngine(AudioNode* aNode, AudioDestinationNode* aDestination)
     : AudioNodeEngine(aNode)
-    , mSource(nullptr)
     , mDestination(aDestination->Stream())
     // Keep the default values in sync with the default values in
     // BiquadFilterNode::BiquadFilterNode
     , mType(BiquadFilterType::Lowpass)
     , mFrequency(350.f)
     , mDetune(0.f)
     , mQ(1.f)
     , mGain(0.f)
   {
   }
 
-  void SetSourceStream(AudioNodeStream* aSource)
-  {
-    mSource = aSource;
-  }
-
   enum Parameteres {
     TYPE,
     FREQUENCY,
     DETUNE,
     Q,
     GAIN
   };
   void SetInt32Parameter(uint32_t aIndex, int32_t aValue) override
@@ -108,20 +102,19 @@ public:
     case TYPE: mType = static_cast<BiquadFilterType>(aValue); break;
     default:
       NS_ERROR("Bad BiquadFilterNode Int32Parameter");
     }
   }
   void RecvTimelineEvent(uint32_t aIndex,
                          AudioTimelineEvent& aEvent) override
   {
-    MOZ_ASSERT(mSource && mDestination);
+    MOZ_ASSERT(mDestination);
 
     WebAudioUtils::ConvertAudioTimelineEventToTicks(aEvent,
-                                                    mSource,
                                                     mDestination);
 
     switch (aIndex) {
     case FREQUENCY:
       mFrequency.InsertEvent<int64_t>(aEvent);
       break;
     case DETUNE:
       mDetune.InsertEvent<int64_t>(aEvent);
@@ -216,31 +209,29 @@ public:
   virtual bool IsActive() const override
   {
     return !mBiquads.IsEmpty();
   }
 
   virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
   {
     // Not owned:
-    // - mSource - probably not owned
     // - mDestination - probably not owned
     // - AudioParamTimelines - counted in the AudioNode
     size_t amount = AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf);
     amount += mBiquads.ShallowSizeOfExcludingThis(aMallocSizeOf);
     return amount;
   }
 
   virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override
   {
     return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
   }
 
 private:
-  AudioNodeStream* mSource;
   AudioNodeStream* mDestination;
   BiquadFilterType mType;
   AudioParamTimeline mFrequency;
   AudioParamTimeline mDetune;
   AudioParamTimeline mQ;
   AudioParamTimeline mGain;
   nsTArray<WebCore::Biquad> mBiquads;
 };
@@ -254,17 +245,16 @@ BiquadFilterNode::BiquadFilterNode(Audio
   , mFrequency(new AudioParam(this, SendFrequencyToStream, 350.f, "frequency"))
   , mDetune(new AudioParam(this, SendDetuneToStream, 0.f, "detune"))
   , mQ(new AudioParam(this, SendQToStream, 1.f, "Q"))
   , mGain(new AudioParam(this, SendGainToStream, 0.f, "gain"))
 {
   BiquadFilterNodeEngine* engine = new BiquadFilterNodeEngine(this, aContext->Destination());
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NO_STREAM_FLAGS);
-  engine->SetSourceStream(mStream);
 }
 
 BiquadFilterNode::~BiquadFilterNode()
 {
 }
 
 size_t
 BiquadFilterNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
--- a/dom/media/webaudio/DelayNode.cpp
+++ b/dom/media/webaudio/DelayNode.cpp
@@ -58,19 +58,18 @@ public:
   }
 
   enum Parameters {
     DELAY,
   };
   void RecvTimelineEvent(uint32_t aIndex,
                          AudioTimelineEvent& aEvent) override
   {
-    MOZ_ASSERT(mSource && mDestination);
+    MOZ_ASSERT(mDestination);
     WebAudioUtils::ConvertAudioTimelineEventToTicks(aEvent,
-                                                    mSource,
                                                     mDestination);
 
     switch (aIndex) {
     case DELAY:
       mDelay.InsertEvent<int64_t>(aEvent);
       break;
     default:
       NS_ERROR("Bad DelayNodeEngine TimelineParameter");
--- a/dom/media/webaudio/DynamicsCompressorNode.cpp
+++ b/dom/media/webaudio/DynamicsCompressorNode.cpp
@@ -31,48 +31,41 @@ NS_IMPL_ADDREF_INHERITED(DynamicsCompres
 NS_IMPL_RELEASE_INHERITED(DynamicsCompressorNode, AudioNode)
 
 class DynamicsCompressorNodeEngine final : public AudioNodeEngine
 {
 public:
   explicit DynamicsCompressorNodeEngine(AudioNode* aNode,
                                         AudioDestinationNode* aDestination)
     : AudioNodeEngine(aNode)
-    , mSource(nullptr)
     , mDestination(aDestination->Stream())
     // Keep the default value in sync with the default value in
     // DynamicsCompressorNode::DynamicsCompressorNode.
     , mThreshold(-24.f)
     , mKnee(30.f)
     , mRatio(12.f)
     , mAttack(0.003f)
     , mRelease(0.25f)
     , mCompressor(new DynamicsCompressor(mDestination->SampleRate(), 2))
   {
   }
 
-  void SetSourceStream(AudioNodeStream* aSource)
-  {
-    mSource = aSource;
-  }
-
   enum Parameters {
     THRESHOLD,
     KNEE,
     RATIO,
     ATTACK,
     RELEASE
   };
   void RecvTimelineEvent(uint32_t aIndex,
                          AudioTimelineEvent& aEvent) override
   {
-    MOZ_ASSERT(mSource && mDestination);
+    MOZ_ASSERT(mDestination);
 
     WebAudioUtils::ConvertAudioTimelineEventToTicks(aEvent,
-                                                    mSource,
                                                     mDestination);
 
     switch (aIndex) {
     case THRESHOLD:
       mThreshold.InsertEvent<int64_t>(aEvent);
       break;
     case KNEE:
       mKnee.InsertEvent<int64_t>(aEvent);
@@ -127,17 +120,16 @@ public:
 
     SendReductionParamToMainThread(aStream,
                                    mCompressor->parameterValue(DynamicsCompressor::ParamReduction));
   }
 
   virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
   {
     // Not owned:
-    // - mSource (probably)
     // - mDestination (probably)
     // - Don't count the AudioParamTimelines, their inner refs are owned by the
     // AudioNode.
     size_t amount = AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf);
     amount += mCompressor->sizeOfIncludingThis(aMallocSizeOf);
     return amount;
   }
 
@@ -175,17 +167,16 @@ private:
       nsRefPtr<AudioNodeStream> mStream;
       float mReduction;
     };
 
     NS_DispatchToMainThread(new Command(aStream, aReduction));
   }
 
 private:
-  AudioNodeStream* mSource;
   AudioNodeStream* mDestination;
   AudioParamTimeline mThreshold;
   AudioParamTimeline mKnee;
   AudioParamTimeline mRatio;
   AudioParamTimeline mAttack;
   AudioParamTimeline mRelease;
   nsAutoPtr<DynamicsCompressor> mCompressor;
 };
@@ -200,17 +191,16 @@ DynamicsCompressorNode::DynamicsCompress
   , mRatio(new AudioParam(this, SendRatioToStream, 12.f, "ratio"))
   , mReduction(0)
   , mAttack(new AudioParam(this, SendAttackToStream, 0.003f, "attack"))
   , mRelease(new AudioParam(this, SendReleaseToStream, 0.25f, "release"))
 {
   DynamicsCompressorNodeEngine* engine = new DynamicsCompressorNodeEngine(this, aContext->Destination());
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NO_STREAM_FLAGS);
-  engine->SetSourceStream(mStream);
 }
 
 DynamicsCompressorNode::~DynamicsCompressorNode()
 {
 }
 
 size_t
 DynamicsCompressorNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
--- a/dom/media/webaudio/GainNode.cpp
+++ b/dom/media/webaudio/GainNode.cpp
@@ -23,37 +23,30 @@ NS_INTERFACE_MAP_END_INHERITING(AudioNod
 NS_IMPL_ADDREF_INHERITED(GainNode, AudioNode)
 NS_IMPL_RELEASE_INHERITED(GainNode, AudioNode)
 
 class GainNodeEngine final : public AudioNodeEngine
 {
 public:
   GainNodeEngine(AudioNode* aNode, AudioDestinationNode* aDestination)
     : AudioNodeEngine(aNode)
-    , mSource(nullptr)
     , mDestination(aDestination->Stream())
     // Keep the default value in sync with the default value in GainNode::GainNode.
     , mGain(1.f)
   {
   }
 
-  void SetSourceStream(AudioNodeStream* aSource)
-  {
-    mSource = aSource;
-  }
-
   enum Parameters {
     GAIN
   };
   void RecvTimelineEvent(uint32_t aIndex,
                          AudioTimelineEvent& aEvent) override
   {
-    MOZ_ASSERT(mSource && mDestination);
+    MOZ_ASSERT(mDestination);
     WebAudioUtils::ConvertAudioTimelineEventToTicks(aEvent,
-                                                    mSource,
                                                     mDestination);
 
     switch (aIndex) {
     case GAIN:
       mGain.InsertEvent<int64_t>(aEvent);
       break;
     default:
       NS_ERROR("Bad GainNodeEngine TimelineParameter");
@@ -61,18 +54,16 @@ public:
   }
 
   virtual void ProcessBlock(AudioNodeStream* aStream,
                             GraphTime aFrom,
                             const AudioBlock& aInput,
                             AudioBlock* aOutput,
                             bool* aFinished) override
   {
-    MOZ_ASSERT(mSource == aStream, "Invalid source stream");
-
     if (aInput.IsNull()) {
       // If input is silent, so is the output
       aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
     } else if (mGain.HasSimpleValue()) {
       // Optimize the case where we only have a single value set as the volume
       float gain = mGain.GetValue();
       if (gain == 0.0f) {
         aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
@@ -102,43 +93,40 @@ public:
         AudioBlockCopyChannelWithScale(inputBuffer, computedGain, buffer);
       }
     }
   }
 
   virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
   {
     // Not owned:
-    // - mSource (probably)
     // - mDestination (probably)
     // - mGain - Internal ref owned by AudioNode
     return AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf);
   }
 
   virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override
   {
     return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
   }
 
-  AudioNodeStream* mSource;
   AudioNodeStream* mDestination;
   AudioParamTimeline mGain;
 };
 
 GainNode::GainNode(AudioContext* aContext)
   : AudioNode(aContext,
               2,
               ChannelCountMode::Max,
               ChannelInterpretation::Speakers)
   , mGain(new AudioParam(this, SendGainToStream, 1.0f, "gain"))
 {
   GainNodeEngine* engine = new GainNodeEngine(this, aContext->Destination());
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NO_STREAM_FLAGS);
-  engine->SetSourceStream(mStream);
 }
 
 GainNode::~GainNode()
 {
 }
 
 size_t
 GainNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
--- a/dom/media/webaudio/OscillatorNode.cpp
+++ b/dom/media/webaudio/OscillatorNode.cpp
@@ -57,20 +57,19 @@ public:
     START,
     STOP,
   };
   void RecvTimelineEvent(uint32_t aIndex,
                          AudioTimelineEvent& aEvent) override
   {
     mRecomputeParameters = true;
 
-    MOZ_ASSERT(mSource && mDestination);
+    MOZ_ASSERT(mDestination);
 
     WebAudioUtils::ConvertAudioTimelineEventToTicks(aEvent,
-                                                    mSource,
                                                     mDestination);
 
     switch (aIndex) {
     case FREQUENCY:
       mFrequency.InsertEvent<int64_t>(aEvent);
       break;
     case DETUNE:
       mDetune.InsertEvent<int64_t>(aEvent);
--- a/dom/media/webaudio/StereoPannerNode.cpp
+++ b/dom/media/webaudio/StereoPannerNode.cpp
@@ -28,38 +28,31 @@ NS_IMPL_ADDREF_INHERITED(StereoPannerNod
 NS_IMPL_RELEASE_INHERITED(StereoPannerNode, AudioNode)
 
 class StereoPannerNodeEngine final : public AudioNodeEngine
 {
 public:
   StereoPannerNodeEngine(AudioNode* aNode,
                          AudioDestinationNode* aDestination)
     : AudioNodeEngine(aNode)
-    , mSource(nullptr)
     , mDestination(aDestination->Stream())
     // Keep the default value in sync with the default value in
     // StereoPannerNode::StereoPannerNode.
     , mPan(0.f)
   {
   }
 
-  void SetSourceStream(AudioNodeStream* aSource)
-  {
-    mSource = aSource;
-  }
-
   enum Parameters {
     PAN
   };
   void RecvTimelineEvent(uint32_t aIndex,
                          AudioTimelineEvent& aEvent) override
   {
-    MOZ_ASSERT(mSource && mDestination);
+    MOZ_ASSERT(mDestination);
     WebAudioUtils::ConvertAudioTimelineEventToTicks(aEvent,
-                                                    mSource,
                                                     mDestination);
 
     switch (aIndex) {
     case PAN:
       mPan.InsertEvent<int64_t>(aEvent);
       break;
     default:
       NS_ERROR("Bad StereoPannerNode TimelineParameter");
@@ -111,18 +104,16 @@ public:
   }
 
   virtual void ProcessBlock(AudioNodeStream* aStream,
                             GraphTime aFrom,
                             const AudioBlock& aInput,
                             AudioBlock* aOutput,
                             bool *aFinished) override
   {
-    MOZ_ASSERT(mSource == aStream, "Invalid source stream");
-
     // The output of this node is always stereo, no matter what the inputs are.
     MOZ_ASSERT(aInput.ChannelCount() <= 2);
     aOutput->AllocateChannels(2);
     bool monoToStereo = aInput.ChannelCount() == 1;
 
     if (aInput.IsNull()) {
       // If input is silent, so is the output
       SetToSilentStereoBlock(aOutput);
@@ -166,32 +157,30 @@ public:
     }
   }
 
   virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override
   {
     return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
   }
 
-  AudioNodeStream* mSource;
   AudioNodeStream* mDestination;
   AudioParamTimeline mPan;
 };
 
 StereoPannerNode::StereoPannerNode(AudioContext* aContext)
   : AudioNode(aContext,
               2,
               ChannelCountMode::Clamped_max,
               ChannelInterpretation::Speakers)
   , mPan(new AudioParam(this, SendPanToStream, 0.f, "pan"))
 {
   StereoPannerNodeEngine* engine = new StereoPannerNodeEngine(this, aContext->Destination());
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NO_STREAM_FLAGS);
-  engine->SetSourceStream(mStream);
 }
 
 StereoPannerNode::~StereoPannerNode()
 {
 }
 
 size_t
 StereoPannerNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
--- a/dom/media/webaudio/WebAudioUtils.cpp
+++ b/dom/media/webaudio/WebAudioUtils.cpp
@@ -8,24 +8,22 @@
 #include "AudioNodeStream.h"
 #include "blink/HRTFDatabaseLoader.h"
 
 namespace mozilla {
 
 namespace dom {
 
 void WebAudioUtils::ConvertAudioTimelineEventToTicks(AudioTimelineEvent& aEvent,
-                                                     AudioNodeStream* aSource,
                                                      AudioNodeStream* aDest)
 {
-  MOZ_ASSERT(!aSource || aSource->SampleRate() == aDest->SampleRate());
   aEvent.SetTimeInTicks(
       aDest->SecondsToNearestStreamTime(aEvent.Time<double>()));
-  aEvent.mTimeConstant *= aSource->SampleRate();
-  aEvent.mDuration *= aSource->SampleRate();
+  aEvent.mTimeConstant *= aDest->SampleRate();
+  aEvent.mDuration *= aDest->SampleRate();
 }
 
 void
 WebAudioUtils::Shutdown()
 {
   WebCore::HRTFDatabaseLoader::shutdown();
 }
 
--- a/dom/media/webaudio/WebAudioUtils.h
+++ b/dom/media/webaudio/WebAudioUtils.h
@@ -59,17 +59,16 @@ namespace WebAudioUtils {
    * with respect to a destination AudioNodeStream.
    *
    * This needs to be called for each AudioTimelineEvent that gets sent to an
    * AudioNodeEngine, on the engine side where the AudioTimlineEvent is
    * received.  This means that such engines need to be aware of their
    * destination streams as well.
    */
   void ConvertAudioTimelineEventToTicks(AudioTimelineEvent& aEvent,
-                                        AudioNodeStream* aSource,
                                         AudioNodeStream* aDest);
 
   /**
    * Converts a linear value to decibels.  Returns aMinDecibels if the linear
    * value is 0.
    */
   inline float ConvertLinearToDecibels(float aLinearValue, float aMinDecibels)
   {