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 efe3c589c8f73f26971c569ba8367c0b41677a90..61b57ea5f71135d9a8db0811d5d7a74cf255d7f6 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp |
@@ -49,6 +49,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" |
@@ -160,10 +161,38 @@ void BaseAudioContext::Initialize() { |
if (IsDestinationInitialized()) |
return; |
+ // At this point, AudioWorklet should be initialized. Cache the reference to |
+ // it. |
+ worklet_messaging_proxy_ = GetAudioWorklet()->GetWorkletMessagingProxy(); |
+ |
+ 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); |
@@ -996,6 +1025,9 @@ DEFINE_TRACE(BaseAudioContext) { |
visitor->Trace(periodic_wave_square_); |
visitor->Trace(periodic_wave_sawtooth_); |
visitor->Trace(periodic_wave_triangle_); |
+ |
+ visitor->Trace(worklet_messaging_proxy_); |
+ |
EventTargetWithInlineData::Trace(visitor); |
SuspendableObject::Trace(visitor); |
} |
@@ -1018,4 +1050,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 |