| Index: third_party/WebKit/Source/modules/worklet/WorkletMessagingProxy.cpp
|
| diff --git a/third_party/WebKit/Source/modules/worklet/WorkletMessagingProxy.cpp b/third_party/WebKit/Source/modules/worklet/WorkletMessagingProxy.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f1d5c5cedf50ae0610776afa3cd3b3355a3b81e1
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/modules/worklet/WorkletMessagingProxy.cpp
|
| @@ -0,0 +1,48 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "config.h"
|
| +#include "modules/worklet/WorkletMessagingProxy.h"
|
| +
|
| +#include "core/dom/ExecutionContext.h"
|
| +#include "modules/worklet/CompositorWorkletThread.h"
|
| +#include "modules/worklet/Worklet.h"
|
| +
|
| +namespace blink {
|
| +
|
| +WorkletMessagingProxy* WorkletMessagingProxy::create(Worklet* worklet)
|
| +{
|
| + return new WorkletMessagingProxy(worklet);
|
| +}
|
| +
|
| +WorkletMessagingProxy::WorkletMessagingProxy(Worklet* worklet)
|
| + : m_executionContext(worklet->executionContext())
|
| + , m_worklet(worklet)
|
| +{
|
| + ASSERT(m_worklet);
|
| + ASSERT(m_executionContext->isDocument() && isMainThread());
|
| + // TODO set proxy here.
|
| +}
|
| +
|
| +WorkletMessagingProxy::~WorkletMessagingProxy()
|
| +{
|
| + ASSERT(!m_worklet);
|
| + ASSERT(m_executionContext->isDocument() && isMainThread());
|
| +}
|
| +
|
| +void WorkletMessagingProxy::loadScript(const String& sourceCode)
|
| +{
|
| + ASSERT(isMainThread());
|
| +
|
| + if (!m_thread) {
|
| + m_thread = CompositorWorkletThread::create();
|
| + m_thread->initialize();
|
| + }
|
| +
|
| + m_thread->loadScript(sourceCode);
|
| +}
|
| +
|
| +// TODO terminate this.
|
| +
|
| +} // namespace blink
|
|
|