bug 1205558 remove unnecessary ScriptProcessorNodeEngine::mSource r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 29 Sep 2015 14:30:40 +1300
changeset 265115 cd555b8702ca3c9efe768a5dba59adbb80e41dd3
parent 265114 983347f21a23dbfe7ebe8b11b7a23d4f786c81a5
child 265116 f1f82e673a3490bb572c3a1110eeded81badb9a9
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 unnecessary ScriptProcessorNodeEngine::mSource r=padenot
dom/media/webaudio/ScriptProcessorNode.cpp
--- a/dom/media/webaudio/ScriptProcessorNode.cpp
+++ b/dom/media/webaudio/ScriptProcessorNode.cpp
@@ -240,30 +240,24 @@ private:
 class ScriptProcessorNodeEngine final : public AudioNodeEngine
 {
 public:
   ScriptProcessorNodeEngine(ScriptProcessorNode* aNode,
                             AudioDestinationNode* aDestination,
                             uint32_t aBufferSize,
                             uint32_t aNumberOfInputChannels)
     : AudioNodeEngine(aNode)
-    , mSource(nullptr)
     , mDestination(aDestination->Stream())
+    , mSharedBuffers(new SharedBuffers(mDestination->SampleRate()))
     , mBufferSize(aBufferSize)
     , mInputChannelCount(aNumberOfInputChannels)
     , mInputWriteIndex(0)
   {
   }
 
-  void SetSourceStream(AudioNodeStream* aSource)
-  {
-    mSource = aSource;
-    mSharedBuffers = new SharedBuffers(mSource->SampleRate());
-  }
-
   SharedBuffers* GetSharedBuffers() const
   {
     return mSharedBuffers;
   }
 
   enum {
     IS_CONNECTED,
   };
@@ -340,17 +334,16 @@ public:
     // by main thread events calling
     // SharedBuffers::FinishProducingOutputBuffer() have been processed.
     return true;
   }
 
   virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
   {
     // Not owned:
-    // - mSource (probably)
     // - mDestination (probably)
     size_t amount = AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf);
     amount += mSharedBuffers->SizeOfIncludingThis(aMallocSizeOf);
     amount += mInputBuffer->SizeOfIncludingThis(aMallocSizeOf);
 
     return amount;
   }
 
@@ -472,19 +465,18 @@ private:
     };
 
     NS_DispatchToMainThread(new Command(aStream, mInputBuffer.forget(),
                                         playbackTime));
   }
 
   friend class ScriptProcessorNode;
 
+  AudioNodeStream* mDestination;
   nsAutoPtr<SharedBuffers> mSharedBuffers;
-  AudioNodeStream* mSource;
-  AudioNodeStream* mDestination;
   nsRefPtr<ThreadSharedFloatArrayBufferList> mInputBuffer;
   const uint32_t mBufferSize;
   const uint32_t mInputChannelCount;
   // The write index into the current input buffer
   uint32_t mInputWriteIndex;
   bool mIsConnected = false;
 };
 
@@ -504,17 +496,16 @@ ScriptProcessorNode::ScriptProcessorNode
   MOZ_ASSERT(BufferSize() % WEBAUDIO_BLOCK_SIZE == 0, "Invalid buffer size");
   ScriptProcessorNodeEngine* engine =
     new ScriptProcessorNodeEngine(this,
                                   aContext->Destination(),
                                   BufferSize(),
                                   aNumberOfInputChannels);
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NO_STREAM_FLAGS);
-  engine->SetSourceStream(mStream);
 }
 
 ScriptProcessorNode::~ScriptProcessorNode()
 {
 }
 
 size_t
 ScriptProcessorNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const