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

Unified Diff: third_party/WebKit/Source/modules/compositorworker/AnimationWorklet.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/compositorworker/AnimationWorklet.cpp
diff --git a/third_party/WebKit/Source/modules/compositorworker/AnimationWorklet.cpp b/third_party/WebKit/Source/modules/compositorworker/AnimationWorklet.cpp
index 46b241a92bd60318d905151325dff4da0096c20a..67eb30f2c9d69ed6bfe3aa6c267048c1d6fb92a5 100644
--- a/third_party/WebKit/Source/modules/compositorworker/AnimationWorklet.cpp
+++ b/third_party/WebKit/Source/modules/compositorworker/AnimationWorklet.cpp
@@ -19,40 +19,31 @@ AnimationWorklet* AnimationWorklet::Create(LocalFrame* frame) {
return new AnimationWorklet(frame);
}
-AnimationWorklet::AnimationWorklet(LocalFrame* frame)
- : ThreadedWorklet(frame), worklet_messaging_proxy_(nullptr) {}
+AnimationWorklet::AnimationWorklet(LocalFrame* frame) : Worklet(frame) {}
AnimationWorklet::~AnimationWorklet() {
- 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 AnimationWorklet::Initialize() {
- AnimationWorkletThread::EnsureSharedBackingThread();
+bool AnimationWorklet::NeedsToCreateGlobalScope() {
+ // In the current impl, we create only one global scope.
+ return !GetNumberOfGlobalScopes();
+}
- DCHECK(!worklet_messaging_proxy_);
- DCHECK(GetExecutionContext());
+std::unique_ptr<WorkletGlobalScopeProxy> AnimationWorklet::CreateGlobalScope() {
+ AnimationWorkletThread::EnsureSharedBackingThread();
Document* document = ToDocument(GetExecutionContext());
AnimationWorkletProxyClient* proxy_client =
document->GetFrame()->GetChromeClient().CreateAnimationWorkletProxyClient(
document->GetFrame());
-
- worklet_messaging_proxy_ =
- new AnimationWorkletMessagingProxy(GetExecutionContext(), proxy_client);
- worklet_messaging_proxy_->Initialize();
-}
-
-bool AnimationWorklet::IsInitialized() const {
- return worklet_messaging_proxy_;
-}
-
-WorkletGlobalScopeProxy* AnimationWorklet::GetWorkletGlobalScopeProxy() const {
- DCHECK(worklet_messaging_proxy_);
- return worklet_messaging_proxy_;
+ return WTF::MakeUnique<AnimationWorkletMessagingProxy>(GetExecutionContext(),
+ proxy_client);
}
DEFINE_TRACE(AnimationWorklet) {
- ThreadedWorklet::Trace(visitor);
+ Worklet::Trace(visitor);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698