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 AudioWorkletProcessorDefinition_h | |
| 6 #define AudioWorkletProcessorDefinition_h | |
| 7 | |
| 8 #include "bindings/core/v8/ScopedPersistent.h" | |
| 9 #include "platform/heap/Handle.h" | |
| 10 #include "v8/include/v8.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class AudioBuffer; | |
| 15 class ScriptState; | |
| 16 | |
| 17 // Represents a JavaScript class definition registered in the | |
| 18 // AudioWorkletGlobalScope. After the registration, a definition class contains | |
|
nhiroki
2017/03/06 10:08:44
Can you explain the thread that this class lives o
hongchan
2017/03/06 20:06:12
Done.
| |
| 19 // the V8 representation of class components (constructor, process callback, | |
| 20 // prototypes and parameter descriptors). | |
| 21 class AudioWorkletProcessorDefinition final | |
| 22 : public GarbageCollectedFinalized<AudioWorkletProcessorDefinition> { | |
| 23 public: | |
| 24 static AudioWorkletProcessorDefinition* create( | |
| 25 ScriptState*, | |
| 26 v8::Local<v8::Function> constructor, | |
| 27 v8::Local<v8::Function> process); | |
| 28 | |
| 29 virtual ~AudioWorkletProcessorDefinition(); | |
| 30 | |
| 31 // Create a V8 object instance of AudioWorkletProcessor from the definition. | |
| 32 v8::Local<v8::Object> createInstance(); | |
| 33 | |
| 34 // Perform process() call with a instance. | |
|
haraken
2017/03/06 11:51:12
an instance
hongchan
2017/03/06 20:06:12
Done.
| |
| 35 bool process(v8::Local<v8::Object> instance, | |
| 36 AudioBuffer* inputBuffer, | |
| 37 AudioBuffer* outputBuffer); | |
| 38 | |
| 39 ScriptState* getScriptState() const { return m_scriptState.get(); } | |
| 40 | |
| 41 DEFINE_INLINE_TRACE(){}; | |
| 42 | |
| 43 private: | |
| 44 AudioWorkletProcessorDefinition(ScriptState*, | |
| 45 v8::Local<v8::Function> constructor, | |
| 46 v8::Local<v8::Function> process); | |
| 47 | |
| 48 RefPtr<ScriptState> m_scriptState; | |
|
haraken
2017/03/06 11:51:12
I'd like to remove this ScriptState since it shoul
hongchan
2017/03/06 20:06:12
ikilpatrick@ responded to this - I think the defin
haraken
2017/03/06 20:49:44
So my proposal is to move process() and createInst
| |
| 49 | |
| 50 // The definition is per global scope. The active instance of | |
| 51 // AudioProcessorWorklet should be passed into these to perform JS function. | |
| 52 ScopedPersistent<v8::Function> m_constructor; | |
| 53 ScopedPersistent<v8::Function> m_process; | |
| 54 | |
| 55 // TODO: | |
| 56 // ScopedPersistent<v8::Array> m_parameterDescriptors; | |
| 57 }; | |
| 58 | |
| 59 } // namespace blink | |
| 60 | |
| 61 #endif // AudioWorkletProcessorDefinition_h | |
| OLD | NEW |