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