OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "modules/worklet/WorkletMessagingProxy.h" |
| 7 |
| 8 #include "core/dom/ExecutionContext.h" |
| 9 #include "modules/worklet/CompositorWorkletThread.h" |
| 10 #include "modules/worklet/Worklet.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 WorkletMessagingProxy* WorkletMessagingProxy::create(Worklet* worklet) |
| 15 { |
| 16 return new WorkletMessagingProxy(worklet); |
| 17 } |
| 18 |
| 19 WorkletMessagingProxy::WorkletMessagingProxy(Worklet* worklet) |
| 20 : m_executionContext(worklet->executionContext()) |
| 21 , m_worklet(worklet) |
| 22 { |
| 23 ASSERT(m_worklet); |
| 24 ASSERT(m_executionContext->isDocument() && isMainThread()); |
| 25 // TODO set proxy here. |
| 26 } |
| 27 |
| 28 WorkletMessagingProxy::~WorkletMessagingProxy() |
| 29 { |
| 30 ASSERT(!m_worklet); |
| 31 ASSERT(m_executionContext->isDocument() && isMainThread()); |
| 32 } |
| 33 |
| 34 void WorkletMessagingProxy::loadScript(const String& sourceCode) |
| 35 { |
| 36 ASSERT(isMainThread()); |
| 37 |
| 38 if (!m_thread) { |
| 39 m_thread = CompositorWorkletThread::create(); |
| 40 m_thread->initialize(); |
| 41 } |
| 42 |
| 43 m_thread->loadScript(sourceCode); |
| 44 } |
| 45 |
| 46 // TODO terminate this. |
| 47 |
| 48 } // namespace blink |
OLD | NEW |