| Index: third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessor.cpp
|
| diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessor.cpp b/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessor.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8019b773e867a7f86bf8f5dac05705259aa2fdcb
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessor.cpp
|
| @@ -0,0 +1,40 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "modules/webaudio/AudioWorkletProcessor.h"
|
| +
|
| +#include "modules/webaudio/AudioBuffer.h"
|
| +#include "modules/webaudio/AudioWorkletProcessorDefinition.h"
|
| +
|
| +namespace blink {
|
| +
|
| +// This static factory should be called implicitly when an instance of
|
| +// |AudioWorkletNode| gets created by user-supplied JS code in the main thread.
|
| +// This factory must not be called by user in |AudioWorkletGlobalScope|.
|
| +AudioWorkletProcessor* AudioWorkletProcessor::create(
|
| + AudioWorkletProcessorDefinition* definition) {
|
| + return new AudioWorkletProcessor(definition);
|
| +}
|
| +
|
| +AudioWorkletProcessor::AudioWorkletProcessor(
|
| + AudioWorkletProcessorDefinition* definition)
|
| + : m_definition(definition) {
|
| + m_definition->createInstance(m_instance);
|
| +}
|
| +
|
| +AudioWorkletProcessor::~AudioWorkletProcessor() {}
|
| +
|
| +bool AudioWorkletProcessor::process(AudioBuffer* inputBuffer,
|
| + AudioBuffer* outputBuffer) {
|
| + DCHECK(m_definition);
|
| + DCHECK(!m_instance.isEmpty());
|
| +
|
| + return m_definition->process(m_instance, inputBuffer, outputBuffer);
|
| +}
|
| +
|
| +DEFINE_TRACE(AudioWorkletProcessor) {
|
| + visitor->trace(m_definition);
|
| +}
|
| +
|
| +} // namespace blink
|
|
|