Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessorDefinition.h |
| diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessorDefinition.h b/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessorDefinition.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2550d41d88aaceb8226e6a0cc21af7fa1727a04f |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessorDefinition.h |
| @@ -0,0 +1,58 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef AudioWorkletProcessorDefinition_h |
| +#define AudioWorkletProcessorDefinition_h |
| + |
| +#include "bindings/core/v8/ScopedPersistent.h" |
| +#include "platform/heap/Handle.h" |
| +#include "v8/include/v8.h" |
| +#include "wtf/text/WTFString.h" |
| + |
| +namespace blink { |
| + |
| +// Represents a JavaScript class definition registered in the |
| +// AudioWorkletGlobalScope. After the registration, a definition class contains |
| +// the V8 representation of class components (constructor, process callback, |
| +// prototypes and parameter descriptors). |
| +// |
| +// This is constructed and destroyed on a worker thread, and all methods also |
| +// 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.
|
| +class AudioWorkletProcessorDefinition final |
| + : public GarbageCollectedFinalized<AudioWorkletProcessorDefinition> { |
| + public: |
| + static AudioWorkletProcessorDefinition* create( |
| + v8::Isolate*, |
| + const String& name, |
| + v8::Local<v8::Function> constructor, |
| + v8::Local<v8::Function> process); |
| + |
| + virtual ~AudioWorkletProcessorDefinition(); |
| + |
| + const String& name() const { return m_name; } |
| + v8::Local<v8::Function> constructorLocal(v8::Isolate*); |
| + v8::Local<v8::Function> processLocal(v8::Isolate*); |
| + |
| + DEFINE_INLINE_TRACE(){}; |
| + |
| + private: |
| + AudioWorkletProcessorDefinition(v8::Isolate*, |
| + const String& name, |
| + v8::Local<v8::Function> constructor, |
| + v8::Local<v8::Function> process); |
| + |
| + String m_name; |
| + |
| + // The definition is per global scope. The active instance of |
| + // |AudioProcessorWorklet| should be passed into these to perform JS function. |
| + ScopedPersistent<v8::Function> m_constructor; |
| + ScopedPersistent<v8::Function> m_process; |
| + |
| + // TODO(hongchan): A container for AudioParamDescriptor objects. |
| + // ScopedPersistent<v8::Array> m_parameterDescriptors; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // AudioWorkletProcessorDefinition_h |