bug 1210266 use parameter index instead of node callback for sending timeline events r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 01 Oct 2015 15:48:20 +1300
changeset 265675 be71c2bb8e12a4349dce4847418d21fa7fb41b36
parent 265674 37f3303f163abbd8b9ce4dbd1e024506a5a3040e
child 265676 c606e4d26a2f5d21a59f9f69141bd8ef840ef5d0
push id29467
push userkwierso@gmail.com
push dateFri, 02 Oct 2015 20:33:25 +0000
treeherdermozilla-central@2308353160d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1210266
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 1210266 use parameter index instead of node callback for sending timeline events r=padenot
dom/media/webaudio/AudioBufferSourceNode.cpp
dom/media/webaudio/AudioBufferSourceNode.h
dom/media/webaudio/AudioNode.cpp
dom/media/webaudio/AudioNode.h
dom/media/webaudio/AudioParam.cpp
dom/media/webaudio/AudioParam.h
dom/media/webaudio/BiquadFilterNode.cpp
dom/media/webaudio/BiquadFilterNode.h
dom/media/webaudio/DelayNode.cpp
dom/media/webaudio/DelayNode.h
dom/media/webaudio/DynamicsCompressorNode.cpp
dom/media/webaudio/DynamicsCompressorNode.h
dom/media/webaudio/GainNode.cpp
dom/media/webaudio/GainNode.h
dom/media/webaudio/OscillatorNode.cpp
dom/media/webaudio/OscillatorNode.h
dom/media/webaudio/StereoPannerNode.cpp
dom/media/webaudio/StereoPannerNode.h
--- a/dom/media/webaudio/AudioBufferSourceNode.cpp
+++ b/dom/media/webaudio/AudioBufferSourceNode.cpp
@@ -575,18 +575,18 @@ public:
 AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext)
   : AudioNode(aContext,
               2,
               ChannelCountMode::Max,
               ChannelInterpretation::Speakers)
   , mLoopStart(0.0)
   , mLoopEnd(0.0)
   // mOffset and mDuration are initialized in Start().
-  , mPlaybackRate(new AudioParam(this, SendPlaybackRateToStream, 1.0f, "playbackRate"))
-  , mDetune(new AudioParam(this, SendDetuneToStream, 0.0f, "detune"))
+  , mPlaybackRate(new AudioParam(this, PLAYBACKRATE, 1.0f, "playbackRate"))
+  , mDetune(new AudioParam(this, DETUNE, 0.0f, "detune"))
   , mLoop(false)
   , mStartCalled(false)
 {
   AudioBufferSourceNodeEngine* engine = new AudioBufferSourceNodeEngine(this, aContext->Destination());
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NEED_MAIN_THREAD_FINISHED);
   engine->SetSourceStream(mStream);
   mStream->AddMainThreadListener(this);
@@ -780,38 +780,16 @@ AudioBufferSourceNode::NotifyMainThreadS
   NS_DispatchToMainThread(new EndedEventDispatcher(this));
 
   // Drop the playing reference
   // Warning: The below line might delete this.
   MarkInactive();
 }
 
 void
-AudioBufferSourceNode::SendPlaybackRateToStream(AudioNode* aNode,
-                                                const AudioTimelineEvent& aEvent)
-{
-  AudioBufferSourceNode* This = static_cast<AudioBufferSourceNode*>(aNode);
-  if (!This->mStream) {
-    return;
-  }
-  SendTimelineEventToStream(This, PLAYBACKRATE, aEvent);
-}
-
-void
-AudioBufferSourceNode::SendDetuneToStream(AudioNode* aNode,
-                                          const AudioTimelineEvent& aEvent)
-{
-  AudioBufferSourceNode* This = static_cast<AudioBufferSourceNode*>(aNode);
-  if (!This->mStream) {
-    return;
-  }
-  SendTimelineEventToStream(This, DETUNE, aEvent);
-}
-
-void
 AudioBufferSourceNode::SendDopplerShiftToStream(double aDopplerShift)
 {
   MOZ_ASSERT(mStream, "Should have disconnected panner if no stream");
   SendDoubleParameterToStream(DOPPLERSHIFT, aDopplerShift);
 }
 
 void
 AudioBufferSourceNode::SendLoopParametersToStream()
