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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessor.cpp

Issue 2727733002: Implement AudioWorkletProcessor interface (Closed)
Patch Set: Addressing feedback Created 3 years, 9 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
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698