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 #include "wtf/text/WTFString.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 // Represents a JavaScript class definition registered in the | |
| 16 // AudioWorkletGlobalScope. After the registration, a definition class contains | |
| 17 // the V8 representation of class components (constructor, process callback, | |
| 18 // prototypes and parameter descriptors). | |
| 19 // | |
| 20 // This is constructed and destroyed on a worker thread, and all methods also | |
| 21 // must be called on the worker thread. | |
|
haraken
2017/03/10 13:43:22
Add DCHECK(!isMainThread()).
hongchan
2017/03/15 22:30:18
Done.
| |
| 22 class AudioWorkletProcessorDefinition final | |
| 23 : public GarbageCollectedFinalized<AudioWorkletProcessorDefinition> { | |
| 24 public: | |
| 25 static AudioWorkletProcessorDefinition* create( | |
| 26 v8::Isolate*, | |
| 27 const String& name, | |
| 28 v8::Local<v8::Function> constructor, | |
| 29 v8::Local<v8::Function> process); | |
| 30 | |
| 31 virtual ~AudioWorkletProcessorDefinition(); | |
| 32 | |
| 33 const String& name() const { return m_name; } | |
| 34 v8::Local<v8::Function> constructorLocal(v8::Isolate*); | |
| 35 v8::Local<v8::Function> processLocal(v8::Isolate*); | |
| 36 | |
| 37 DEFINE_INLINE_TRACE(){}; | |
| 38 | |
| 39 private: | |
| 40 AudioWorkletProcessorDefinition(v8::Isolate*, | |
| 41 const String& name, | |
| 42 v8::Local<v8::Function> constructor, | |
| 43 v8::Local<v8::Function> process); | |
| 44 | |
| 45 String m_name; | |
| 46 | |
| 47 // The definition is per global scope. The active instance of | |
| 48 // |AudioProcessorWorklet| should be passed into these to perform JS function. | |
| 49 ScopedPersistent<v8::Function> m_constructor; | |
| 50 ScopedPersistent<v8::Function> m_process; | |
| 51 | |
| 52 // TODO(hongchan): A container for AudioParamDescriptor objects. | |
| 53 // ScopedPersistent<v8::Array> m_parameterDescriptors; | |
| 54 }; | |
| 55 | |
| 56 } // namespace blink | |
| 57 | |
| 58 #endif // AudioWorkletProcessorDefinition_h | |
| OLD | NEW |