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

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

Issue 14028011: Made AudioNode an EventTarget (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 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 e2c93c0683e820652cadc5497b0789b05f0d49a1..66c9566c495b3664093e767604295ef2426be46f 100644
--- a/Source/modules/webaudio/AudioNode.cpp
+++ b/Source/modules/webaudio/AudioNode.cpp
@@ -45,7 +45,8 @@
namespace WebCore {
AudioNode::AudioNode(AudioContext* context, float sampleRate)
- : m_isInitialized(false)
+ : ActiveDOMObject(context->scriptExecutionContext())
+ , m_isInitialized(false)
, m_nodeType(NodeTypeUnknown)
, m_context(context)
, m_sampleRate(sampleRate)
@@ -65,6 +66,11 @@ AudioNode::AudioNode(AudioContext* context, float sampleRate)
atexit(AudioNode::printNodeCounts);
}
#endif
+
+ // since we're just using the ActiveDOMObject instance for GC,
+ // we can suspendIfNeeded here. suspendIfNeeded needs to be called
+ // at some point on every ActiveDOMObject.
+ suspendIfNeeded();
}
AudioNode::~AudioNode()
@@ -282,10 +288,26 @@ void AudioNode::updateChannelsForInputs()
input(i)->changedOutputs();
}
+const AtomicString& AudioNode::interfaceName() const
+{
+ return eventNames().interfaceForAudioNode;
+}
+
+ScriptExecutionContext* AudioNode::scriptExecutionContext() const
+{
+ return const_cast<AudioNode*>(this)->context()->scriptExecutionContext();
+}
+
+
+bool AudioNode::hasPendingActivity() const
+{
+ return !m_isDisabled && (m_connectionRefCount > 0);
+}
+
void AudioNode::processIfNecessary(size_t framesToProcess)
{
ASSERT(context()->isAudioThread());
-
+
if (!isInitialized())
return;

Powered by Google App Engine
This is Rietveld 408576698