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

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

Issue 205173002: Move webaudio to oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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.h
diff --git a/Source/modules/webaudio/AudioNode.h b/Source/modules/webaudio/AudioNode.h
index 5ebe221ee62803656bb0fb4e6301e83faf4d0502..b7fc5b9a301dabffad797bf98428449db93fc578 100644
--- a/Source/modules/webaudio/AudioNode.h
+++ b/Source/modules/webaudio/AudioNode.h
@@ -50,7 +50,7 @@ class ExceptionState;
// 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, public EventTargetWithInlineData {
+class AudioNode : public GarbageCollectedFinalized<AudioNode>, public ScriptWrappable, public EventTargetWithInlineData {
Mads Ager (chromium) 2014/03/20 08:30:00 We don't want to move this into the oilpan heap wh
keishi 2014/03/27 07:39:37 Done.
public:
enum { ProcessingSizeInFrames = 128 };
@@ -179,6 +179,10 @@ public:
virtual const AtomicString& interfaceName() const OVERRIDE FINAL;
virtual ExecutionContext* executionContext() const OVERRIDE FINAL;
+ virtual void trace(Visitor*);
+
+ void clearKeepAlive();
+
protected:
// Inputs and outputs must be created before the AudioNode is initialized.
void addInput(PassOwnPtr<AudioNodeInput>);
@@ -195,11 +199,23 @@ protected:
private:
volatile bool m_isInitialized;
NodeType m_nodeType;
- RefPtr<AudioContext> m_context;
+ RefPtrWillBeMember<AudioContext> m_context;
float m_sampleRate;
Vector<OwnPtr<AudioNodeInput> > m_inputs;
Vector<OwnPtr<AudioNodeOutput> > m_outputs;
+ // AudioNodes are still reference counted but they are in the
+ // oilpan heap because the ScriptProcessorNode is an EventTarget.
+ // This self-persistent keeps the object from being deleted
+ // until the reference count reaches zero.
+ //
+ // It is safe to drop the self-persistent when the ref count
+ // of a ScriptProcessorNode reaches zero. At that point, the
+ // ScriptProcessor node is removed from the AudioContext and
+ // it cannot be reattached. Therefore, the reference count
+ // will not go above zero again.
+ OwnPtr<Persistent<AudioNode> > m_keepAlive;
Mads Ager (chromium) 2014/03/20 08:30:00 This should be guarded with #if ENABLE(OILPAN)
+
double m_lastProcessingTime;
double m_lastNonSilentTime;

Powered by Google App Engine
This is Rietveld 408576698