--- a/dom/media/webaudio/AudioBufferSourceNode.h
+++ b/dom/media/webaudio/AudioBufferSourceNode.h
@@ -124,20 +124,16 @@ private:
     PLAYBACKRATE,
     DETUNE,
     DOPPLERSHIFT
   };
 
   void SendLoopParametersToStream();
   void SendBufferParameterToStream(JSContext* aCx);
   void SendOffsetAndDurationParametersToStream(AudioNodeStream* aStream);
-  static void SendPlaybackRateToStream(AudioNode* aNode,
-                                       const AudioTimelineEvent& aEvent);
-  static void SendDetuneToStream(AudioNode* aNode,
-                                 const AudioTimelineEvent& aEvent);
 
 private:
   double mLoopStart;
   double mLoopEnd;
   double mOffset;
   double mDuration;
   nsRefPtr<AudioBuffer> mBuffer;
   nsRefPtr<AudioParam> mPlaybackRate;
--- a/dom/media/webaudio/AudioNode.cpp
+++ b/dom/media/webaudio/AudioNode.cpp
@@ -299,25 +299,16 @@ AudioNode::SendChannelMixingParametersTo
 {
   if (mStream) {
     mStream->SetChannelMixingParameters(mChannelCount, mChannelCountMode,
                                         mChannelInterpretation);
   }
 }
 
 void
-AudioNode::SendTimelineEventToStream(AudioNode* aNode, uint32_t aIndex,
-                                     const AudioTimelineEvent& aEvent)
-{
-  AudioNodeStream* ns = aNode->mStream;
-  MOZ_ASSERT(ns, "How come we don't have a stream here?");
-  ns->SendTimelineEvent(aIndex, aEvent);
-}
-
-void
 AudioNode::Disconnect(uint32_t aOutput, ErrorResult& aRv)
 {
   if (aOutput >= NumberOfOutputs()) {
     aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
     return;
   }
 
   // An upstream node may be starting to play on the graph thread, and the
--- a/dom/media/webaudio/AudioNode.h
+++ b/dom/media/webaudio/AudioNode.h
@@ -23,17 +23,16 @@ namespace mozilla {
 
 namespace dom {
 
 class AudioContext;
 class AudioBufferSourceNode;
 class AudioParam;
 class AudioParamTimeline;
 struct ThreeDPoint;
-struct AudioTimelineEvent;
 
 /**
  * The DOM object representing a Web Audio AudioNode.
  *
  * Each AudioNode has a MediaStream representing the actual
  * real-time processing and output of this AudioNode.
  *
  * We track the incoming and outgoing connections to other AudioNodes.
@@ -219,18 +218,16 @@ private:
 protected:
   static void Callback(AudioNode* aNode) { /* not implemented */ }
 
   // Helpers for sending different value types to streams
   void SendDoubleParameterToStream(uint32_t aIndex, double aValue);
   void SendInt32ParameterToStream(uint32_t aIndex, int32_t aValue);
   void SendThreeDPointParameterToStream(uint32_t aIndex, const ThreeDPoint& aValue);
   void SendChannelMixingParametersToStream();
-  static void SendTimelineEventToStream(AudioNode* aNode, uint32_t aIndex,
-                                        const dom::AudioTimelineEvent& aEvent);
 
 private:
   nsRefPtr<AudioContext> mContext;
 
 protected:
   // Must be set in the constructor. Must not be null unless finished.
   nsRefPtr<AudioNodeStream> mStream;
 
--- a/dom/media/webaudio/AudioParam.cpp
+++ b/dom/media/webaudio/AudioParam.cpp
@@ -39,24 +39,24 @@ AudioParam::Release()
   }
   NS_IMPL_CC_NATIVE_RELEASE_BODY(AudioParam)
 }
 
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AudioParam, AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AudioParam, Release)
 
 AudioParam::AudioParam(AudioNode* aNode,
-                       AudioParam::CallbackType aCallback,
+                       uint32_t aIndex,
                        float aDefaultValue,
                        const char* aName)
   : AudioParamTimeline(aDefaultValue)
   , mNode(aNode)
