| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/compositorworker/AnimationWorklet.h" | 5 #include "modules/compositorworker/AnimationWorklet.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/V8BindingForCore.h" | 7 #include "bindings/core/v8/V8BindingForCore.h" |
| 8 #include "core/dom/AnimationWorkletProxyClient.h" | 8 #include "core/dom/AnimationWorkletProxyClient.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 void AnimationWorklet::Initialize() { | 30 void AnimationWorklet::Initialize() { |
| 31 AnimationWorkletThread::EnsureSharedBackingThread(); | 31 AnimationWorkletThread::EnsureSharedBackingThread(); |
| 32 | 32 |
| 33 DCHECK(!worklet_messaging_proxy_); | 33 DCHECK(!worklet_messaging_proxy_); |
| 34 DCHECK(GetExecutionContext()); | 34 DCHECK(GetExecutionContext()); |
| 35 Document* document = ToDocument(GetExecutionContext()); | 35 Document* document = ToDocument(GetExecutionContext()); |
| 36 AnimationWorkletProxyClient* proxy_client = | 36 AnimationWorkletProxyClient* proxy_client = |
| 37 document->GetFrame()->GetChromeClient().CreateAnimationWorkletProxyClient( | 37 document->GetFrame()->GetChromeClient().CreateAnimationWorkletProxyClient( |
| 38 document->GetFrame()); | 38 document->GetFrame()); |
| 39 | 39 |
| 40 WorkerClients* worker_clients = WorkerClients::Create(); |
| 41 ProvideAnimationWorkletProxyClientTo(worker_clients, proxy_client); |
| 42 |
| 40 worklet_messaging_proxy_ = | 43 worklet_messaging_proxy_ = |
| 41 new AnimationWorkletMessagingProxy(GetExecutionContext(), proxy_client); | 44 new AnimationWorkletMessagingProxy(GetExecutionContext(), worker_clients); |
| 42 worklet_messaging_proxy_->Initialize(); | 45 worklet_messaging_proxy_->Initialize(); |
| 43 } | 46 } |
| 44 | 47 |
| 45 bool AnimationWorklet::IsInitialized() const { | 48 bool AnimationWorklet::IsInitialized() const { |
| 46 return worklet_messaging_proxy_; | 49 return worklet_messaging_proxy_; |
| 47 } | 50 } |
| 48 | 51 |
| 49 WorkletGlobalScopeProxy* AnimationWorklet::GetWorkletGlobalScopeProxy() const { | 52 WorkletGlobalScopeProxy* AnimationWorklet::GetWorkletGlobalScopeProxy() const { |
| 50 DCHECK(worklet_messaging_proxy_); | 53 DCHECK(worklet_messaging_proxy_); |
| 51 return worklet_messaging_proxy_; | 54 return worklet_messaging_proxy_; |
| 52 } | 55 } |
| 53 | 56 |
| 54 DEFINE_TRACE(AnimationWorklet) { | 57 DEFINE_TRACE(AnimationWorklet) { |
| 55 ThreadedWorklet::Trace(visitor); | 58 ThreadedWorklet::Trace(visitor); |
| 56 } | 59 } |
| 57 | 60 |
| 58 } // namespace blink | 61 } // namespace blink |
| OLD | NEW |