Chromium Code Reviews| Index: Source/modules/webaudio/AudioNode.h |
| diff --git a/Source/modules/webaudio/AudioNode.h b/Source/modules/webaudio/AudioNode.h |
| index 5ebe221ee62803656bb0fb4e6301e83faf4d0502..a747aa94db853485d4240be6574a20d903f56b5d 100644 |
| --- a/Source/modules/webaudio/AudioNode.h |
| +++ b/Source/modules/webaudio/AudioNode.h |
| @@ -50,7 +50,7 @@ class ExceptionState; |
| // An AudioDestinationNode has one input and no outputs and represents the final destination to the audio hardware. |
| // Most processing nodes such as filters will have one input and one output, although multiple inputs and outputs are possible. |
| -class AudioNode : public ScriptWrappable, public EventTargetWithInlineData { |
| +class AudioNode : public NoBaseWillBeGarbageCollectedFinalized<AudioNode>, public ScriptWrappable, public EventTargetWithInlineData { |
|
haraken
2014/04/08 06:02:08
Add a comment about why this doesn't need to be Re
keishi
2014/04/21 17:10:11
Done.
|
| public: |
| enum { ProcessingSizeInFrames = 128 }; |
| @@ -179,6 +179,12 @@ public: |
| virtual const AtomicString& interfaceName() const OVERRIDE FINAL; |
| virtual ExecutionContext* executionContext() const OVERRIDE FINAL; |
| + virtual void trace(Visitor*); |
| + |
| +#if ENABLE(OILPAN) |
| + void clearKeepAlive(); |
| +#endif |
| + |
| protected: |
| // Inputs and outputs must be created before the AudioNode is initialized. |
| void addInput(PassOwnPtr<AudioNodeInput>); |
| @@ -195,11 +201,26 @@ protected: |
| private: |
| volatile bool m_isInitialized; |
| NodeType m_nodeType; |
| - RefPtr<AudioContext> m_context; |
| + RefPtrWillBeMember<AudioContext> m_context; |
| float m_sampleRate; |
| Vector<OwnPtr<AudioNodeInput> > m_inputs; |
| Vector<OwnPtr<AudioNodeOutput> > m_outputs; |
| +#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. |
|
haraken
2014/04/08 06:02:08
EventTarget is not yet on-heap, so this comment do
keishi
2014/04/21 17:10:11
Done.
|
| + // |
| + // 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. |
|
haraken
2014/04/08 06:02:08
I'd put this comment in clearKeepAlive() in the cp
keishi
2014/04/21 17:10:11
Done.
|
| + GC_PLUGIN_IGNORE("http://crbug.com/353083") |
| + OwnPtr<Persistent<AudioNode> > m_keepAlive; |
| +#endif |
| + |
| double m_lastProcessingTime; |
| double m_lastNonSilentTime; |