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

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

Issue 2727733002: Implement AudioWorkletProcessor interface (Closed)
Patch Set: Added AudioWorkletProcessor and AudioWorkletProcessorDefinition classes 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/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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698