| Index: Source/modules/webaudio/AudioNode.cpp
|
| diff --git a/Source/modules/webaudio/AudioNode.cpp b/Source/modules/webaudio/AudioNode.cpp
|
| index b6892a3f2a6238e5fcd1c9f50f367feff57ff15c..37bb3cb61a5c6dd9bd3d715f5a4ab90e6166089b 100644
|
| --- a/Source/modules/webaudio/AudioNode.cpp
|
| +++ b/Source/modules/webaudio/AudioNode.cpp
|
| @@ -48,6 +48,9 @@ AudioNode::AudioNode(AudioContext* context, float sampleRate)
|
| , m_nodeType(NodeTypeUnknown)
|
| , m_context(context)
|
| , m_sampleRate(sampleRate)
|
| +#if ENABLE(OILPAN)
|
| + , m_keepAlive(adoptPtr(new Persistent<AudioNode>(this)))
|
| +#endif
|
| , m_lastProcessingTime(-1)
|
| , m_lastNonSilentTime(-1)
|
| , m_normalRefCount(1) // start out with normal refCount == 1 (like WTF::RefCounted class)
|
| @@ -473,6 +476,9 @@ void AudioNode::disableOutputsIfNecessary()
|
|
|
| void AudioNode::ref(RefType refType)
|
| {
|
| +#if ENABLE(OILPAN)
|
| + ASSERT(m_keepAlive);
|
| +#endif
|
| switch (refType) {
|
| case RefTypeNormal:
|
| atomicIncrement(&m_normalRefCount);
|
| @@ -587,6 +593,24 @@ void AudioNode::printNodeCounts()
|
|
|
| #endif // DEBUG_AUDIONODE_REFERENCES
|
|
|
| +void AudioNode::trace(Visitor* visitor)
|
| +{
|
| + visitor->trace(m_context);
|
| +}
|
| +
|
| +#if ENABLE(OILPAN)
|
| +void AudioNode::clearKeepAlive()
|
| +{
|
| + // It is safe to drop the self-persistent when the ref count
|
| + // of a AudioNode reaches zero. At that point, the
|
| + // AudioNode node is removed from the AudioContext and
|
| + // it cannot be reattached. Therefore, the reference count
|
| + // will not go above zero again.
|
| + ASSERT(m_keepAlive);
|
| + m_keepAlive = nullptr;
|
| +}
|
| +#endif
|
| +
|
| } // namespace WebCore
|
|
|
| #endif // ENABLE(WEB_AUDIO)
|
|
|