Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "modules/webaudio/AudioWorkletProcessor.h" | |
| 6 | |
| 7 #include "modules/webaudio/AudioBuffer.h" | |
| 8 #include "modules/webaudio/AudioWorkletGlobalScope.h" | |
| 9 #include "modules/webaudio/AudioWorkletProcessorDefinition.h" | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 AudioWorkletProcessor* AudioWorkletProcessor::create( | |
| 14 const String& name, | |
| 15 AudioWorkletGlobalScope* globalScope) { | |
| 16 AudioWorkletProcessorDefinition* definition = | |
| 17 globalScope->findDefinition(name); | |
| 18 | |
| 19 if (!definition) | |
| 20 return nullptr; | |
|
nhiroki
2017/03/06 10:08:44
It looks strange that create() returns a nullptr.
hongchan
2017/03/06 20:06:12
Ah, that's right. This method does not get called
| |
| 21 | |
| 22 return new AudioWorkletProcessor(definition); | |
| 23 } | |
| 24 | |
| 25 AudioWorkletProcessor::AudioWorkletProcessor( | |
| 26 AudioWorkletProcessorDefinition* definition) | |
| 27 : m_definition(definition) { | |
| 28 m_instance = m_definition->createInstance(); | |
| 29 } | |
| 30 | |
| 31 AudioWorkletProcessor::~AudioWorkletProcessor() {} | |
| 32 | |
| 33 bool AudioWorkletProcessor::process(AudioBuffer* inputBuffer, | |
| 34 AudioBuffer* outputBuffer) { | |
| 35 DCHECK(m_definition); | |
| 36 DCHECK(!m_instance.IsEmpty()); | |
| 37 | |
| 38 return m_definition->process(m_instance, inputBuffer, outputBuffer); | |
| 39 } | |
| 40 | |
| 41 DEFINE_TRACE(AudioWorkletProcessor) { | |
| 42 visitor->trace(m_definition); | |
| 43 } | |
| 44 | |
| 45 } // namespace blink | |
| OLD | NEW |