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

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
Index: Source/modules/webaudio/AudioNode.cpp
diff --git a/Source/modules/webaudio/AudioNode.cpp b/Source/modules/webaudio/AudioNode.cpp
index f325bee4b7fe0be99a585a1d78a51af7652f371f..d86223af01ac5651e6a42e0a4f9d247416e8349c 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()];
@@ -108,15 +103,18 @@ void AudioNode::dispose()
{
ASSERT(isMainThread());
ASSERT(context()->isGraphOwner());
+
+ // This flag prevents:
+ // - the following disconnectAll() from re-registering this AudioNode into the m_outputs.
tkent 2014/08/14 23:25:01 I recommend to wrap code comments in 80 columns.
haraken 2014/08/15 01:27:18 Done.
+ // - this AudioNode from getting marked as dirty after calling unmarkDirtyNode.
+ m_isDisposeCalled = true;
+
#if ENABLE(OILPAN)
haraken 2014/08/12 14:29:51 Note: This CL depends on https://codereview.chromi
context()->removeAutomaticPullNode(this);
for (unsigned i = 0; i < m_outputs.size(); ++i)
output(i)->disconnectAll();
#endif
context()->unmarkDirtyNode(*this);
-#if ENABLE(ASSERT)
- m_didCallDispose = true;
-#endif
}
String AudioNode::nodeTypeName() const
@@ -610,7 +608,7 @@ 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) {
// All references are gone - we need to go away.
for (unsigned i = 0; i < m_outputs.size(); ++i)
output(i)->disconnectAll(); // This will deref() nodes we're connected to.
@@ -618,7 +616,6 @@ void AudioNode::finishDeref()
// Mark for deletion at end of each render quantum or when context shuts
// down.
context()->markForDeletion(this);
- m_isMarkedForDeletion = true;
}
}
#endif

Powered by Google App Engine
This is Rietveld 408576698