Remove some unused code in AudioContext
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 04:02:28 +0000 (04:02 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 04:02:28 +0000 (04:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76506

Patch by Raymond Liu <raymond.liu@intel.com> on 2012-01-18
Reviewed by Kenneth Russell.

No new tests required.

* webaudio/AudioContext.cpp:
(WebCore::AudioContext::constructCommon):
(WebCore::AudioContext::uninitialize):
* webaudio/AudioContext.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105375 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/webaudio/AudioContext.cpp
Source/WebCore/webaudio/AudioContext.h

index e26def7..292ec01 100644 (file)
@@ -1,5 +1,19 @@
 2012-01-18  Raymond Liu  <raymond.liu@intel.com>
 
+        Remove some unused code in AudioContext
+        https://bugs.webkit.org/show_bug.cgi?id=76506
+
+        Reviewed by Kenneth Russell.
+
+        No new tests required.
+
+        * webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::constructCommon):
+        (WebCore::AudioContext::uninitialize):
+        * webaudio/AudioContext.h:
+
+2012-01-18  Raymond Liu  <raymond.liu@intel.com>
+
         Only create AudioBus with required number of channels for AudioNodeOutput
         https://bugs.webkit.org/show_bug.cgi?id=76417
 
index dca9606..0c1664f 100644 (file)
@@ -172,8 +172,6 @@ void AudioContext::constructCommon()
     FFTFrame::initialize();
     
     m_listener = AudioListener::create();
-    m_temporaryMonoBus = adoptPtr(new AudioBus(1, AudioNode::ProcessingSizeInFrames));
-    m_temporaryStereoBus = adoptPtr(new AudioBus(2, AudioNode::ProcessingSizeInFrames));
 }
 
 AudioContext::~AudioContext()
@@ -238,13 +236,6 @@ void AudioContext::uninitialize()
 
         deleteMarkedNodes();
 
-        // Because the AudioBuffers are garbage collected, we can't delete them here.
-        // Instead, at least release the potentially large amount of allocated memory for the audio data.
-        // Note that we do this *after* the context is uninitialized and stops processing audio.
-        for (unsigned i = 0; i < m_allocatedBuffers.size(); ++i)
-            m_allocatedBuffers[i]->releaseMemory();
-        m_allocatedBuffers.clear();
-    
         m_isInitialized = false;
     }
 }
@@ -295,11 +286,6 @@ bool AudioContext::hasDocument()
     return m_document;
 }
 
-void AudioContext::refBuffer(PassRefPtr<AudioBuffer> buffer)
-{
-    m_allocatedBuffers.append(buffer);
-}
-
 PassRefPtr<AudioBuffer> AudioContext::createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionCode& ec)
 {
     RefPtr<AudioBuffer> audioBuffer = AudioBuffer::create(numberOfChannels, numberOfFrames, sampleRate);
index c4eec08..ba7c538 100644 (file)
@@ -102,9 +102,6 @@ public:
     // Asynchronous audio file data decoding.
     void decodeAudioData(ArrayBuffer*, PassRefPtr<AudioBufferCallback>, PassRefPtr<AudioBufferCallback>, ExceptionCode& ec);
 
-    // Keep track of this buffer so we can release memory after the context is shut down...
-    void refBuffer(PassRefPtr<AudioBuffer> buffer);
-
     AudioListener* listener() { return m_listener.get(); }
 
     // The AudioNode create methods are called on the main thread (from JavaScript).
@@ -126,9 +123,6 @@ public:
     PassRefPtr<AudioChannelSplitter> createChannelSplitter();
     PassRefPtr<AudioChannelMerger> createChannelMerger();
 
-    AudioBus* temporaryMonoBus() { return m_temporaryMonoBus.get(); }
-    AudioBus* temporaryStereoBus() { return m_temporaryStereoBus.get(); }
-
     // When a source node has no more processing to do (has finished playing), then it tells the context to dereference it.
     void notifyNodeFinishedProcessing(AudioNode*);
 
@@ -255,9 +249,6 @@ private:
     RefPtr<AudioDestinationNode> m_destinationNode;
     RefPtr<AudioListener> m_listener;
 
-    // Only accessed in the main thread.
-    Vector<RefPtr<AudioBuffer> > m_allocatedBuffers;
-
     // Only accessed in the audio thread.
     Vector<AudioNode*> m_finishedNodes;
 
@@ -277,9 +268,6 @@ private:
     void handleDirtyAudioNodeInputs();
     void handleDirtyAudioNodeOutputs();
 
-    OwnPtr<AudioBus> m_temporaryMonoBus;
-    OwnPtr<AudioBus> m_temporaryStereoBus;
-
     unsigned m_connectionCount;
 
     // Graph locking.