-  , mCallback(aCallback)
+  , mName(aName)
+  , mIndex(aIndex)
   , mDefaultValue(aDefaultValue)
-  , mName(aName)
 {
 }
 
 AudioParam::~AudioParam()
 {
   MOZ_ASSERT(mInputNodes.IsEmpty());
 }
 
@@ -115,22 +115,30 @@ AudioParam::Stream()
   AudioNodeStream* nodeStream = mNode->GetStream();
   if (nodeStream) {
     mNodeStreamPort =
       nodeStream->AllocateInputPort(mStream, AudioNodeStream::AUDIO_TRACK);
   }
 
   // Send the stream to the timeline on the MSG side.
   AudioTimelineEvent event(mStream);
-
-  mCallback(mNode, event);
+  SendEventToEngine(event);
 
   return mStream;
 }
 
+void
+AudioParam::SendEventToEngine(const AudioTimelineEvent& aEvent)
+{
+  AudioNodeStream* stream = mNode->GetStream();
+  if (stream) {
+    stream->SendTimelineEvent(mIndex, aEvent);
+  }
+}
+
 float
 AudioParamTimeline::AudioNodeInputValue(size_t aCounter) const
 {
   MOZ_ASSERT(mStream);
 
   // If we have a chunk produced by the AudioNode inputs to the AudioParam,
   // get its value now.  We use aCounter to tell us which frame of the last
   // AudioChunk to look at.
--- a/dom/media/webaudio/AudioParam.h
+++ b/dom/media/webaudio/AudioParam.h
@@ -21,20 +21,18 @@ namespace mozilla {
 namespace dom {
 
 class AudioParam final : public nsWrapperCache,
                          public AudioParamTimeline
 {
   virtual ~AudioParam();
 
 public:
-  typedef void (*CallbackType)(AudioNode* aNode, const AudioTimelineEvent&);
-
   AudioParam(AudioNode* aNode,
-             CallbackType aCallback,
+             uint32_t aIndex,
              float aDefaultValue,
              const char* aName);
 
   NS_IMETHOD_(MozExternalRefCountType) AddRef(void);
   NS_IMETHOD_(MozExternalRefCountType) Release(void);
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(AudioParam)
 
   AudioContext* GetParentObject() const
@@ -67,17 +65,17 @@ public:
     if (!ValidateEvent(event, rv)) {
       MOZ_ASSERT(false, "This should not happen, "
                         "setting the value should always work");
       return;
     }
 
     AudioParamTimeline::SetValue(aValue);
 
-    mCallback(mNode, event);
+    SendEventToEngine(event);
   }
 
   void SetValueAtTime(float aValue, double aStartTime, ErrorResult& aRv)
   {
     if (!WebAudioUtils::IsTimeValid(aStartTime)) {
       aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
       return;
     }
@@ -124,17 +122,17 @@ public:
       return;
     }
 
     // Remove some events on the main thread copy.
     AudioEventTimeline::CancelScheduledValues(aStartTime);
 
     AudioTimelineEvent event(AudioTimelineEvent::Cancel, aStartTime, 0.0f);
 
-    mCallback(mNode, event);
+    SendEventToEngine(event);
   }
 
   uint32_t ParentNodeId()
   {
     return mNode->Id();
   }
 
   void GetName(nsAString& aName)
@@ -188,20 +186,16 @@ public:
     return amount;
   }
 
   virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override
   {
     return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
   }
 
-protected:
-  nsCycleCollectingAutoRefCnt mRefCnt;
-  NS_DECL_OWNINGTHREAD
-
 private:
   void EventInsertionHelper(ErrorResult& aRv,
                             AudioTimelineEvent::Type aType,
                             double aTime, float aValue,
                             double aTimeConstant = 0.0,
                             float aDuration = 0.0,
                             const float* aCurve = nullptr,
                             uint32_t aCurveLength = 0)
@@ -210,27 +204,31 @@ private:
                              aTimeConstant, aDuration, aCurve, aCurveLength);
 
     if (!ValidateEvent(event, aRv)) {
       return;
     }
 
     AudioEventTimeline::InsertEvent<double>(event);
 
