Changeset 151558 in webkit
- Timestamp:
- Jun 13, 2013 10:03:17 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r151555 r151558 1 2013-06-13 Praveen R Jadhav <praveen.j@samsung.com> 2 3 Avoid unwanted thread hops in ScriptProcessorNode when 'onaudioprocess' listener is not set. 4 https://bugs.webkit.org/show_bug.cgi?id=117578. 5 6 Reviewed by Darin Adler. 7 8 ScriptProcessorNode process operation continues to dispatch AudioProcessingEvent 9 even though 'onaudioprocess' listener is not set. This results in unwanted thread hops. 10 Code is optimized to dispatch AudioProcessingEvent only if the listener is set. 11 12 No new tests, already covered by existing tests. 13 14 * Modules/webaudio/ScriptProcessorNode.cpp: 15 (WebCore::ScriptProcessorNode::ScriptProcessorNode): 16 (WebCore::ScriptProcessorNode::process): 17 (WebCore::ScriptProcessorNode::setOnaudioprocess): 18 * Modules/webaudio/ScriptProcessorNode.h: 19 (WebCore::ScriptProcessorNode::onaudioprocess): 20 1 21 2013-06-13 Max Vujovic <mvujovic@adobe.com> 2 22 -
trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp
r150810 r151558 81 81 , m_numberOfOutputChannels(numberOfOutputChannels) 82 82 , m_internalInputBus(AudioBus::create(numberOfInputChannels, AudioNode::ProcessingSizeInFrames, false)) 83 , m_hasAudioProcessListener(false) 83 84 { 84 85 // Regardless of the allowed buffer sizes, we still need to process at the granularity of the AudioNode. … … 139 140 // This node is the producer for inputBuffer and the consumer for outputBuffer. 140 141 // The JavaScript code is the consumer of inputBuffer and the producer for outputBuffer. 141 142 143 // Check if audioprocess listener is set. 144 if (!m_hasAudioProcessListener) 145 return; 146 142 147 // Get input and output busses. 143 148 AudioBus* inputBus = this->input(0)->bus(); … … 215 220 } 216 221 222 void ScriptProcessorNode::setOnaudioprocess(PassRefPtr<EventListener> listener) 223 { 224 m_hasAudioProcessListener = listener; 225 setAttributeEventListener(eventNames().audioprocessEvent, listener); 226 } 227 217 228 void ScriptProcessorNode::fireProcessEventDispatch(void* userData) 218 229 { -
trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.h
r150810 r151558 66 66 size_t bufferSize() const { return m_bufferSize; } 67 67 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(audioprocess); 68 EventListener* onaudioprocess() { return getAttributeEventListener(eventNames().audioprocessEvent); } 69 void setOnaudioprocess(PassRefPtr<EventListener>); 69 70 70 71 private: … … 93 94 94 95 RefPtr<AudioBus> m_internalInputBus; 96 bool m_hasAudioProcessListener; 95 97 }; 96 98
Note: See TracChangeset
for help on using the changeset viewer.