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