| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef AudioWorkletProcessorDefinition_h | 5 #ifndef AudioWorkletProcessorDefinition_h |
| 6 #define AudioWorkletProcessorDefinition_h | 6 #define AudioWorkletProcessorDefinition_h |
| 7 | 7 |
| 8 #include "modules/ModulesExport.h" | 8 #include "modules/ModulesExport.h" |
| 9 #include "platform/bindings/ScopedPersistent.h" | 9 #include "platform/bindings/ScriptWrappable.h" |
| 10 #include "platform/bindings/TraceWrapperV8Reference.h" |
| 10 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 11 #include "platform/wtf/text/WTFString.h" | 12 #include "platform/wtf/text/WTFString.h" |
| 12 #include "v8/include/v8.h" | 13 #include "v8/include/v8.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 // Represents a JavaScript class definition registered in the | 17 // Represents a JavaScript class definition registered in the |
| 17 // AudioWorkletGlobalScope. After the registration, a definition class contains | 18 // AudioWorkletGlobalScope. After the registration, a definition class contains |
| 18 // the V8 representation of class components (constructor, process callback, | 19 // the V8 representation of class components (constructor, process callback, |
| 19 // prototypes and parameter descriptors). | 20 // prototypes and parameter descriptors). |
| 20 // | 21 // |
| 21 // This is constructed and destroyed on a worker thread, and all methods also | 22 // This is constructed and destroyed on a worker thread, and all methods also |
| 22 // must be called on the worker thread. | 23 // must be called on the worker thread. |
| 23 class MODULES_EXPORT AudioWorkletProcessorDefinition final | 24 class MODULES_EXPORT AudioWorkletProcessorDefinition final |
| 24 : public GarbageCollectedFinalized<AudioWorkletProcessorDefinition> { | 25 : public GarbageCollectedFinalized<AudioWorkletProcessorDefinition>, |
| 26 public TraceWrapperBase { |
| 25 public: | 27 public: |
| 26 static AudioWorkletProcessorDefinition* Create( | 28 static AudioWorkletProcessorDefinition* Create( |
| 27 v8::Isolate*, | 29 v8::Isolate*, |
| 28 const String& name, | 30 const String& name, |
| 29 v8::Local<v8::Function> constructor, | 31 v8::Local<v8::Function> constructor, |
| 30 v8::Local<v8::Function> process); | 32 v8::Local<v8::Function> process); |
| 31 | 33 |
| 32 virtual ~AudioWorkletProcessorDefinition(); | 34 virtual ~AudioWorkletProcessorDefinition(); |
| 33 | 35 |
| 34 const String& GetName() const { return name_; } | 36 const String& GetName() const { return name_; } |
| 35 v8::Local<v8::Function> ConstructorLocal(v8::Isolate*); | 37 v8::Local<v8::Function> ConstructorLocal(v8::Isolate*); |
| 36 v8::Local<v8::Function> ProcessLocal(v8::Isolate*); | 38 v8::Local<v8::Function> ProcessLocal(v8::Isolate*); |
| 37 | 39 |
| 38 DEFINE_INLINE_TRACE(){}; | 40 DEFINE_INLINE_TRACE(){}; |
| 41 DECLARE_TRACE_WRAPPERS(); |
| 39 | 42 |
| 40 private: | 43 private: |
| 41 AudioWorkletProcessorDefinition(v8::Isolate*, | 44 AudioWorkletProcessorDefinition(v8::Isolate*, |
| 42 const String& name, | 45 const String& name, |
| 43 v8::Local<v8::Function> constructor, | 46 v8::Local<v8::Function> constructor, |
| 44 v8::Local<v8::Function> process); | 47 v8::Local<v8::Function> process); |
| 45 | 48 |
| 46 const String name_; | 49 const String name_; |
| 47 | 50 |
| 48 // The definition is per global scope. The active instance of | 51 // The definition is per global scope. The active instance of |
| 49 // |AudioProcessorWorklet| should be passed into these to perform JS function. | 52 // |AudioProcessorWorklet| should be passed into these to perform JS function. |
| 50 ScopedPersistent<v8::Function> constructor_; | 53 TraceWrapperV8Reference<v8::Function> constructor_; |
| 51 ScopedPersistent<v8::Function> process_; | 54 TraceWrapperV8Reference<v8::Function> process_; |
| 52 | 55 |
| 53 // TODO(hongchan): A container for AudioParamDescriptor objects. | 56 // TODO(hongchan): A container for AudioParamDescriptor objects. |
| 54 // ScopedPersistent<v8::Array> m_parameterDescriptors; | 57 // ScopedPersistent<v8::Array> m_parameterDescriptors; |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 } // namespace blink | 60 } // namespace blink |
| 58 | 61 |
| 59 #endif // AudioWorkletProcessorDefinition_h | 62 #endif // AudioWorkletProcessorDefinition_h |
| OLD | NEW |