-    mCallback(mNode, event);
+    SendEventToEngine(event);
   }
 
+  void SendEventToEngine(const AudioTimelineEvent& aEvent);
+
+  nsCycleCollectingAutoRefCnt mRefCnt;
+  NS_DECL_OWNINGTHREAD
   nsRefPtr<AudioNode> mNode;
   // For every InputNode, there is a corresponding entry in mOutputParams of the
   // InputNode's mInputNode.
   nsTArray<AudioNode::InputNode> mInputNodes;
-  CallbackType mCallback;
-  const float mDefaultValue;
   const char* mName;
   // The input port used to connect the AudioParam's stream to its node's stream
   nsRefPtr<MediaInputPort> mNodeStreamPort;
+  const uint32_t mIndex;
+  const float mDefaultValue;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif
 
--- a/dom/media/webaudio/BiquadFilterNode.cpp
+++ b/dom/media/webaudio/BiquadFilterNode.cpp
@@ -237,20 +237,21 @@ private:
 };
 
 BiquadFilterNode::BiquadFilterNode(AudioContext* aContext)
   : AudioNode(aContext,
               2,
               ChannelCountMode::Max,
               ChannelInterpretation::Speakers)
   , mType(BiquadFilterType::Lowpass)
-  , 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"))
+  , mFrequency(new AudioParam(this, BiquadFilterNodeEngine::FREQUENCY,
+                              350.f, "frequency"))
+  , mDetune(new AudioParam(this, BiquadFilterNodeEngine::DETUNE, 0.f, "detune"))
+  , mQ(new AudioParam(this, BiquadFilterNodeEngine::Q, 1.f, "Q"))
+  , mGain(new AudioParam(this, BiquadFilterNodeEngine::GAIN, 0.f, "gain"))
 {
   BiquadFilterNodeEngine* engine = new BiquadFilterNodeEngine(this, aContext->Destination());
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NO_STREAM_FLAGS);
 }
 
 BiquadFilterNode::~BiquadFilterNode()
 {
@@ -331,38 +332,10 @@ BiquadFilterNode::GetFrequencyResponse(c
   double gain = mGain->GetValueAtTime(currentTime);
   double detune = mDetune->GetValueAtTime(currentTime);
 
   WebCore::Biquad biquad;
   SetParamsOnBiquad(biquad, Context()->SampleRate(), mType, freq, q, gain, detune);
   biquad.getFrequencyResponse(int(length), frequencies, aMagResponse.Data(), aPhaseResponse.Data());
 }
 
-void
-BiquadFilterNode::SendFrequencyToStream(AudioNode* aNode, const AudioTimelineEvent& aEvent)
-{
-  BiquadFilterNode* This = static_cast<BiquadFilterNode*>(aNode);
-  SendTimelineEventToStream(This, BiquadFilterNodeEngine::FREQUENCY, aEvent);
-}
-
-void
-BiquadFilterNode::SendDetuneToStream(AudioNode* aNode, const AudioTimelineEvent& aEvent)
-{
-  BiquadFilterNode* This = static_cast<BiquadFilterNode*>(aNode);
-  SendTimelineEventToStream(This, BiquadFilterNodeEngine::DETUNE, aEvent);
-}
-
-void
-BiquadFilterNode::SendQToStream(AudioNode* aNode, const AudioTimelineEvent& aEvent)
-{
-  BiquadFilterNode* This = static_cast<BiquadFilterNode*>(aNode);
-  SendTimelineEventToStream(This, BiquadFilterNodeEngine::Q, aEvent);
-}
-
-void
-BiquadFilterNode::SendGainToStream(AudioNode* aNode, const AudioTimelineEvent& aEvent)
-{
-  BiquadFilterNode* This = static_cast<BiquadFilterNode*>(aNode);
-  SendTimelineEventToStream(This, BiquadFilterNodeEngine::GAIN, aEvent);
-}
-
 } // namespace dom
 } // namespace mozilla
