| 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 #ifndef AudioWorkletProcessor_h |
| 6 #define AudioWorkletProcessor_h |
| 7 |
| 8 #include "bindings/core/v8/ScopedPersistent.h" |
| 9 #include "modules/ModulesExport.h" |
| 10 #include "platform/heap/Handle.h" |
| 11 #include "v8/include/v8.h" |
| 12 #include "wtf/text/WTFString.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 class AudioBuffer; |
| 17 class AudioWorkletGlobalScope; |
| 18 class AudioWorkletProcessorDefinition; |
| 19 |
| 20 // AudioWorkletProcessor class represents the active instance created from |
| 21 // AudioWorkletProcessorDefinition. |AudioWorkletNodeHandler| invokes |
| 22 // process() method in this object upon graph rendering. |
| 23 // |
| 24 // This is constructed and destroyed on a worker thread, and all methods also |
| 25 // must be called on the worker thread. |
| 26 class MODULES_EXPORT AudioWorkletProcessor |
| 27 : public GarbageCollectedFinalized<AudioWorkletProcessor> { |
| 28 public: |
| 29 static AudioWorkletProcessor* create(AudioWorkletGlobalScope*, |
| 30 const String& name); |
| 31 virtual ~AudioWorkletProcessor(); |
| 32 |
| 33 void setInstance(v8::Isolate*, v8::Local<v8::Object> instance); |
| 34 |
| 35 v8::Local<v8::Object> instanceLocal(v8::Isolate*); |
| 36 |
| 37 // |AudioWorkletHandler| invokes this method to process audio. |
| 38 void process(AudioBuffer* inputBuffer, AudioBuffer* outputBuffer); |
| 39 |
| 40 const String& name() const { return m_name; } |
| 41 |
| 42 DECLARE_TRACE(); |
| 43 |
| 44 private: |
| 45 AudioWorkletProcessor(AudioWorkletGlobalScope*, const String& name); |
| 46 |
| 47 Member<AudioWorkletGlobalScope> m_globalScope; |
| 48 const String m_name; |
| 49 ScopedPersistent<v8::Object> m_instance; |
| 50 }; |
| 51 |
| 52 } // namespace blink |
| 53 |
| 54 #endif // AudioWorkletProcessor_h |
| OLD | NEW |