Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScope.h

Issue 2727733002: Implement AudioWorkletProcessor interface (Closed)
Patch Set: Added more unit test for parsing Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698