--- a/dom/media/webaudio/BiquadFilterNode.h
+++ b/dom/media/webaudio/BiquadFilterNode.h
@@ -10,17 +10,16 @@
 #include "AudioNode.h"
 #include "AudioParam.h"
 #include "mozilla/dom/BiquadFilterNodeBinding.h"
 
 namespace mozilla {
 namespace dom {
 
 class AudioContext;
-struct AudioTimelineEvent;
 
 class BiquadFilterNode final : public AudioNode
 {
 public:
   explicit BiquadFilterNode(AudioContext* aContext);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(BiquadFilterNode, AudioNode)
@@ -64,26 +63,16 @@ public:
 
   virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
   virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
 
 protected:
   virtual ~BiquadFilterNode();
 
 private:
-  static void SendFrequencyToStream(AudioNode* aNode,
-                                    const AudioTimelineEvent& aEvent);
-  static void SendDetuneToStream(AudioNode* aNode,
-                                const AudioTimelineEvent& aEvente);
-  static void SendQToStream(AudioNode* aNode,
-                            const AudioTimelineEvent& aEvent);
-  static void SendGainToStream(AudioNode* aNode,
-                               const AudioTimelineEvent& aEvent);
-
-private:
   BiquadFilterType mType;
   nsRefPtr<AudioParam> mFrequency;
   nsRefPtr<AudioParam> mDetune;
   nsRefPtr<AudioParam> mQ;
   nsRefPtr<AudioParam> mGain;
 };
 
 } // namespace dom
--- a/dom/media/webaudio/DelayNode.cpp
+++ b/dom/media/webaudio/DelayNode.cpp
@@ -191,17 +191,17 @@ public:
   int32_t mLeftOverData;
 };
 
 DelayNode::DelayNode(AudioContext* aContext, double aMaxDelay)
   : AudioNode(aContext,
               2,
               ChannelCountMode::Max,
               ChannelInterpretation::Speakers)
-  , mDelay(new AudioParam(this, SendDelayToStream, 0.0f, "delayTime"))
+  , mDelay(new AudioParam(this, DelayNodeEngine::DELAY, 0.0f, "delayTime"))
 {
   DelayNodeEngine* engine =
     new DelayNodeEngine(this, aContext->Destination(),
                         aContext->SampleRate() * aMaxDelay);
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NO_STREAM_FLAGS);
 }
 
@@ -224,17 +224,10 @@ DelayNode::SizeOfIncludingThis(MallocSiz
 }
 
 JSObject*
 DelayNode::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return DelayNodeBinding::Wrap(aCx, this, aGivenProto);
 }
 
-void
-DelayNode::SendDelayToStream(AudioNode* aNode, const AudioTimelineEvent& aEvent)
-{
-  DelayNode* This = static_cast<DelayNode*>(aNode);
-  SendTimelineEventToStream(This, DelayNodeEngine::DELAY, aEvent);
-}
-
 } // namespace dom
 } // namespace mozilla
--- a/dom/media/webaudio/DelayNode.h
+++ b/dom/media/webaudio/DelayNode.h
@@ -37,18 +37,16 @@ public:
 
   virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
   virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
 
 protected:
   virtual ~DelayNode();
 
 private:
-  static void SendDelayToStream(AudioNode* aNode,
-                                const AudioTimelineEvent& aEvent);
   friend class DelayNodeEngine;
 
 private:
   nsRefPtr<AudioParam> mDelay;
 };
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/media/webaudio/DynamicsCompressorNode.cpp
+++ b/dom/media/webaudio/DynamicsCompressorNode.cpp
@@ -181,22 +181,27 @@ private:
   nsAutoPtr<DynamicsCompressor> mCompressor;
 };
 
 DynamicsCompressorNode::DynamicsCompressorNode(AudioContext* aContext)
   : AudioNode(aContext,
               2,
               ChannelCountMode::Explicit,
               ChannelInterpretation::Speakers)
