| 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
|
|
|