Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1584)

Unified Diff: Source/modules/webaudio/AudioNode.cpp

Issue 460303003: Merge m_didCallDispose and m_isMarkedForDeletion flags into one flag (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/webaudio/AudioNode.h ('k') | Source/modules/webaudio/AudioNodeInput.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/AudioNode.cpp
diff --git a/Source/modules/webaudio/AudioNode.cpp b/Source/modules/webaudio/AudioNode.cpp
index 06169e3aa09ffe4cc971e8d8289717d9cc33baa3..733bccb840c23edeca0a71922f2a4f7354d887d0 100644
--- a/Source/modules/webaudio/AudioNode.cpp
+++ b/Source/modules/webaudio/AudioNode.cpp
@@ -56,13 +56,8 @@ AudioNode::AudioNode(AudioContext* context, float sampleRate)
, m_normalRefCount(1) // start out with normal refCount == 1 (like WTF::RefCounted class)
#endif
, m_connectionRefCount(0)
-#if !ENABLE(OILPAN)
- , m_isMarkedForDeletion(false)
-#endif
, m_isDisabled(false)
-#if ENABLE(ASSERT)
- , m_didCallDispose(false)
-#endif
+ , m_isDisposeCalled(false)
, m_channelCount(2)
, m_channelCountMode(Max)
, m_channelInterpretation(AudioBus::Speakers)
@@ -82,7 +77,7 @@ AudioNode::AudioNode(AudioContext* context, float sampleRate)
AudioNode::~AudioNode()
{
- ASSERT(m_didCallDispose);
+ ASSERT(m_isDisposeCalled);
--s_instanceCount;
#if DEBUG_AUDIONODE_REFERENCES
--s_nodeCount[nodeType()];
@@ -109,13 +104,17 @@ void AudioNode::dispose()
ASSERT(isMainThread());
ASSERT(context()->isGraphOwner());
+ // This flag prevents:
+ // - the following disconnectAll() from re-registering this AudioNode into
+ // the m_outputs.
+ // - this AudioNode from getting marked as dirty after calling
+ // unmarkDirtyNode.
+ m_isDisposeCalled = true;
+
context()->removeAutomaticPullNode(this);
for (unsigned i = 0; i < m_outputs.size(); ++i)
output(i)->disconnectAll();
context()->unmarkDirtyNode(*this);
-#if ENABLE(ASSERT)
- m_didCallDispose = true;
-#endif
}
String AudioNode::nodeTypeName() const
@@ -605,11 +604,10 @@ void AudioNode::finishDeref()
fprintf(stderr, "%p: %d: AudioNode::deref() %d %d\n", this, nodeType(), m_normalRefCount, m_connectionRefCount);
#endif
- if (!m_normalRefCount && !m_isMarkedForDeletion) {
+ if (!m_normalRefCount) {
// Mark for deletion at end of each render quantum or when context shuts
// down.
context()->markForDeletion(this);
- m_isMarkedForDeletion = true;
}
}
#endif
« no previous file with comments | « Source/modules/webaudio/AudioNode.h ('k') | Source/modules/webaudio/AudioNodeInput.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698