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

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

Issue 14028011: Made AudioNode an EventTarget (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: upate to latest Created 7 years, 7 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/core/dom/EventTargetFactory.in ('k') | Source/modules/webaudio/AudioNode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/AudioNode.h
diff --git a/Source/modules/webaudio/AudioNode.h b/Source/modules/webaudio/AudioNode.h
index 0c85a042df9012ce79c47c378bc589e857a55d38..9be358d9b3d5029dce401c736b180d9f1f4853f5 100644
--- a/Source/modules/webaudio/AudioNode.h
+++ b/Source/modules/webaudio/AudioNode.h
@@ -26,6 +26,7 @@
#define AudioNode_h
#include "bindings/v8/ScriptWrappable.h"
+#include "core/dom/EventTarget.h"
#include "core/platform/audio/AudioBus.h"
#include "wtf/Forward.h"
#include "wtf/OwnPtr.h"
@@ -50,7 +51,7 @@ typedef int ExceptionCode;
// An AudioDestinationNode has one input and no outputs and represents the final destination to the audio hardware.
// Most processing nodes such as filters will have one input and one output, although multiple inputs and outputs are possible.
-class AudioNode : public ScriptWrappable {
+class AudioNode : public ScriptWrappable, public EventTarget {
public:
enum { ProcessingSizeInFrames = 128 };
@@ -153,7 +154,7 @@ public:
// tailTime() is the length of time (not counting latency time) where non-zero output may occur after continuous silent input.
virtual double tailTime() const = 0;
// latencyTime() is the length of time it takes for non-zero output to appear after non-zero input is provided. This only applies to
- // processing delay which is an artifact of the processing algorithm chosen and is *not* part of the intrinsic desired effect. For
+ // processing delay which is an artifact of the processing algorithm chosen and is *not* part of the intrinsic desired effect. For
// example, a "delay" effect is expected to delay the signal, and thus would not be considered latency.
virtual double latencyTime() const = 0;
@@ -181,11 +182,17 @@ public:
ChannelCountMode internalChannelCountMode() const { return m_channelCountMode; }
AudioBus::ChannelInterpretation internalChannelInterpretation() const { return m_channelInterpretation; }
+ // EventTarget
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+ virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
+ virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetData; }
+ virtual EventTargetData* ensureEventTargetData() OVERRIDE { return &m_eventTargetData; }
+
protected:
// Inputs and outputs must be created before the AudioNode is initialized.
void addInput(PassOwnPtr<AudioNodeInput>);
void addOutput(PassOwnPtr<AudioNodeOutput>);
-
+
// Called by processIfNecessary() to cause all parts of the rendering graph connected to us to process.
// Each rendering quantum, the audio data for each of the AudioNode's inputs will be available after this method is called.
// Called from context's audio thread.
@@ -202,13 +209,15 @@ private:
Vector<OwnPtr<AudioNodeInput> > m_inputs;
Vector<OwnPtr<AudioNodeOutput> > m_outputs;
+ EventTargetData m_eventTargetData;
+
double m_lastProcessingTime;
double m_lastNonSilentTime;
// Ref-counting
volatile int m_normalRefCount;
volatile int m_connectionRefCount;
-
+
bool m_isMarkedForDeletion;
bool m_isDisabled;
@@ -217,6 +226,9 @@ private:
static int s_nodeCount[NodeTypeEnd];
#endif
+ virtual void refEventTarget() OVERRIDE { ref(); }
+ virtual void derefEventTarget() OVERRIDE { deref(); }
+
protected:
unsigned m_channelCount;
ChannelCountMode m_channelCountMode;
« no previous file with comments | « Source/core/dom/EventTargetFactory.in ('k') | Source/modules/webaudio/AudioNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698