-  , mThreshold(new AudioParam(this, SendThresholdToStream, -24.f, "threshold"))
-  , mKnee(new AudioParam(this, SendKneeToStream, 30.f, "knee"))
-  , mRatio(new AudioParam(this, SendRatioToStream, 12.f, "ratio"))
+  , mThreshold(new AudioParam(this, DynamicsCompressorNodeEngine::THRESHOLD,
+                              -24.f, "threshold"))
+  , mKnee(new AudioParam(this, DynamicsCompressorNodeEngine::KNEE,
+                         30.f, "knee"))
+  , mRatio(new AudioParam(this, DynamicsCompressorNodeEngine::RATIO,
+                          12.f, "ratio"))
   , mReduction(0)
-  , mAttack(new AudioParam(this, SendAttackToStream, 0.003f, "attack"))
-  , mRelease(new AudioParam(this, SendReleaseToStream, 0.25f, "release"))
+  , mAttack(new AudioParam(this, DynamicsCompressorNodeEngine::ATTACK,
+                           0.003f, "attack"))
+  , mRelease(new AudioParam(this, DynamicsCompressorNodeEngine::RELEASE,
+                            0.25f, "release"))
 {
   DynamicsCompressorNodeEngine* engine = new DynamicsCompressorNodeEngine(this, aContext->Destination());
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NO_STREAM_FLAGS);
 }
 
 DynamicsCompressorNode::~DynamicsCompressorNode()
 {
@@ -221,50 +226,10 @@ DynamicsCompressorNode::SizeOfIncludingT
 }
 
 JSObject*
 DynamicsCompressorNode::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return DynamicsCompressorNodeBinding::Wrap(aCx, this, aGivenProto);
 }
 
-void
-DynamicsCompressorNode::SendThresholdToStream(AudioNode* aNode,
-                                              const AudioTimelineEvent& aEvent)
-{
-  DynamicsCompressorNode* This = static_cast<DynamicsCompressorNode*>(aNode);
-  SendTimelineEventToStream(This, DynamicsCompressorNodeEngine::THRESHOLD, aEvent);
-}
-
-void
-DynamicsCompressorNode::SendKneeToStream(AudioNode* aNode,
-                                         const AudioTimelineEvent& aEvent)
-{
-  DynamicsCompressorNode* This = static_cast<DynamicsCompressorNode*>(aNode);
-  SendTimelineEventToStream(This, DynamicsCompressorNodeEngine::KNEE, aEvent);
-}
-
-void
-DynamicsCompressorNode::SendRatioToStream(AudioNode* aNode,
-                                          const AudioTimelineEvent& aEvent)
-{
-  DynamicsCompressorNode* This = static_cast<DynamicsCompressorNode*>(aNode);
-  SendTimelineEventToStream(This, DynamicsCompressorNodeEngine::RATIO, aEvent);
-}
-
-void
-DynamicsCompressorNode::SendAttackToStream(AudioNode* aNode,
-                                          const AudioTimelineEvent& aEvent)
-{
-  DynamicsCompressorNode* This = static_cast<DynamicsCompressorNode*>(aNode);
-  SendTimelineEventToStream(This, DynamicsCompressorNodeEngine::ATTACK, aEvent);
-}
-
-void
-DynamicsCompressorNode::SendReleaseToStream(AudioNode* aNode,
-                                            const AudioTimelineEvent& aEvent)
-{
-  DynamicsCompressorNode* This = static_cast<DynamicsCompressorNode*>(aNode);
-  SendTimelineEventToStream(This, DynamicsCompressorNodeEngine::RELEASE, aEvent);
-}
-
 } // namespace dom
 } // namespace mozilla
