| 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 AudioWorkletProcessorDefinition_h |
| 6 #define AudioWorkletProcessorDefinition_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 // Represents a JavaScript class definition registered in the |
| 17 // AudioWorkletGlobalScope. After the registration, a definition class contains |
| 18 // the V8 representation of class components (constructor, process callback, |
| 19 // prototypes and parameter descriptors). |
| 20 // |
| 21 // This is constructed and destroyed on a worker thread, and all methods also |
| 22 // must be called on the worker thread. |
| 23 class MODULES_EXPORT AudioWorkletProcessorDefinition final |
| 24 : public GarbageCollectedFinalized<AudioWorkletProcessorDefinition> { |
| 25 public: |
| 26 static AudioWorkletProcessorDefinition* create( |
| 27 v8::Isolate*, |
| 28 const String& name, |
| 29 v8::Local<v8::Function> constructor, |
| 30 v8::Local<v8::Function> process); |
| 31 |
| 32 virtual ~AudioWorkletProcessorDefinition(); |
| 33 |
| 34 const String& name() const { return m_name; } |
| 35 v8::Local<v8::Function> constructorLocal(v8::Isolate*); |
| 36 v8::Local<v8::Function> processLocal(v8::Isolate*); |
| 37 |
| 38 DEFINE_INLINE_TRACE(){}; |
| 39 |
| 40 private: |
| 41 AudioWorkletProcessorDefinition(v8::Isolate*, |
| 42 const String& name, |
| 43 v8::Local<v8::Function> constructor, |
| 44 v8::Local<v8::Function> process); |
| 45 |
| 46 const String m_name; |
| 47 |
| 48 // The definition is per global scope. The active instance of |
| 49 // |AudioProcessorWorklet| should be passed into these to perform JS function. |
| 50 ScopedPersistent<v8::Function> m_constructor; |
| 51 ScopedPersistent<v8::Function> m_process; |
| 52 |
| 53 // TODO(hongchan): A container for AudioParamDescriptor objects. |
| 54 // ScopedPersistent<v8::Array> m_parameterDescriptors; |
| 55 }; |
| 56 |
| 57 } // namespace blink |
| 58 |
| 59 #endif // AudioWorkletProcessorDefinition_h |
| OLD | NEW |