Index: third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScope.cpp |
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScope.cpp b/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScope.cpp |
index f97e28ee7d778971317e419fe0e755225e1a3c2a..dc3bd5328cf10af77197534cb6d0d5515ec34ed2 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScope.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScope.cpp |
@@ -4,11 +4,16 @@ |
#include "modules/webaudio/AudioWorkletGlobalScope.h" |
+#include "bindings/core/v8/Dictionary.h" |
+#include "bindings/core/v8/IDLTypes.h" |
+#include "bindings/core/v8/NativeValueTraitsImpl.h" |
#include "bindings/core/v8/ToV8ForCore.h" |
#include "bindings/core/v8/V8BindingForCore.h" |
#include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
+#include "bindings/modules/v8/V8AudioParamDescriptor.h" |
#include "core/dom/ExceptionCode.h" |
#include "modules/webaudio/AudioBuffer.h" |
+#include "modules/webaudio/AudioParamDescriptor.h" |
#include "modules/webaudio/AudioWorkletProcessor.h" |
#include "modules/webaudio/AudioWorkletProcessorDefinition.h" |
#include "platform/bindings/V8BindingMacros.h" |
@@ -24,6 +29,8 @@ AudioWorkletGlobalScope* AudioWorkletGlobalScope::Create( |
v8::Isolate* isolate, |
WorkerThread* thread, |
WorkerClients* worker_clients) { |
+ LOG(INFO) << "AudioWorkletGlobalScope::RegisterProcessor thread = " |
+ << thread; |
return new AudioWorkletGlobalScope(url, user_agent, |
std::move(security_origin), isolate, |
thread, worker_clients); |
@@ -73,9 +80,9 @@ void AudioWorkletGlobalScope::registerProcessor( |
} |
v8::Isolate* isolate = ScriptController()->GetScriptState()->GetIsolate(); |
- v8::Local<v8::Context> context = |
- ScriptController()->GetScriptState()->GetContext(); |
+ v8::Local<v8::Context> context = ScriptController()->GetContext(); |
+ // Get a handle for the class definition (i.e. constructor) |
if (!class_definition.V8Value()->IsFunction()) { |
exception_state.ThrowTypeError( |
"The processor definition is neither 'class' nor 'function'."); |
@@ -83,8 +90,9 @@ void AudioWorkletGlobalScope::registerProcessor( |
} |
v8::Local<v8::Function> class_definition_local = |
- class_definition.V8Value().As<v8::Function>(); |
+ v8::Local<v8::Function>::Cast(class_definition.V8Value()); |
+ // Get a handle for |prototype| object out of class definition. |
v8::Local<v8::Value> prototype_value_local; |
bool prototype_extracted = |
class_definition_local->Get(context, V8String(isolate, "prototype")) |
@@ -94,6 +102,7 @@ void AudioWorkletGlobalScope::registerProcessor( |
v8::Local<v8::Object> prototype_object_local = |
prototype_value_local.As<v8::Object>(); |
+ // Extract |process| function. |
v8::Local<v8::Value> process_value_local; |
bool process_extracted = |
prototype_object_local->Get(context, V8String(isolate, "process")) |
@@ -137,11 +146,12 @@ AudioWorkletProcessor* AudioWorkletGlobalScope::CreateInstance( |
v8::Local<v8::Object> instance_local; |
if (!V8ObjectConstructor::NewInstance(isolate, |
definition->ConstructorLocal(isolate)) |
- .ToLocal(&instance_local)) { |
+ .ToLocal(&instance_local)) { |
return nullptr; |
} |
- AudioWorkletProcessor* processor = AudioWorkletProcessor::Create(this, name); |
+ AudioWorkletProcessor* processor = |
+ AudioWorkletProcessor::Create(this, definition); |
DCHECK(processor); |
processor->SetInstance(isolate, instance_local); |
@@ -157,9 +167,10 @@ bool AudioWorkletGlobalScope::Process(AudioWorkletProcessor* processor, |
CHECK(output_buffer); |
ScriptState* script_state = ScriptController()->GetScriptState(); |
+ v8::Isolate* isolate = script_state->GetIsolate(); |
+ |
ScriptState::Scope scope(script_state); |
- v8::Isolate* isolate = script_state->GetIsolate(); |
AudioWorkletProcessorDefinition* definition = |
FindDefinition(processor->GetName()); |
DCHECK(definition); |