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

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

Issue 2727733002: Implement AudioWorkletProcessor interface (Closed)
Patch Set: Added AudioWorkletProcessor and AudioWorkletProcessorDefinition classes Created 3 years, 10 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/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..ad1b9672dc9e44080c0cd488497d12fa2f84c23c
--- /dev/null
+++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessorDefinition.h
@@ -0,0 +1,61 @@
+// 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"
+
+namespace blink {
+
+class AudioBuffer;
+class ScriptState;
+
+// Represents a JavaScript class definition registered in the
+// 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.
+// the V8 representation of class components (constructor, process callback,
+// prototypes and parameter descriptors).
+class AudioWorkletProcessorDefinition final
+ : public GarbageCollectedFinalized<AudioWorkletProcessorDefinition> {
+ public:
+ static AudioWorkletProcessorDefinition* create(
+ ScriptState*,
+ v8::Local<v8::Function> constructor,
+ v8::Local<v8::Function> process);
+
+ virtual ~AudioWorkletProcessorDefinition();
+
+ // Create a V8 object instance of AudioWorkletProcessor from the definition.
+ v8::Local<v8::Object> createInstance();
+
+ // Perform process() call with a instance.
haraken 2017/03/06 11:51:12 an instance
hongchan 2017/03/06 20:06:12 Done.
+ bool process(v8::Local<v8::Object> instance,
+ AudioBuffer* inputBuffer,
+ AudioBuffer* outputBuffer);
+
+ ScriptState* getScriptState() const { return m_scriptState.get(); }
+
+ DEFINE_INLINE_TRACE(){};
+
+ private:
+ AudioWorkletProcessorDefinition(ScriptState*,
+ v8::Local<v8::Function> constructor,
+ v8::Local<v8::Function> process);
+
+ 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
+
+ // 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:
+ // ScopedPersistent<v8::Array> m_parameterDescriptors;
+};
+
+} // namespace blink
+
+#endif // AudioWorkletProcessorDefinition_h

Powered by Google App Engine
This is Rietveld 408576698