Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScope.h |
| diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScope.h b/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScope.h |
| index 590a3a3300b7a5496d6a87b6782cb93b1cc04045..85338e1b1231be8fa3d73b2e7226c44905bb4b78 100644 |
| --- a/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScope.h |
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScope.h |
| @@ -5,11 +5,22 @@ |
| #ifndef AudioWorkletGlobalScope_h |
| #define AudioWorkletGlobalScope_h |
| +#include "bindings/core/v8/ScriptValue.h" |
| +#include "core/dom/ExecutionContext.h" |
| #include "core/workers/ThreadedWorkletGlobalScope.h" |
| +#include "modules/ModulesExport.h" |
| namespace blink { |
| -class AudioWorkletGlobalScope final : public ThreadedWorkletGlobalScope { |
| +class AudioBuffer; |
| +class AudioWorkletProcessor; |
| +class AudioWorkletProcessorDefinition; |
| +class ExceptionState; |
| + |
| +// This is constructed and destroyed on a worker thread, and all methods also |
| +// must be called on the worker thread. |
| +class MODULES_EXPORT AudioWorkletGlobalScope final |
| + : public ThreadedWorkletGlobalScope { |
| DEFINE_WRAPPERTYPEINFO(); |
| public: |
| @@ -19,6 +30,24 @@ class AudioWorkletGlobalScope final : public ThreadedWorkletGlobalScope { |
| v8::Isolate*, |
| WorkerThread*); |
| ~AudioWorkletGlobalScope() override; |
| + void dispose() final; |
| + bool isAudioWorkletGlobalScope() const final { return true; } |
| + void registerProcessor(const String& name, |
| + const ScriptValue& classDefinition, |
| + ExceptionState&); |
| + |
| + // Creates an instance of AudioWorkletProcessor from a registered name. This |
| + // function may return nullptr when 1) a definition cannot be found or 2) a |
| + // new V8 object cannot be constructed for some reason. |
| + AudioWorkletProcessor* createInstance(const String& name); |
| + |
| + bool process(AudioWorkletProcessor*, |
|
Raymond Toy
2017/03/17 16:45:32
Document this.
hongchan
2017/03/20 17:03:32
Done.
|
| + AudioBuffer* inputBuffer, |
| + AudioBuffer* outputBuffer); |
| + |
| + AudioWorkletProcessorDefinition* findDefinition(const String& name); |
| + |
| + DECLARE_TRACE(); |
| private: |
| AudioWorkletGlobalScope(const KURL&, |
| @@ -26,6 +55,13 @@ class AudioWorkletGlobalScope final : public ThreadedWorkletGlobalScope { |
| PassRefPtr<SecurityOrigin>, |
| v8::Isolate*, |
| WorkerThread*); |
| + |
| + typedef HeapHashMap<String, Member<AudioWorkletProcessorDefinition>> |
| + ProcessorDefinitionMap; |
| + typedef HeapVector<Member<AudioWorkletProcessor>> ProcessorInstances; |
| + |
| + ProcessorDefinitionMap m_processorDefinitionMap; |
| + ProcessorInstances m_processorInstances; |
| }; |
| } // namespace blink |