| 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/AudioWorkletGlobalScope.h" |
| 8 |
| 9 namespace blink { |
| 10 |
| 11 // This static factory should be called implicitly when an instance of |
| 12 // |AudioWorkletNode| gets created by user-supplied JS code in the main thread. |
| 13 // This factory must not be called by user in |AudioWorkletGlobalScope|. |
| 14 AudioWorkletProcessor* AudioWorkletProcessor::create( |
| 15 AudioWorkletGlobalScope* globalScope, |
| 16 const String& name) { |
| 17 return new AudioWorkletProcessor(globalScope, name); |
| 18 } |
| 19 |
| 20 AudioWorkletProcessor::AudioWorkletProcessor( |
| 21 AudioWorkletGlobalScope* globalScope, |
| 22 const String& name) |
| 23 : m_globalScope(globalScope), m_name(name) {} |
| 24 |
| 25 AudioWorkletProcessor::~AudioWorkletProcessor() {} |
| 26 |
| 27 void AudioWorkletProcessor::setInstance(v8::Isolate* isolate, |
| 28 v8::Local<v8::Object> instance) { |
| 29 m_instance.set(isolate, instance); |
| 30 } |
| 31 |
| 32 v8::Local<v8::Object> AudioWorkletProcessor::instanceLocal( |
| 33 v8::Isolate* isolate) { |
| 34 return m_instance.newLocal(isolate); |
| 35 } |
| 36 |
| 37 void AudioWorkletProcessor::process(AudioBuffer* inputBuffer, |
| 38 AudioBuffer* outputBuffer) { |
| 39 m_globalScope->process(this, inputBuffer, outputBuffer); |
| 40 } |
| 41 |
| 42 DEFINE_TRACE(AudioWorkletProcessor) { |
| 43 visitor->trace(m_globalScope); |
| 44 } |
| 45 |
| 46 } // namespace blink |
| OLD | NEW |