Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScopeProxy.cpp

Issue 2840523002: [DONT COMMIT] Worklet: Implement "addModule()" algorithm for main thread worklets (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..fb6341ebcfa682af9ddeb5a305a3b569413f50da
--- /dev/null
+++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScopeProxy.cpp
@@ -0,0 +1,53 @@
+// 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) {
+ return WTF::WrapUnique(new PaintWorkletGlobalScopeProxy(frame));
+}
+
+PaintWorkletGlobalScopeProxy* PaintWorkletGlobalScopeProxy::From(
+ WorkletGlobalScopeProxy* proxy) {
+ return static_cast<PaintWorkletGlobalScopeProxy*>(proxy);
+}
+
+void PaintWorkletGlobalScopeProxy::FetchAndInvokeScript(
+ const KURL& module_url_record,
+ WorkletPendingTasks* pending_tasks) {
+ DCHECK(WTF::IsMainThread());
+ global_scope_->FetchAndInvokeScript(module_url_record, pending_tasks);
+}
+
+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) {
+ DCHECK(WTF::IsMainThread());
+ Document* document = frame->GetDocument();
+ global_scope_ = PaintWorkletGlobalScope::Create(
+ frame, document->Url(), document->UserAgent(),
+ document->GetSecurityOrigin(), ToIsolate(document));
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698