| 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/AudioWorkletProcessorDefinition.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 // This static factory should be called implicitly when an instance of |
| 13 // |AudioWorkletNode| gets created by user-supplied JS code in the main thread. |
| 14 // This factory must not be called by user in |AudioWorkletGlobalScope|. |
| 15 AudioWorkletProcessor* AudioWorkletProcessor::create( |
| 16 AudioWorkletProcessorDefinition* definition) { |
| 17 return new AudioWorkletProcessor(definition); |
| 18 } |
| 19 |
| 20 AudioWorkletProcessor::AudioWorkletProcessor( |
| 21 AudioWorkletProcessorDefinition* definition) |
| 22 : m_definition(definition) { |
| 23 m_definition->createInstance(m_instance); |
| 24 } |
| 25 |
| 26 AudioWorkletProcessor::~AudioWorkletProcessor() {} |
| 27 |
| 28 bool AudioWorkletProcessor::process(AudioBuffer* inputBuffer, |
| 29 AudioBuffer* outputBuffer) { |
| 30 DCHECK(m_definition); |
| 31 DCHECK(!m_instance.isEmpty()); |
| 32 |
| 33 return m_definition->process(m_instance, inputBuffer, outputBuffer); |
| 34 } |
| 35 |
| 36 DEFINE_TRACE(AudioWorkletProcessor) { |
| 37 visitor->trace(m_definition); |
| 38 } |
| 39 |
| 40 } // namespace blink |
| OLD | NEW |