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

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

Issue 1960533003: [DO NOT SUBMIT] AudioWorklet FS1: importing scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessorDefinition.cpp b/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessorDefinition.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ceef16e0daca99e4afc8766e2fafcffc70755975
--- /dev/null
+++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessorDefinition.cpp
@@ -0,0 +1,86 @@
+// Copyright 2016 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.
+
+#include "modules/webaudio/AudioWorkletProcessorDefinition.h"
+
+#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/V8Binding.h"
+#include "bindings/core/v8/V8BindingMacros.h"
+#include "bindings/core/v8/V8ObjectConstructor.h"
+#include "core/dom/ExecutionContext.h"
+
+namespace blink {
+
+AudioWorkletProcessorDefinition* AudioWorkletProcessorDefinition::create(ScriptState* scriptState, v8::Local<v8::Function> constructor, v8::Local<v8::Function> process)
+{
+ return new AudioWorkletProcessorDefinition(scriptState, constructor, process);
+}
+
+AudioWorkletProcessorDefinition::AudioWorkletProcessorDefinition(ScriptState* scriptState, v8::Local<v8::Function> constructor, v8::Local<v8::Function> process)
+ : m_scriptState(scriptState)
+ , m_constructor(scriptState->isolate(), constructor)
+ , m_process(scriptState->isolate(), process)
+{
+}
+
+AudioWorkletProcessorDefinition::~AudioWorkletProcessorDefinition()
+{
+}
+
+void AudioWorkletProcessorDefinition::process()
+{
+ // TODO: currently this happens in the main thread!!!
+
+ // ScriptState::Scope scope(m_scriptState.get());
+
+ // maybeCreateProcessInstance();
+
+ // v8::Isolate* isolate = m_scriptState->isolate();
+
+ // We may have failed to create an instance class, in which case produce an
+ // invalid image.
+ // if (isUndefinedOrNull(instance))
+ // return nullptr;
+
+ // TODO: do some audio stuff.
+ // v8::Local<v8::Value> argv[] = {
+ // toV8(someAudioStuff, m_scriptState->context()->Global(), isolate),
+ // };
+
+ // v8::Local<v8::Function> process = m_process.newLocal(isolate);
+
+ // v8::TryCatch block(isolate);
+ // block.SetVerbose(true);
+
+ // V8ScriptRunner::callFunction(process, m_scriptState->getExecutionContext(), instance, 2, argv, isolate);
+
+ // The paint function may have produced an error, in which case produce an
+ // invalid image.
+ // if (block.HasCaught()) {
+ // return;
+ // }
+
+ return;
+}
+
+void AudioWorkletProcessorDefinition::maybeCreateProcessInstance()
+{
+ if (m_didCallConstructor)
+ return;
+
+ // DCHECK(m_instance.isEmpty());
+
+ // v8::Isolate* isolate = m_scriptState->isolate();
+ // v8::Local<v8::Function> constructor = m_constructor.newLocal(isolate);
+ // DCHECK(!isUndefinedOrNull(constructor));
+
+ // v8::Local<v8::Object> processInstance;
+ // if (V8ObjectConstructor::newInstance(isolate, constructor).ToLocal(&processInstance)) {
+ // m_instance.set(isolate, processInstance);
+ // }
+
+ m_didCallConstructor = true;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698