| Index: third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScopeProxy.cpp
|
| diff --git a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScopeProxy.cpp b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScopeProxy.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..29b28581019983c0a357a2dc68cc5771d36e435f
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScopeProxy.cpp
|
| @@ -0,0 +1,63 @@
|
| +// Copyright 2017 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 "modules/csspaint/PaintWorkletGlobalScopeProxy.h"
|
| +
|
| +#include "bindings/core/v8/ScriptSourceCode.h"
|
| +#include "bindings/core/v8/V8BindingForCore.h"
|
| +#include "core/dom/Document.h"
|
| +#include "core/frame/LocalFrame.h"
|
| +#include "platform/weborigin/KURL.h"
|
| +#include "platform/wtf/WTF.h"
|
| +
|
| +namespace blink {
|
| +
|
| +PaintWorkletGlobalScopeProxy* PaintWorkletGlobalScopeProxy::From(
|
| + WorkletGlobalScopeProxy* proxy) {
|
| + return static_cast<PaintWorkletGlobalScopeProxy*>(proxy);
|
| +}
|
| +
|
| +PaintWorkletGlobalScopeProxy::PaintWorkletGlobalScopeProxy(LocalFrame* frame) {
|
| + DCHECK(IsMainThread());
|
| + Document* document = frame->GetDocument();
|
| + global_scope_ = PaintWorkletGlobalScope::Create(
|
| + frame, document->Url(), document->UserAgent(),
|
| + document->GetSecurityOrigin(), ToIsolate(document));
|
| +}
|
| +
|
| +void PaintWorkletGlobalScopeProxy::FetchAndInvokeScript(
|
| + const KURL& module_url_record,
|
| + WorkletPendingTasks* pending_tasks) {
|
| + DCHECK(IsMainThread());
|
| + global_scope_->FetchAndInvokeScript(module_url_record, pending_tasks);
|
| +}
|
| +
|
| +void PaintWorkletGlobalScopeProxy::EvaluateScript(
|
| + const ScriptSourceCode& script_source_code) {
|
| + // This should be called only for threaded worklets that still use classic
|
| + // script loading.
|
| + NOTREACHED();
|
| +}
|
| +
|
| +void PaintWorkletGlobalScopeProxy::TerminateWorkletGlobalScope() {
|
| + DCHECK(IsMainThread());
|
| + global_scope_->Terminate();
|
| + // Nullify the global scope to cut a potential reference cycle.
|
| + global_scope_ = nullptr;
|
| +}
|
| +
|
| +CSSPaintDefinition* PaintWorkletGlobalScopeProxy::FindDefinition(
|
| + const String& name) {
|
| + DCHECK(IsMainThread());
|
| + return global_scope_->FindDefinition(name);
|
| +}
|
| +
|
| +void PaintWorkletGlobalScopeProxy::AddPendingGenerator(
|
| + const String& name,
|
| + CSSPaintImageGeneratorImpl* generator) {
|
| + DCHECK(IsMainThread());
|
| + global_scope_->AddPendingGenerator(name, generator);
|
| +}
|
| +
|
| +} // namespace blink
|
|
|