Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef AudioWorkletProcessor_h | |
| 6 #define AudioWorkletProcessor_h | |
| 7 | |
| 8 #include "bindings/core/v8/ScopedPersistent.h" | |
| 9 #include "platform/heap/Handle.h" | |
| 10 #include "v8/include/v8.h" | |
| 11 #include "wtf/text/WTFString.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 class AudioBuffer; | |
| 16 class AudioWorkletGlobalScope; | |
| 17 class AudioWorkletProcessorDefinition; | |
| 18 | |
| 19 // AudioWorkletProcessor class represents the active instance created from | |
| 20 // AudioWorkletProcessorDefinition. |AudioWorkletNodeHandler| invokes | |
| 21 // process() method in this object upon graph rendering. | |
| 22 // | |
| 23 // This is constructed and destroyed on a worker thread, and all methods also | |
| 24 // must be called on the worker thread. | |
|
haraken
2017/03/10 13:43:22
Can you add DCHECK(!isMainThread) for documentatio
hongchan
2017/03/15 22:30:18
Done.
| |
| 25 class AudioWorkletProcessor | |
| 26 : public GarbageCollectedFinalized<AudioWorkletProcessor> { | |
| 27 public: | |
| 28 static AudioWorkletProcessor* create(AudioWorkletGlobalScope*, | |
| 29 const String& name); | |
| 30 virtual ~AudioWorkletProcessor(); | |
| 31 | |
| 32 void setInstance(v8::Isolate*, v8::Local<v8::Object> instance); | |
| 33 | |
| 34 v8::Local<v8::Object> instanceLocal(v8::Isolate*); | |
| 35 | |
| 36 // |AudioWorkletHandler| invokes this method to process audio. | |
| 37 void process(AudioBuffer* inputBuffer, AudioBuffer* outputBuffer); | |
| 38 | |
| 39 const String& name() const { return m_name; } | |
| 40 | |
| 41 DECLARE_TRACE(); | |
| 42 | |
| 43 private: | |
| 44 explicit AudioWorkletProcessor(AudioWorkletGlobalScope*, const String& name); | |
|
nhiroki
2017/03/10 15:30:13
Can you remove 'explicit'?
hongchan
2017/03/15 22:30:18
Done.
| |
| 45 | |
| 46 Member<AudioWorkletGlobalScope> m_globalScope; | |
| 47 String m_name; | |
| 48 ScopedPersistent<v8::Object> m_instance; | |
| 49 }; | |
| 50 | |
| 51 } // namespace blink | |
| 52 | |
| 53 #endif // AudioWorkletProcessor_h | |
| OLD | NEW |