OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 "modules/csspaint/PaintWorkletGlobalScopeProxy.h" |
| 6 |
| 7 #include "bindings/core/v8/ScriptSourceCode.h" |
| 8 #include "bindings/core/v8/V8BindingForCore.h" |
| 9 #include "core/dom/Document.h" |
| 10 #include "core/frame/LocalFrame.h" |
| 11 #include "core/workers/WorkletGlobalScopeProxy.h" |
| 12 #include "platform/weborigin/KURL.h" |
| 13 #include "platform/wtf/WTF.h" |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 std::unique_ptr<PaintWorkletGlobalScopeProxy> |
| 18 PaintWorkletGlobalScopeProxy::Create(LocalFrame* frame) { |
| 19 return WTF::WrapUnique(new PaintWorkletGlobalScopeProxy(frame)); |
| 20 } |
| 21 |
| 22 PaintWorkletGlobalScopeProxy* PaintWorkletGlobalScopeProxy::From( |
| 23 WorkletGlobalScopeProxy* proxy) { |
| 24 return static_cast<PaintWorkletGlobalScopeProxy*>(proxy); |
| 25 } |
| 26 |
| 27 void PaintWorkletGlobalScopeProxy::FetchAndInvokeScript( |
| 28 const KURL& module_url_record, |
| 29 WorkletPendingTasks* pending_tasks) { |
| 30 DCHECK(WTF::IsMainThread()); |
| 31 global_scope_->FetchAndInvokeScript(module_url_record, pending_tasks); |
| 32 } |
| 33 |
| 34 void PaintWorkletGlobalScopeProxy::EvaluateScript( |
| 35 const ScriptSourceCode& script_source_code) { |
| 36 DCHECK(WTF::IsMainThread()); |
| 37 global_scope_->EvaluateScript(script_source_code); |
| 38 } |
| 39 |
| 40 void PaintWorkletGlobalScopeProxy::TerminateWorkletGlobalScope() { |
| 41 DCHECK(WTF::IsMainThread()); |
| 42 global_scope_->TerminateWorkletGlobalScope(); |
| 43 } |
| 44 |
| 45 PaintWorkletGlobalScopeProxy::PaintWorkletGlobalScopeProxy(LocalFrame* frame) { |
| 46 DCHECK(WTF::IsMainThread()); |
| 47 Document* document = frame->GetDocument(); |
| 48 global_scope_ = PaintWorkletGlobalScope::Create( |
| 49 frame, document->Url(), document->UserAgent(), |
| 50 document->GetSecurityOrigin(), ToIsolate(document)); |
| 51 } |
| 52 |
| 53 } // namespace blink |
OLD | NEW |