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

Side by Side Diff: Source/modules/webaudio/AudioNode.h

Issue 349213007: WebAudio: Remove AudioNode::RefType. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix webaudio/delaynode-max-nondefault-delay.html Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/modules/webaudio/AudioContext.cpp ('k') | Source/modules/webaudio/AudioNode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 enum ChannelCountMode { 86 enum ChannelCountMode {
87 Max, 87 Max,
88 ClampedMax, 88 ClampedMax,
89 Explicit 89 Explicit
90 }; 90 };
91 91
92 NodeType nodeType() const { return m_nodeType; } 92 NodeType nodeType() const { return m_nodeType; }
93 String nodeTypeName() const; 93 String nodeTypeName() const;
94 void setNodeType(NodeType); 94 void setNodeType(NodeType);
95 95
96 // We handle our own ref-counting because of the threading issues and subtle nature of 96 // Can be called from main thread or context's audio thread.
97 // how AudioNodes can continue processing (playing one-shot sound) after the re are no more 97 void ref();
98 // JavaScript references to the object. 98 void deref();
99 enum RefType { RefTypeNormal, RefTypeConnection };
100 99
101 // Can be called from main thread or context's audio thread. 100 // This object has been connected to another object. This might have
102 void ref(RefType refType = RefTypeNormal); 101 // existing connections from others.
103 void deref(RefType refType = RefTypeNormal); 102 // This function must be called after acquiring a connection reference.
103 void makeConnection();
104 // This object will be disconnected from another object. This might have
105 // remaining connections from others.
106 // This function must be called before releasing a connection reference.
107 void breakConnection();
104 108
105 // Can be called from main thread or context's audio thread. It must be cal led while the context's graph lock is held. 109 // Can be called from main thread or context's audio thread. It must be cal led while the context's graph lock is held.
106 void finishDeref(RefType refType); 110 void finishDeref();
107 111
108 // The AudioNodeInput(s) (if any) will already have their input data availab le when process() is called. 112 // The AudioNodeInput(s) (if any) will already have their input data availab le when process() is called.
109 // Subclasses will take this input data and put the results in the AudioBus( s) of its AudioNodeOutput(s) (if any). 113 // Subclasses will take this input data and put the results in the AudioBus( s) of its AudioNodeOutput(s) (if any).
110 // Called from context's audio thread. 114 // Called from context's audio thread.
111 virtual void process(size_t framesToProcess) = 0; 115 virtual void process(size_t framesToProcess) = 0;
112 116
113 // No significant resources should be allocated until initialize() is called . 117 // No significant resources should be allocated until initialize() is called .
114 // Processing may not occur until a node is initialized. 118 // Processing may not occur until a node is initialized.
115 virtual void initialize(); 119 virtual void initialize();
116 virtual void uninitialize(); 120 virtual void uninitialize();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 GC_PLUGIN_IGNORE("http://crbug.com/353083") 222 GC_PLUGIN_IGNORE("http://crbug.com/353083")
219 OwnPtr<Persistent<AudioNode> > m_keepAlive; 223 OwnPtr<Persistent<AudioNode> > m_keepAlive;
220 #endif 224 #endif
221 225
222 double m_lastProcessingTime; 226 double m_lastProcessingTime;
223 double m_lastNonSilentTime; 227 double m_lastNonSilentTime;
224 228
225 // Ref-counting 229 // Ref-counting
226 volatile int m_normalRefCount; 230 volatile int m_normalRefCount;
227 volatile int m_connectionRefCount; 231 volatile int m_connectionRefCount;
232 bool m_wasDisconnected;
228 233
229 bool m_isMarkedForDeletion; 234 bool m_isMarkedForDeletion;
230 bool m_isDisabled; 235 bool m_isDisabled;
231 236
232 #if DEBUG_AUDIONODE_REFERENCES 237 #if DEBUG_AUDIONODE_REFERENCES
233 static bool s_isNodeCountInitialized; 238 static bool s_isNodeCountInitialized;
234 static int s_nodeCount[NodeTypeEnd]; 239 static int s_nodeCount[NodeTypeEnd];
235 #endif 240 #endif
236 241
237 #if !ENABLE(OILPAN) 242 #if !ENABLE(OILPAN)
238 virtual void refEventTarget() OVERRIDE FINAL { ref(); } 243 virtual void refEventTarget() OVERRIDE FINAL { ref(); }
239 virtual void derefEventTarget() OVERRIDE FINAL { deref(); } 244 virtual void derefEventTarget() OVERRIDE FINAL { deref(); }
240 #endif 245 #endif
241 246
242 protected: 247 protected:
243 unsigned m_channelCount; 248 unsigned m_channelCount;
244 ChannelCountMode m_channelCountMode; 249 ChannelCountMode m_channelCountMode;
245 AudioBus::ChannelInterpretation m_channelInterpretation; 250 AudioBus::ChannelInterpretation m_channelInterpretation;
246 }; 251 };
247 252
248 } // namespace WebCore 253 } // namespace WebCore
249 254
250 #endif // AudioNode_h 255 #endif // AudioNode_h
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioContext.cpp ('k') | Source/modules/webaudio/AudioNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698