Index: third_party/WebKit/Source/modules/webaudio/AudioWorklet.cpp |
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorklet.cpp b/third_party/WebKit/Source/modules/webaudio/AudioWorklet.cpp |
index c20f22dcc97de22abc4cc1c62c17dce80a86872f..1ee3faebf78b1431bd94c7bedc98b5bcfec409b9 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/AudioWorklet.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/AudioWorklet.cpp |
@@ -16,36 +16,26 @@ AudioWorklet* AudioWorklet::Create(LocalFrame* frame) { |
return new AudioWorklet(frame); |
} |
-AudioWorklet::AudioWorklet(LocalFrame* frame) |
- : ThreadedWorklet(frame), worklet_messaging_proxy_(nullptr) {} |
+AudioWorklet::AudioWorklet(LocalFrame* frame) : Worklet(frame) {} |
AudioWorklet::~AudioWorklet() { |
- if (worklet_messaging_proxy_) |
- worklet_messaging_proxy_->ParentObjectDestroyed(); |
+ // The proxy outlives the worklet as it is used to perform thread shutdown, |
+ // it deletes itself once this has occurred. |
+ // TODO(nhiroki): |
} |
-void AudioWorklet::Initialize() { |
- AudioWorkletThread::EnsureSharedBackingThread(); |
- |
- DCHECK(!worklet_messaging_proxy_); |
- DCHECK(GetExecutionContext()); |
- |
- worklet_messaging_proxy_ = |
- new AudioWorkletMessagingProxy(GetExecutionContext()); |
- worklet_messaging_proxy_->Initialize(); |
+bool AudioWorklet::NeedsToCreateGlobalScope() { |
+ // In the current impl, we create only one global scope. |
+ return !GetNumberOfGlobalScopes(); |
} |
-bool AudioWorklet::IsInitialized() const { |
- return worklet_messaging_proxy_; |
-} |
- |
-WorkletGlobalScopeProxy* AudioWorklet::GetWorkletGlobalScopeProxy() const { |
- DCHECK(worklet_messaging_proxy_); |
- return worklet_messaging_proxy_; |
+std::unique_ptr<WorkletGlobalScopeProxy> AudioWorklet::CreateGlobalScope() { |
+ AudioWorkletThread::EnsureSharedBackingThread(); |
+ return WTF::MakeUnique<AudioWorkletMessagingProxy>(GetExecutionContext()); |
} |
DEFINE_TRACE(AudioWorklet) { |
- ThreadedWorklet::Trace(visitor); |
+ Worklet::Trace(visitor); |
} |
} // namespace blink |