| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/webaudio/AudioWorkletProcessorDefinition.h" | 5 #include "modules/webaudio/AudioWorkletProcessorDefinition.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
| 9 #include "bindings/core/v8/V8BindingMacros.h" | 9 #include "bindings/core/v8/V8BindingMacros.h" |
| 10 #include "bindings/core/v8/V8ObjectConstructor.h" | 10 #include "bindings/core/v8/V8ObjectConstructor.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 AudioWorkletProcessorDefinition::~AudioWorkletProcessorDefinition() | 27 AudioWorkletProcessorDefinition::~AudioWorkletProcessorDefinition() |
| 28 { | 28 { |
| 29 } | 29 } |
| 30 | 30 |
| 31 void AudioWorkletProcessorDefinition::process() | 31 void AudioWorkletProcessorDefinition::process() |
| 32 { | 32 { |
| 33 // TODO: currently this happens in the main thread!!! | 33 // TODO: currently this happens in the main thread!!! |
| 34 | 34 |
| 35 // ScriptState::Scope scope(m_scriptState.get()); | |
| 36 | |
| 37 // maybeCreateProcessInstance(); | |
| 38 | |
| 39 // v8::Isolate* isolate = m_scriptState->isolate(); | |
| 40 | |
| 41 // We may have failed to create an instance class, in which case produce an | |
| 42 // invalid image. | |
| 43 // if (isUndefinedOrNull(instance)) | |
| 44 // return nullptr; | |
| 45 | |
| 46 // TODO: do some audio stuff. | |
| 47 // v8::Local<v8::Value> argv[] = { | |
| 48 // toV8(someAudioStuff, m_scriptState->context()->Global(), isolate), | |
| 49 // }; | |
| 50 | |
| 51 // v8::Local<v8::Function> process = m_process.newLocal(isolate); | |
| 52 | |
| 53 // v8::TryCatch block(isolate); | |
| 54 // block.SetVerbose(true); | |
| 55 | |
| 56 // V8ScriptRunner::callFunction(process, m_scriptState->getExecutionContext(
), instance, 2, argv, isolate); | |
| 57 | |
| 58 // The paint function may have produced an error, in which case produce an | |
| 59 // invalid image. | |
| 60 // if (block.HasCaught()) { | |
| 61 // return; | |
| 62 // } | |
| 63 | |
| 64 return; | 35 return; |
| 65 } | 36 } |
| 66 | 37 |
| 67 void AudioWorkletProcessorDefinition::maybeCreateProcessInstance() | 38 void AudioWorkletProcessorDefinition::maybeCreateProcessInstance() |
| 68 { | 39 { |
| 69 if (m_didCallConstructor) | 40 if (m_didCallConstructor) |
| 70 return; | 41 return; |
| 71 | 42 |
| 72 // DCHECK(m_instance.isEmpty()); | |
| 73 | |
| 74 // v8::Isolate* isolate = m_scriptState->isolate(); | |
| 75 // v8::Local<v8::Function> constructor = m_constructor.newLocal(isolate); | |
| 76 // DCHECK(!isUndefinedOrNull(constructor)); | |
| 77 | |
| 78 // v8::Local<v8::Object> processInstance; | |
| 79 // if (V8ObjectConstructor::newInstance(isolate, constructor).ToLocal(&proce
ssInstance)) { | |
| 80 // m_instance.set(isolate, processInstance); | |
| 81 // } | |
| 82 | |
| 83 m_didCallConstructor = true; | 43 m_didCallConstructor = true; |
| 84 } | 44 } |
| 85 | 45 |
| 86 } // namespace blink | 46 } // namespace blink |
| OLD | NEW |