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

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

Issue 438293003: Enable Oilpan by default for webaudio/ (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/AudioNode.idl » ('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 733bccb840c23edeca0a71922f2a4f7354d887d0..9e96fc3e81498e2ede81840bf342f7e2892cb946 100644
--- a/Source/modules/webaudio/AudioNode.cpp
+++ b/Source/modules/webaudio/AudioNode.cpp
@@ -52,9 +52,6 @@ AudioNode::AudioNode(AudioContext* context, float sampleRate)
, m_sampleRate(sampleRate)
, m_lastProcessingTime(-1)
, m_lastNonSilentTime(-1)
-#if !ENABLE(OILPAN)
- , m_normalRefCount(1) // start out with normal refCount == 1 (like WTF::RefCounted class)
-#endif
, m_connectionRefCount(0)
, m_isDisabled(false)
, m_isDisposeCalled(false)
@@ -63,9 +60,7 @@ AudioNode::AudioNode(AudioContext* context, float sampleRate)
, m_channelInterpretation(AudioBus::Speakers)
{
ScriptWrappable::init(this);
-#if ENABLE(OILPAN)
m_context->registerLiveNode(*this);
-#endif
#if DEBUG_AUDIONODE_REFERENCES
if (!s_isNodeCountInitialized) {
s_isNodeCountInitialized = true;
@@ -81,11 +76,7 @@ AudioNode::~AudioNode()
--s_instanceCount;
#if DEBUG_AUDIONODE_REFERENCES
--s_nodeCount[nodeType()];
-#if ENABLE(OILPAN)
fprintf(stderr, "%p: %d: AudioNode::~AudioNode() %d\n", this, nodeType(), m_connectionRefCount);
-#else
- fprintf(stderr, "%p: %d: AudioNode::~AudioNode() %d %d\n", this, nodeType(), m_normalRefCount, m_connectionRefCount);
-#endif
#endif
}
@@ -176,7 +167,7 @@ void AudioNode::addInput()
m_inputs.append(AudioNodeInput::create(*this));
}
-void AudioNode::addOutput(PassOwnPtrWillBeRawPtr<AudioNodeOutput> output)
+void AudioNode::addOutput(AudioNodeOutput* output)
{
m_outputs.append(output);
}
@@ -473,7 +464,7 @@ void AudioNode::enableOutputsIfNecessary()
void AudioNode::disableOutputsIfNecessary()
{
// Disable outputs if appropriate. We do this if the number of connections is 0 or 1. The case
- // of 0 is from finishDeref() where there are no connections left. The case of 1 is from
+ // of 0 is from deref() where there are no connections left. The case of 1 is from
// AudioNodeInput::disable() where we want to disable outputs when there's only one connection
// left because we're ready to go away, but can't quite yet.
if (m_connectionRefCount <= 1 && !m_isDisabled) {
@@ -496,63 +487,15 @@ void AudioNode::disableOutputsIfNecessary()
}
}
-#if !ENABLE(OILPAN)
-void AudioNode::ref()
-{
- atomicIncrement(&m_normalRefCount);
-
-#if DEBUG_AUDIONODE_REFERENCES
- fprintf(stderr, "%p: %d: AudioNode::ref() %d %d\n", this, nodeType(), m_normalRefCount, m_connectionRefCount);
-#endif
-}
-#endif
-
void AudioNode::makeConnection()
{
atomicIncrement(&m_connectionRefCount);
- // See the disabling code in finishDeref() below. 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.
+ // 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.
enableOutputsIfNecessary();
}
-#if !ENABLE(OILPAN)
-void AudioNode::deref()
-{
- // The actual work for deref happens completely within the audio context's
- // graph lock. In the case of the audio thread, we must use a tryLock to
- // avoid glitches.
- bool hasLock = false;
- bool mustReleaseLock = false;
-
- if (context()->isAudioThread()) {
- // Real-time audio thread must not contend lock (to avoid glitches).
- hasLock = context()->tryLock(mustReleaseLock);
- } else {
- context()->lock(mustReleaseLock);
- hasLock = true;
- }
-
- if (hasLock) {
- // This is where the real deref work happens.
- finishDeref();
-
- if (mustReleaseLock)
- context()->unlock();
- } else {
- // We were unable to get the lock, so put this in a list to finish up later.
- ASSERT(context()->isAudioThread());
- context()->addDeferredFinishDeref(this);
- }
-
- // Once AudioContext::uninitialize() is called there's no more chances for deleteMarkedNodes() to get called, so we call here.
- // We can't call in AudioContext::~AudioContext() since it will never be called as long as any AudioNode is alive
- // because AudioNodes keep a reference to the context.
- if (!context()->isInitialized())
- context()->deleteMarkedNodes();
-}
-#endif
-
void AudioNode::breakConnection()
{
// The actual work for deref happens completely within the audio context's
@@ -585,33 +528,10 @@ void AudioNode::breakConnection()
void AudioNode::breakConnectionWithLock()
{
atomicDecrement(&m_connectionRefCount);
-#if !ENABLE(OILPAN)
- ASSERT(m_normalRefCount > 0);
-#endif
if (!m_connectionRefCount)
disableOutputsIfNecessary();
}
-#if !ENABLE(OILPAN)
-void AudioNode::finishDeref()
-{
- ASSERT(context()->isGraphOwner());
-
- ASSERT(m_normalRefCount > 0);
- atomicDecrement(&m_normalRefCount);
-
-#if DEBUG_AUDIONODE_REFERENCES
- fprintf(stderr, "%p: %d: AudioNode::deref() %d %d\n", this, nodeType(), m_normalRefCount, m_connectionRefCount);
-#endif
-
- if (!m_normalRefCount) {
- // Mark for deletion at end of each render quantum or when context shuts
- // down.
- context()->markForDeletion(this);
- }
-}
-#endif
-
#if DEBUG_AUDIONODE_REFERENCES
bool AudioNode::s_isNodeCountInitialized = false;
« no previous file with comments | « Source/modules/webaudio/AudioNode.h ('k') | Source/modules/webaudio/AudioNode.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698