Chromium Code Reviews| Index: Source/modules/webaudio/ScriptProcessorNode.h |
| diff --git a/Source/modules/webaudio/ScriptProcessorNode.h b/Source/modules/webaudio/ScriptProcessorNode.h |
| index 08a187df65576382d6bb8b5c43f893d02af020f8..d6afb822bb1db12374e67e0898bd81f23416f48b 100644 |
| --- a/Source/modules/webaudio/ScriptProcessorNode.h |
| +++ b/Source/modules/webaudio/ScriptProcessorNode.h |
| @@ -50,7 +50,7 @@ public: |
| // This value controls how frequently the onaudioprocess event handler is called and how many sample-frames need to be processed each call. |
| // Lower numbers for bufferSize will result in a lower (better) latency. Higher numbers will be necessary to avoid audio breakup and glitches. |
| // The value chosen must carefully balance between latency and audio quality. |
| - static PassRefPtr<ScriptProcessorNode> create(AudioContext*, float sampleRate, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChannels); |
| + static PassRefPtrWillBeRawPtr<ScriptProcessorNode> create(AudioContext*, float sampleRate, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChannels); |
| virtual ~ScriptProcessorNode(); |
| @@ -63,6 +63,11 @@ public: |
| DEFINE_ATTRIBUTE_EVENT_LISTENER(audioprocess); |
| +#if ENABLE(OILPAN) |
| + virtual void clearKeepAlive() OVERRIDE; |
| +#endif |
| + |
| + void trace(Visitor*); |
| private: |
| virtual double tailTime() const OVERRIDE; |
| @@ -78,8 +83,8 @@ private: |
| void swapBuffers() { m_doubleBufferIndex = 1 - m_doubleBufferIndex; } |
| unsigned m_doubleBufferIndex; |
| unsigned m_doubleBufferIndexForEvent; |
| - Vector<RefPtr<AudioBuffer> > m_inputBuffers; |
| - Vector<RefPtr<AudioBuffer> > m_outputBuffers; |
| + WillBeHeapVector<RefPtrWillBeMember<AudioBuffer> > m_inputBuffers; |
| + WillBeHeapVector<RefPtrWillBeMember<AudioBuffer> > m_outputBuffers; |
| size_t m_bufferSize; |
| unsigned m_bufferReadWriteIndex; |
| @@ -91,6 +96,20 @@ private: |
| // Synchronize process() with fireProcessEvent(). |
| mutable Mutex m_processEventLock; |
| + |
| +#if ENABLE(OILPAN) |
| + // AudioNodes are still reference counted but they are in the |
| + // oilpan heap because the ScriptProcessorNode is an EventTarget. |
| + // This self-persistent keeps the object from being deleted |
| + // until the reference count reaches zero. |
| + // |
| + // It is safe to drop the self-persistent when the ref count |
| + // of a ScriptProcessorNode reaches zero. At that point, the |
| + // ScriptProcessor node is removed from the AudioContext and |
| + // it cannot be reattached. Therefore, the reference count |
| + // will not go above zero again. |
| + OwnPtr<Persistent<AudioNode> > m_keepAlive; |
|
Mads Ager (chromium)
2014/04/03 08:39:33
This has to be in AudioNode. When the ref count in
keishi
2014/04/08 02:33:40
Done.
|
| +#endif |
| }; |
| } // namespace WebCore |