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..16a64f3464c90c407549cd528dbe573d0e53a4e1 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScopeProxy.cpp |
@@ -0,0 +1,56 @@ |
+// 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 "core/workers/WorkletGlobalScopeProxy.h" |
+#include "platform/weborigin/KURL.h" |
+#include "platform/wtf/WTF.h" |
+ |
+namespace blink { |
+ |
+std::unique_ptr<PaintWorkletGlobalScopeProxy> |
+PaintWorkletGlobalScopeProxy::Create(LocalFrame* frame, |
+ WorkletObjectProxy* object_proxy) { |
+ return WTF::WrapUnique(new PaintWorkletGlobalScopeProxy(frame, object_proxy)); |
+} |
+ |
+PaintWorkletGlobalScopeProxy* PaintWorkletGlobalScopeProxy::From( |
+ WorkletGlobalScopeProxy* proxy) { |
+ return static_cast<PaintWorkletGlobalScopeProxy*>(proxy); |
+} |
+ |
+void PaintWorkletGlobalScopeProxy::FetchAndInvokeScript( |
+ int32_t request_id, |
+ const KURL& script_url) { |
+ DCHECK(WTF::IsMainThread()); |
+ global_scope_->FetchAndInvokeScript(request_id, script_url); |
+} |
+ |
+void PaintWorkletGlobalScopeProxy::EvaluateScript( |
+ const ScriptSourceCode& script_source_code) { |
+ DCHECK(WTF::IsMainThread()); |
+ global_scope_->EvaluateScript(script_source_code); |
+} |
+ |
+void PaintWorkletGlobalScopeProxy::TerminateWorkletGlobalScope() { |
+ DCHECK(WTF::IsMainThread()); |
+ global_scope_->TerminateWorkletGlobalScope(); |
+} |
+ |
+PaintWorkletGlobalScopeProxy::PaintWorkletGlobalScopeProxy( |
+ LocalFrame* frame, |
+ WorkletObjectProxy* object_proxy) { |
+ DCHECK(WTF::IsMainThread()); |
+ Document* document = frame->GetDocument(); |
+ global_scope_ = PaintWorkletGlobalScope::Create( |
+ frame, document->Url(), document->UserAgent(), |
+ document->GetSecurityOrigin(), ToIsolate(document), object_proxy); |
+} |
+ |
+} // namespace blink |