--- a/dom/media/webaudio/DynamicsCompressorNode.h
+++ b/dom/media/webaudio/DynamicsCompressorNode.h
@@ -69,28 +69,16 @@ public:
     MOZ_ASSERT(NS_IsMainThread());
     mReduction = aReduction;
   }
 
 protected:
   virtual ~DynamicsCompressorNode();
 
 private:
-  static void SendThresholdToStream(AudioNode* aNode,
-                                    const AudioTimelineEvent& aEvent);
-  static void SendKneeToStream(AudioNode* aNode,
-                               const AudioTimelineEvent& aEvent);
-  static void SendRatioToStream(AudioNode* aNode,
-                                const AudioTimelineEvent& aEvent);
-  static void SendAttackToStream(AudioNode* aNode,
-                                 const AudioTimelineEvent& aEvent);
-  static void SendReleaseToStream(AudioNode* aNode,
-                                  const AudioTimelineEvent& aEvent);
-
-private:
   nsRefPtr<AudioParam> mThreshold;
   nsRefPtr<AudioParam> mKnee;
   nsRefPtr<AudioParam> mRatio;
   float mReduction;
   nsRefPtr<AudioParam> mAttack;
   nsRefPtr<AudioParam> mRelease;
 };
 
--- a/dom/media/webaudio/GainNode.cpp
+++ b/dom/media/webaudio/GainNode.cpp
@@ -112,17 +112,17 @@ public:
   AudioParamTimeline mGain;
 };
 
 GainNode::GainNode(AudioContext* aContext)
   : AudioNode(aContext,
               2,
               ChannelCountMode::Max,
               ChannelInterpretation::Speakers)
-  , mGain(new AudioParam(this, SendGainToStream, 1.0f, "gain"))
+  , mGain(new AudioParam(this, GainNodeEngine::GAIN, 1.0f, "gain"))
 {
   GainNodeEngine* engine = new GainNodeEngine(this, aContext->Destination());
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NO_STREAM_FLAGS);
 }
 
 GainNode::~GainNode()
 {
@@ -143,17 +143,10 @@ GainNode::SizeOfIncludingThis(MallocSize
 }
 
 JSObject*
 GainNode::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return GainNodeBinding::Wrap(aCx, this, aGivenProto);
 }
 
-void
-GainNode::SendGainToStream(AudioNode* aNode, const AudioTimelineEvent& aEvent)
-{
-  GainNode* This = static_cast<GainNode*>(aNode);
-  SendTimelineEventToStream(This, GainNodeEngine::GAIN, aEvent);
-}
-
 } // namespace dom
 } // namespace mozilla
--- a/dom/media/webaudio/GainNode.h
+++ b/dom/media/webaudio/GainNode.h
@@ -37,19 +37,16 @@ public:
 
   virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
   virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
 
 protected:
   virtual ~GainNode();
 
 private:
-  static void SendGainToStream(AudioNode* aNode, const AudioTimelineEvent& aEvent);
-
-private:
   nsRefPtr<AudioParam> mGain;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif
 
--- a/dom/media/webaudio/OscillatorNode.cpp
+++ b/dom/media/webaudio/OscillatorNode.cpp
@@ -397,18 +397,19 @@ public:
 };
 
 OscillatorNode::OscillatorNode(AudioContext* aContext)
   : AudioNode(aContext,
               2,
               ChannelCountMode::Max,
               ChannelInterpretation::Speakers)
   , mType(OscillatorType::Sine)
-  , mFrequency(new AudioParam(this, SendFrequencyToStream, 440.0f, "frequency"))
-  , mDetune(new AudioParam(this, SendDetuneToStream, 0.0f, "detune"))
+  , mFrequency(new AudioParam(this, OscillatorNodeEngine::FREQUENCY,
+                              440.0f, "frequency"))
+  , mDetune(new AudioParam(this, OscillatorNodeEngine::DETUNE, 0.0f, "detune"))
   , mStartCalled(false)
 {
   OscillatorNodeEngine* engine = new OscillatorNodeEngine(this, aContext->Destination());
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NEED_MAIN_THREAD_FINISHED);
   engine->SetSourceStream(mStream);
   mStream->AddMainThreadListener(this);
 }
