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

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: 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
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 enum ChannelCountMode { 87 enum ChannelCountMode {
88 Max, 88 Max,
89 ClampedMax, 89 ClampedMax,
90 Explicit 90 Explicit
91 }; 91 };
92 92
93 NodeType nodeType() const { return m_nodeType; } 93 NodeType nodeType() const { return m_nodeType; }
94 String nodeTypeName() const; 94 String nodeTypeName() const;
95 void setNodeType(NodeType); 95 void setNodeType(NodeType);
96 96
97 // We handle our own ref-counting because of the threading issues and subtle nature of 97 // Can be called from main thread or context's audio thread.
98 // how AudioNodes can continue processing (playing one-shot sound) after the re are no more 98 void ref();
99 // JavaScript references to the object. 99 void deref();
100 enum RefType { RefTypeNormal, RefTypeConnection };
101 100
102 // Can be called from main thread or context's audio thread. 101 void wasConnected();
Raymond Toy 2014/07/09 22:10:34 Add a comment on what wasConnected() does and when
tkent 2014/07/10 08:07:42 Will do
103 void ref(RefType refType = RefTypeNormal); 102 // This will be disconnected from an object. This might have remaining
104 void deref(RefType refType = RefTypeNormal); 103 // connections from others.
104 // This function should be called before releasing connection-type
Raymond Toy 2014/07/09 22:10:34 "should" or "must" be called?
tkent 2014/07/10 08:07:42 must. Will update.
105 // references.
106 void willBeDisconnected();
105 107
106 // Can be called from main thread or context's audio thread. It must be cal led while the context's graph lock is held. 108 // Can be called from main thread or context's audio thread. It must be cal led while the context's graph lock is held.
107 void finishDeref(RefType refType); 109 void finishDeref();
108 110
109 // The AudioNodeInput(s) (if any) will already have their input data availab le when process() is called. 111 // The AudioNodeInput(s) (if any) will already have their input data availab le when process() is called.
110 // Subclasses will take this input data and put the results in the AudioBus( s) of its AudioNodeOutput(s) (if any). 112 // Subclasses will take this input data and put the results in the AudioBus( s) of its AudioNodeOutput(s) (if any).
111 // Called from context's audio thread. 113 // Called from context's audio thread.
112 virtual void process(size_t framesToProcess) = 0; 114 virtual void process(size_t framesToProcess) = 0;
113 115
114 // No significant resources should be allocated until initialize() is called . 116 // No significant resources should be allocated until initialize() is called .
115 // Processing may not occur until a node is initialized. 117 // Processing may not occur until a node is initialized.
116 virtual void initialize(); 118 virtual void initialize();
117 virtual void uninitialize(); 119 virtual void uninitialize();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 GC_PLUGIN_IGNORE("http://crbug.com/353083") 221 GC_PLUGIN_IGNORE("http://crbug.com/353083")
220 OwnPtr<Persistent<AudioNode> > m_keepAlive; 222 OwnPtr<Persistent<AudioNode> > m_keepAlive;
221 #endif 223 #endif
222 224
223 double m_lastProcessingTime; 225 double m_lastProcessingTime;
224 double m_lastNonSilentTime; 226 double m_lastNonSilentTime;
225 227
226 // Ref-counting 228 // Ref-counting
227 volatile int m_normalRefCount; 229 volatile int m_normalRefCount;
228 volatile int m_connectionRefCount; 230 volatile int m_connectionRefCount;
231 bool m_wasDisconnected;
229 232
230 bool m_isMarkedForDeletion; 233 bool m_isMarkedForDeletion;
231 bool m_isDisabled; 234 bool m_isDisabled;
232 235
233 #if DEBUG_AUDIONODE_REFERENCES 236 #if DEBUG_AUDIONODE_REFERENCES
234 static bool s_isNodeCountInitialized; 237 static bool s_isNodeCountInitialized;
235 static int s_nodeCount[NodeTypeEnd]; 238 static int s_nodeCount[NodeTypeEnd];
236 #endif 239 #endif
237 240
238 #if !ENABLE(OILPAN) 241 #if !ENABLE(OILPAN)
239 virtual void refEventTarget() OVERRIDE FINAL { ref(); } 242 virtual void refEventTarget() OVERRIDE FINAL { ref(); }
240 virtual void derefEventTarget() OVERRIDE FINAL { deref(); } 243 virtual void derefEventTarget() OVERRIDE FINAL { deref(); }
241 #endif 244 #endif
242 245
243 protected: 246 protected:
244 unsigned m_channelCount; 247 unsigned m_channelCount;
245 ChannelCountMode m_channelCountMode; 248 ChannelCountMode m_channelCountMode;
246 AudioBus::ChannelInterpretation m_channelInterpretation; 249 AudioBus::ChannelInterpretation m_channelInterpretation;
247 }; 250 };
248 251
249 } // namespace WebCore 252 } // namespace WebCore
250 253
251 #endif // AudioNode_h 254 #endif // AudioNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698