Index: third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp |
diff --git a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp |
index 607f2e6c32ad832bcd59b703c02c60340ed66c7a..fef9aa6f89b6946b10852251acb2b72ecb9d6397 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp |
@@ -48,6 +48,7 @@ |
#include "modules/webaudio/AudioListener.h" |
#include "modules/webaudio/AudioNodeInput.h" |
#include "modules/webaudio/AudioNodeOutput.h" |
+#include "modules/webaudio/AudioWorkletMessagingProxy.h" |
#include "modules/webaudio/BiquadFilterNode.h" |
#include "modules/webaudio/ChannelMergerNode.h" |
#include "modules/webaudio/ChannelSplitterNode.h" |
@@ -152,10 +153,39 @@ void BaseAudioContext::Initialize() { |
if (IsDestinationInitialized()) |
return; |
+ // At this point, AudioWorklet should be initialized. Cache the reference to |
+ // it. |
+ worklet_messaging_proxy_ = static_cast<AudioWorkletMessagingProxy*>( |
+ GetAudioWorklet()->GetWorkletGlobalScopeProxy()); |
+ |
+ LOG(INFO) << "BaseAudioContext::Initialize AWMP_rendering_thread = " |
+ << worklet_messaging_proxy_->GetRenderingThread(); |
+ |
+ // ========================================================================= |
+ // WebThread* rendering_thread = |
+ // destination()->GetAudioDestinationHandler().GetRenderingThread(); |
+ |
+ // LOG(INFO) << "rendering_thread = " << rendering_thread; |
+ |
+ // // Reset the worklet thread. Not sure if this is okay. |
+ // AudioWorkletThread::SetSharedBackingThread(rendering_thread); |
+ |
+ // LOG(INFO) << "AudioWorkletThread = " |
+ // << WorkletThreadHolder<AudioWorkletThread>::GetInstance()->GetThread(); |
+ |
+ // worklet_messaging_proxy_ = |
+ // static_cast<AudioWorkletMessagingProxy*>( |
+ // audio_worklet_->GetWorkletGlobalScopeProxy()); |
+ // LOG(INFO) << "worklet_messaging_proxy_ = " << worklet_messaging_proxy_; |
+ |
+ // worklet_messaging_proxy_->RequestProcessorDefinitionMap(); |
+ // ========================================================================= |
+ |
FFTFrame::Initialize(); |
if (destination_node_) { |
destination_node_->Handler().Initialize(); |
+ |
// The AudioParams in the listener need access to the destination node, so |
// only create the listener if the destination node exists. |
listener_ = AudioListener::Create(*this); |
@@ -916,6 +946,7 @@ DEFINE_TRACE(BaseAudioContext) { |
visitor->Trace(periodic_wave_square_); |
visitor->Trace(periodic_wave_sawtooth_); |
visitor->Trace(periodic_wave_triangle_); |
+ |
EventTargetWithInlineData::Trace(visitor); |
SuspendableObject::Trace(visitor); |
} |
@@ -927,4 +958,17 @@ SecurityOrigin* BaseAudioContext::GetSecurityOrigin() const { |
return nullptr; |
} |
+AudioWorklet* BaseAudioContext::GetAudioWorklet() { |
+ return WindowAudioWorklet::audioWorklet( |
+ *(SuspendableObject::GetExecutionContext()->ExecutingWindow())); |
+} |
+ |
+AudioWorkletMessagingProxy* BaseAudioContext::GetWorkletMessagingProxy() { |
+ return worklet_messaging_proxy_; |
+} |
+ |
+WebThreadSupportingGC* BaseAudioContext::GetRenderingThread() { |
+ return worklet_messaging_proxy_->GetRenderingThread(); |
+} |
+ |
} // namespace blink |