 Chromium Code Reviews
 Chromium Code Reviews Issue 2312493002:
  [worklets] Introduce ThreadedWorkletMessagingProxy and AnimationWorkletMessagaingProxy.  (Closed)
    
  
    Issue 2312493002:
  [worklets] Introduce ThreadedWorkletMessagingProxy and AnimationWorkletMessagaingProxy.  (Closed) 
  | 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/V8Binding.h" | 7 #include "bindings/core/v8/V8Binding.h" | 
| 8 #include "core/dom/Document.h" | |
| 8 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" | 
| 9 #include "core/workers/ThreadedWorkletGlobalScopeProxy.h" | 10 #include "modules/compositorworker/AnimationWorkletMessagingProxy.h" | 
| 11 #include "modules/compositorworker/AnimationWorkletThread.h" | |
| 10 | 12 | 
| 11 namespace blink { | 13 namespace blink { | 
| 12 | 14 | 
| 13 // static | 15 // static | 
| 14 AnimationWorklet* AnimationWorklet::create(LocalFrame* frame) | 16 AnimationWorklet* AnimationWorklet::create(LocalFrame* frame) | 
| 15 { | 17 { | 
| 18 AnimationWorkletThread::ensureSharedBackingThread(); | |
| 16 AnimationWorklet* worklet = new AnimationWorklet(frame); | 19 AnimationWorklet* worklet = new AnimationWorklet(frame); | 
| 17 worklet->suspendIfNeeded(); | 20 worklet->suspendIfNeeded(); | 
| 18 return worklet; | 21 return worklet; | 
| 19 } | 22 } | 
| 20 | 23 | 
| 21 AnimationWorklet::AnimationWorklet(LocalFrame* frame) | 24 AnimationWorklet::AnimationWorklet(LocalFrame* frame) | 
| 22 : Worklet(frame) | 25 : Worklet(frame) | 
| 23 , m_workletGlobalScopeProxy(new ThreadedWorkletGlobalScopeProxy()) | 26 , m_workletMessagingProxy(new AnimationWorkletMessagingProxy(frame->document ())) | 
| 24 { | 27 { | 
| 28 m_workletMessagingProxy->initialize(); | |
| 25 } | 29 } | 
| 26 | 30 | 
| 27 AnimationWorklet::~AnimationWorklet() | 31 AnimationWorklet::~AnimationWorklet() | 
| 28 { | 32 { | 
| 33 DCHECK(m_workletMessagingProxy); | |
| 
yhirano
2016/09/12 09:02:58
Is it good to move this check to the constructor a
 
ikilpatrick
2016/09/12 17:29:07
sgtm, I've just removed the DCHECK now that it's a
 | |
| 34 m_workletMessagingProxy->parentObjectDestroyed(); | |
| 29 } | 35 } | 
| 30 | 36 | 
| 31 WorkletGlobalScopeProxy* AnimationWorklet::workletGlobalScopeProxy() const | 37 WorkletGlobalScopeProxy* AnimationWorklet::workletGlobalScopeProxy() const | 
| 32 { | 38 { | 
| 33 return m_workletGlobalScopeProxy.get(); | 39 return m_workletMessagingProxy; | 
| 34 } | 40 } | 
| 35 | 41 | 
| 36 DEFINE_TRACE(AnimationWorklet) | 42 DEFINE_TRACE(AnimationWorklet) | 
| 37 { | 43 { | 
| 38 Worklet::trace(visitor); | 44 Worklet::trace(visitor); | 
| 39 } | 45 } | 
| 40 | 46 | 
| 41 } // namespace blink | 47 } // namespace blink | 
| OLD | NEW |