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 "bindings/core/v8/Dictionary.h" |
8 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
| 10 #include "modules/webaudio/AudioParamDescriptor.h" |
9 #include "platform/bindings/ScopedPersistent.h" | 11 #include "platform/bindings/ScopedPersistent.h" |
10 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
11 #include "platform/wtf/text/WTFString.h" | 13 #include "platform/wtf/text/WTFString.h" |
12 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
13 | 15 |
14 namespace blink { | 16 namespace blink { |
15 | 17 |
16 // Represents a JavaScript class definition registered in the | 18 // Represents a JavaScript class definition registered in the |
17 // AudioWorkletGlobalScope. After the registration, a definition class contains | 19 // AudioWorkletGlobalScope. After the registration, a definition class contains |
18 // the V8 representation of class components (constructor, process callback, | 20 // the V8 representation of class components (constructor, process callback, |
19 // prototypes and parameter descriptors). | 21 // prototypes and parameter descriptors). |
20 // | 22 // |
21 // This is constructed and destroyed on a worker thread, and all methods also | 23 // This is constructed and destroyed on a worker thread, and all methods also |
22 // must be called on the worker thread. | 24 // must be called on the worker thread. |
23 class MODULES_EXPORT AudioWorkletProcessorDefinition final | 25 class MODULES_EXPORT AudioWorkletProcessorDefinition final |
24 : public GarbageCollectedFinalized<AudioWorkletProcessorDefinition> { | 26 : public GarbageCollectedFinalized<AudioWorkletProcessorDefinition> { |
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_; } |
| 37 |
35 v8::Local<v8::Function> ConstructorLocal(v8::Isolate*); | 38 v8::Local<v8::Function> ConstructorLocal(v8::Isolate*); |
36 v8::Local<v8::Function> ProcessLocal(v8::Isolate*); | 39 v8::Local<v8::Function> ProcessLocal(v8::Isolate*); |
37 | 40 |
38 DEFINE_INLINE_TRACE(){}; | 41 DECLARE_TRACE(); |
39 | 42 |
40 private: | 43 private: |
41 AudioWorkletProcessorDefinition(v8::Isolate*, | 44 AudioWorkletProcessorDefinition( |
42 const String& name, | 45 v8::Isolate*, |
43 v8::Local<v8::Function> constructor, | 46 const String& name, |
44 v8::Local<v8::Function> process); | 47 v8::Local<v8::Function> constructor, |
| 48 v8::Local<v8::Function> process); |
45 | 49 |
46 const String name_; | 50 const String name_; |
47 | 51 |
48 // The definition is per global scope. The active instance of | 52 // The definition is per global scope. The active instance of |
49 // |AudioProcessorWorklet| should be passed into these to perform JS function. | 53 // |AudioProcessorWorklet| should be passed into these to perform JS function. |
50 ScopedPersistent<v8::Function> constructor_; | 54 ScopedPersistent<v8::Function> constructor_; |
51 ScopedPersistent<v8::Function> process_; | 55 ScopedPersistent<v8::Function> process_; |
52 | 56 |
53 // TODO(hongchan): A container for AudioParamDescriptor objects. | 57 // A container for AudioParamDescriptor objects. |
54 // ScopedPersistent<v8::Array> m_parameterDescriptors; | 58 HeapVector<AudioParamDescriptor> audio_param_descriptors_; |
55 }; | 59 }; |
56 | 60 |
57 } // namespace blink | 61 } // namespace blink |
58 | 62 |
59 #endif // AudioWorkletProcessorDefinition_h | 63 #endif // AudioWorkletProcessorDefinition_h |
OLD | NEW |