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

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

Issue 2727733002: Implement AudioWorkletProcessor interface (Closed)
Patch Set: Addressing feedback from rtoy@ 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/AudioWorkletProcessor.h
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessor.h b/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessor.h
new file mode 100644
index 0000000000000000000000000000000000000000..4fca570a1ee4b0a178eacf360fac5ae4a23ae7ee
--- /dev/null
+++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessor.h
@@ -0,0 +1,54 @@
+// 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 AudioWorkletProcessor_h
+#define AudioWorkletProcessor_h
+
+#include "bindings/core/v8/ScopedPersistent.h"
+#include "modules/ModulesExport.h"
+#include "platform/heap/Handle.h"
+#include "v8/include/v8.h"
+#include "wtf/text/WTFString.h"
+
+namespace blink {
+
+class AudioBuffer;
+class AudioWorkletGlobalScope;
+class AudioWorkletProcessorDefinition;
+
+// AudioWorkletProcessor class represents the active instance created from
+// AudioWorkletProcessorDefinition. |AudioWorkletNodeHandler| invokes
+// process() method in this object upon graph rendering.
+//
+// This is constructed and destroyed on a worker thread, and all methods also
+// must be called on the worker thread.
+class MODULES_EXPORT AudioWorkletProcessor
+ : public GarbageCollectedFinalized<AudioWorkletProcessor> {
+ public:
+ static AudioWorkletProcessor* create(AudioWorkletGlobalScope*,
+ const String& name);
+ virtual ~AudioWorkletProcessor();
+
+ void setInstance(v8::Isolate*, v8::Local<v8::Object> instance);
+
+ v8::Local<v8::Object> instanceLocal(v8::Isolate*);
+
+ // |AudioWorkletHandler| invokes this method to process audio.
+ void process(AudioBuffer* inputBuffer, AudioBuffer* outputBuffer);
+
+ const String& name() const { return m_name; }
+
+ DECLARE_TRACE();
+
+ private:
+ AudioWorkletProcessor(AudioWorkletGlobalScope*, const String& name);
+
+ Member<AudioWorkletGlobalScope> m_globalScope;
+ const String m_name;
+ ScopedPersistent<v8::Object> m_instance;
+};
+
+} // namespace blink
+
+#endif // AudioWorkletProcessor_h

Powered by Google App Engine
This is Rietveld 408576698