Skip to content

Commit

Permalink
Restore debugging prints for AudioNode refs
Browse files Browse the repository at this point in the history
In enabling oilpan for WebAudio, some debugging prints for AudioNode's
were accidentally removed. This restores them and cleans up some of
the messages, and also prints out the current node count. The node
count is in lieu of the m_normalRefCount that was removed in favor of
the standard ref counting mechanism.

The prints are very useful for investigating issues when nodes are not
being destroyed.

BUG=

Review URL: https://codereview.chromium.org/583573006

git-svn-id: svn://svn.chromium.org/blink/trunk@182289 bbb929c8-8fbe-4397-9dbb-9b2b20218538
  • Loading branch information
[email protected] committed Sep 19, 2014
1 parent 2328b15 commit ada6784
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Source/modules/webaudio/AudioNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ AudioNode::~AudioNode()
--s_instanceCount;
#if DEBUG_AUDIONODE_REFERENCES
--s_nodeCount[nodeType()];
fprintf(stderr, "%p: %d: AudioNode::~AudioNode() %d\n", this, nodeType(), m_connectionRefCount);
fprintf(stderr, "%p: %2d: AudioNode::~AudioNode() %d [%d]\n",
this, nodeType(), m_connectionRefCount, s_nodeCount[nodeType()]);
#endif
}

Expand Down Expand Up @@ -151,6 +152,7 @@ void AudioNode::setNodeType(NodeType type)

#if DEBUG_AUDIONODE_REFERENCES
++s_nodeCount[type];
fprintf(stderr, "%p: %2d: AudioNode::AudioNode [%3d]\n", this, nodeType(), s_nodeCount[nodeType()]);
#endif
}

Expand Down Expand Up @@ -482,6 +484,11 @@ void AudioNode::disableOutputsIfNecessary()
void AudioNode::makeConnection()
{
atomicIncrement(&m_connectionRefCount);

#if DEBUG_AUDIONODE_REFERENCES
fprintf(stderr, "%p: %2d: AudioNode::ref %3d [%3d]\n",
this, nodeType(), m_connectionRefCount, s_nodeCount[nodeType()]);
#endif
// See the disabling code in disableOutputsIfNecessary(). This handles
// the case where a node is being re-connected after being used at least
// once and disconnected. In this case, we need to re-enable.
Expand Down Expand Up @@ -520,6 +527,12 @@ void AudioNode::breakConnection()
void AudioNode::breakConnectionWithLock()
{
atomicDecrement(&m_connectionRefCount);

#if DEBUG_AUDIONODE_REFERENCES
fprintf(stderr, "%p: %2d: AudioNode::deref %3d [%3d]\n",
this, nodeType(), m_connectionRefCount, s_nodeCount[nodeType()]);
#endif

if (!m_connectionRefCount)
disableOutputsIfNecessary();
}
Expand All @@ -537,7 +550,7 @@ void AudioNode::printNodeCounts()
fprintf(stderr, "===========================\n");

for (unsigned i = 0; i < NodeTypeEnd; ++i)
fprintf(stderr, "%d: %d\n", i, s_nodeCount[i]);
fprintf(stderr, "%2d: %d\n", i, s_nodeCount[i]);

fprintf(stderr, "===========================\n\n\n");
}
Expand Down

0 comments on commit ada6784

Please sign in to comment.