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 AudioWorkletProcessor_h | 5 #ifndef AudioWorkletProcessor_h |
6 #define AudioWorkletProcessor_h | 6 #define AudioWorkletProcessor_h |
7 | 7 |
8 #include "modules/ModulesExport.h" | 8 #include "modules/ModulesExport.h" |
9 #include "platform/bindings/ScopedPersistent.h" | 9 #include "platform/bindings/ScopedPersistent.h" |
| 10 #include "platform/bindings/ScriptWrappable.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 |
| 15 #include "modules/webaudio/AudioParamDescriptor.h" |
| 16 |
14 namespace blink { | 17 namespace blink { |
15 | 18 |
16 class AudioBuffer; | 19 class AudioBuffer; |
17 class AudioWorkletGlobalScope; | 20 class AudioWorkletGlobalScope; |
18 class AudioWorkletProcessorDefinition; | 21 class AudioWorkletProcessorDefinition; |
19 | 22 |
20 // AudioWorkletProcessor class represents the active instance created from | 23 // AudioWorkletProcessor class represents the active instance created from |
21 // AudioWorkletProcessorDefinition. |AudioWorkletNodeHandler| invokes | 24 // AudioWorkletProcessorDefinition. |AudioWorkletNodeHandler| invokes |
22 // process() method in this object upon graph rendering. | 25 // process() method in this object upon graph rendering. |
23 // | 26 // |
24 // This is constructed and destroyed on a worker thread, and all methods also | 27 // This is constructed and destroyed on a worker thread, and all methods also |
25 // must be called on the worker thread. | 28 // must be called on the worker thread. |
26 class MODULES_EXPORT AudioWorkletProcessor | 29 class MODULES_EXPORT AudioWorkletProcessor |
27 : public GarbageCollectedFinalized<AudioWorkletProcessor> { | 30 : public GarbageCollectedFinalized<AudioWorkletProcessor>, |
| 31 public ScriptWrappable { |
| 32 DEFINE_WRAPPERTYPEINFO(); |
| 33 |
28 public: | 34 public: |
29 static AudioWorkletProcessor* Create(AudioWorkletGlobalScope*, | 35 static AudioWorkletProcessor* Create(AudioWorkletGlobalScope*, |
30 const String& name); | 36 AudioWorkletProcessorDefinition*); |
31 virtual ~AudioWorkletProcessor(); | 37 virtual ~AudioWorkletProcessor(); |
32 | 38 |
33 void SetInstance(v8::Isolate*, v8::Local<v8::Object> instance); | 39 void SetInstance(v8::Isolate*, v8::Local<v8::Object> instance); |
34 | 40 |
35 v8::Local<v8::Object> InstanceLocal(v8::Isolate*); | 41 v8::Local<v8::Object> InstanceLocal(v8::Isolate*); |
36 | 42 |
37 // |AudioWorkletHandler| invokes this method to process audio. | 43 // |AudioWorkletHandler| invokes this method to process audio. |
38 void Process(AudioBuffer* input_buffer, AudioBuffer* output_buffer); | 44 void Process(AudioBuffer* input_buffer, AudioBuffer* output_buffer); |
39 | 45 |
40 const String& GetName() const { return name_; } | 46 const String& GetName() const; |
| 47 // const HeapVector<AudioParamDescriptor>& GetAudioParamDescriptors() const; |
41 | 48 |
42 DECLARE_TRACE(); | 49 DECLARE_TRACE(); |
43 | 50 |
44 private: | 51 private: |
45 AudioWorkletProcessor(AudioWorkletGlobalScope*, const String& name); | 52 AudioWorkletProcessor(AudioWorkletGlobalScope*, |
| 53 AudioWorkletProcessorDefinition*); |
46 | 54 |
47 Member<AudioWorkletGlobalScope> global_scope_; | 55 Member<AudioWorkletGlobalScope> global_scope_; |
48 const String name_; | 56 Member<AudioWorkletProcessorDefinition> definition_; |
49 ScopedPersistent<v8::Object> instance_; | 57 ScopedPersistent<v8::Object> instance_; |
50 }; | 58 }; |
51 | 59 |
52 } // namespace blink | 60 } // namespace blink |
53 | 61 |
54 #endif // AudioWorkletProcessor_h | 62 #endif // AudioWorkletProcessor_h |
OLD | NEW |