@@ -448,36 +449,16 @@ OscillatorNode::DestroyMediaStream()
 {
   if (mStream) {
     mStream->RemoveMainThreadListener(this);
   }
   AudioNode::DestroyMediaStream();
 }
 
 void
-OscillatorNode::SendFrequencyToStream(AudioNode* aNode, const AudioTimelineEvent& aEvent)
-{
-  OscillatorNode* This = static_cast<OscillatorNode*>(aNode);
-  if (!This->mStream) {
-    return;
-  }
-  SendTimelineEventToStream(This, OscillatorNodeEngine::FREQUENCY, aEvent);
-}
-
-void
-OscillatorNode::SendDetuneToStream(AudioNode* aNode, const AudioTimelineEvent& aEvent)
-{
-  OscillatorNode* This = static_cast<OscillatorNode*>(aNode);
-  if (!This->mStream) {
-    return;
-  }
-  SendTimelineEventToStream(This, OscillatorNodeEngine::DETUNE, aEvent);
-}
-
-void
 OscillatorNode::SendTypeToStream()
 {
   if (!mStream) {
     return;
   }
   if (mType == OscillatorType::Custom) {
     // The engine assumes we'll send the custom data before updating the type.
     SendPeriodicWaveToStream();
--- a/dom/media/webaudio/OscillatorNode.h
+++ b/dom/media/webaudio/OscillatorNode.h
@@ -82,18 +82,16 @@ public:
 
   virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
   virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
 
 protected:
   virtual ~OscillatorNode();
 
 private:
-  static void SendFrequencyToStream(AudioNode* aNode, const AudioTimelineEvent& aEvent);
-  static void SendDetuneToStream(AudioNode* aNode, const AudioTimelineEvent& aEvent);
   void SendTypeToStream();
   void SendPeriodicWaveToStream();
 
 private:
   OscillatorType mType;
   nsRefPtr<PeriodicWave> mPeriodicWave;
   nsRefPtr<AudioParam> mFrequency;
   nsRefPtr<AudioParam> mDetune;
--- a/dom/media/webaudio/StereoPannerNode.cpp
+++ b/dom/media/webaudio/StereoPannerNode.cpp
@@ -166,17 +166,17 @@ public:
   AudioParamTimeline mPan;
 };
 
 StereoPannerNode::StereoPannerNode(AudioContext* aContext)
   : AudioNode(aContext,
               2,
               ChannelCountMode::Clamped_max,
               ChannelInterpretation::Speakers)
-  , mPan(new AudioParam(this, SendPanToStream, 0.f, "pan"))
+  , mPan(new AudioParam(this, StereoPannerNodeEngine::PAN, 0.f, "pan"))
 {
   StereoPannerNodeEngine* engine = new StereoPannerNodeEngine(this, aContext->Destination());
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NO_STREAM_FLAGS);
 }
 
 StereoPannerNode::~StereoPannerNode()
 {
@@ -197,17 +197,10 @@ StereoPannerNode::SizeOfIncludingThis(Ma
 }
 
 JSObject*
 StereoPannerNode::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return StereoPannerNodeBinding::Wrap(aCx, this, aGivenProto);
 }
 
-void
-StereoPannerNode::SendPanToStream(AudioNode* aNode, const AudioTimelineEvent& aEvent)
-{
-  StereoPannerNode* This = static_cast<StereoPannerNode*>(aNode);
-  SendTimelineEventToStream(This, StereoPannerNodeEngine::PAN, aEvent);
-}
-
 } // namespace dom
 } // namespace mozilla
--- a/dom/media/webaudio/StereoPannerNode.h
+++ b/dom/media/webaudio/StereoPannerNode.h
@@ -55,18 +55,16 @@ public:
 
   virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
   virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
 
 protected:
   virtual ~StereoPannerNode();
 
 private:
-  static void SendPanToStream(AudioNode* aNode,
-                              const AudioTimelineEvent& aEvent);
   nsRefPtr<AudioParam> mPan;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif