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 WorkletObjectProxy* object_proxy) { |
| 20 return WTF::WrapUnique(new PaintWorkletGlobalScopeProxy(frame, object_proxy)); |
| 21 } |
| 22 |
| 23 PaintWorkletGlobalScopeProxy* PaintWorkletGlobalScopeProxy::From( |
| 24 WorkletGlobalScopeProxy* proxy) { |
| 25 return static_cast<PaintWorkletGlobalScopeProxy*>(proxy); |
| 26 } |
| 27 |
| 28 void PaintWorkletGlobalScopeProxy::FetchAndInvokeScript( |
| 29 int32_t request_id, |
| 30 const KURL& script_url) { |
| 31 DCHECK(WTF::IsMainThread()); |
| 32 global_scope_->FetchAndInvokeScript(request_id, script_url); |
| 33 } |
| 34 |
| 35 void PaintWorkletGlobalScopeProxy::EvaluateScript( |
| 36 const ScriptSourceCode& script_source_code) { |
| 37 DCHECK(WTF::IsMainThread()); |
| 38 global_scope_->EvaluateScript(script_source_code); |
| 39 } |
| 40 |
| 41 void PaintWorkletGlobalScopeProxy::TerminateWorkletGlobalScope() { |
| 42 DCHECK(WTF::IsMainThread()); |
| 43 global_scope_->TerminateWorkletGlobalScope(); |
| 44 } |
| 45 |
| 46 PaintWorkletGlobalScopeProxy::PaintWorkletGlobalScopeProxy( |
| 47 LocalFrame* frame, |
| 48 WorkletObjectProxy* object_proxy) { |
| 49 DCHECK(WTF::IsMainThread()); |
| 50 Document* document = frame->GetDocument(); |
| 51 global_scope_ = PaintWorkletGlobalScope::Create( |
| 52 frame, document->Url(), document->UserAgent(), |
| 53 document->GetSecurityOrigin(), ToIsolate(document), object_proxy); |
| 54 } |
| 55 |
| 56 } // namespace blink |
OLD | NEW |