Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(937)

Unified Diff: third_party/WebKit/Source/modules/webaudio/AudioWorklet.cpp

Issue 2912743002: [WIP] Worklet: Merge MainThreadWorklet and ThreadedWorklet into Worklet
Patch Set: WIP Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698