| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/csspaint/PaintWorkletGlobalScopeProxy.h" | 5 #include "modules/csspaint/PaintWorkletGlobalScopeProxy.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptSourceCode.h" | 7 #include "bindings/core/v8/ScriptSourceCode.h" |
| 8 #include "bindings/core/v8/V8BindingForCore.h" | 8 #include "bindings/core/v8/V8BindingForCore.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 Document* document = frame->GetDocument(); | 25 Document* document = frame->GetDocument(); |
| 26 global_scope_ = PaintWorkletGlobalScope::Create( | 26 global_scope_ = PaintWorkletGlobalScope::Create( |
| 27 frame, document->Url(), document->UserAgent(), | 27 frame, document->Url(), document->UserAgent(), |
| 28 document->GetSecurityOrigin(), ToIsolate(document), | 28 document->GetSecurityOrigin(), ToIsolate(document), |
| 29 pending_generator_registry); | 29 pending_generator_registry); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void PaintWorkletGlobalScopeProxy::FetchAndInvokeScript( | 32 void PaintWorkletGlobalScopeProxy::FetchAndInvokeScript( |
| 33 const KURL& module_url_record, | 33 const KURL& module_url_record, |
| 34 WebURLRequest::FetchCredentialsMode credentials_mode, | 34 WebURLRequest::FetchCredentialsMode credentials_mode, |
| 35 ParentFrameTaskRunners* task_runners, |
| 35 WorkletPendingTasks* pending_tasks) { | 36 WorkletPendingTasks* pending_tasks) { |
| 36 DCHECK(IsMainThread()); | 37 DCHECK(IsMainThread()); |
| 37 global_scope_->FetchAndInvokeScript(module_url_record, credentials_mode, | 38 global_scope_->FetchAndInvokeScript(module_url_record, credentials_mode, |
| 38 pending_tasks); | 39 task_runners, pending_tasks); |
| 39 } | 40 } |
| 40 | 41 |
| 41 void PaintWorkletGlobalScopeProxy::EvaluateScript( | 42 void PaintWorkletGlobalScopeProxy::EvaluateScript( |
| 42 const ScriptSourceCode& script_source_code) { | 43 const ScriptSourceCode& script_source_code) { |
| 43 // This should be called only for threaded worklets that still use classic | 44 // This should be called only for threaded worklets that still use classic |
| 44 // script loading. | 45 // script loading. |
| 45 NOTREACHED(); | 46 NOTREACHED(); |
| 46 } | 47 } |
| 47 | 48 |
| 48 void PaintWorkletGlobalScopeProxy::TerminateWorkletGlobalScope() { | 49 void PaintWorkletGlobalScopeProxy::TerminateWorkletGlobalScope() { |
| 49 DCHECK(IsMainThread()); | 50 DCHECK(IsMainThread()); |
| 50 global_scope_->Terminate(); | 51 global_scope_->Terminate(); |
| 51 // Nullify the global scope to cut a potential reference cycle. | 52 // Nullify the global scope to cut a potential reference cycle. |
| 52 global_scope_ = nullptr; | 53 global_scope_ = nullptr; |
| 53 } | 54 } |
| 54 | 55 |
| 55 CSSPaintDefinition* PaintWorkletGlobalScopeProxy::FindDefinition( | 56 CSSPaintDefinition* PaintWorkletGlobalScopeProxy::FindDefinition( |
| 56 const String& name) { | 57 const String& name) { |
| 57 DCHECK(IsMainThread()); | 58 DCHECK(IsMainThread()); |
| 58 return global_scope_->FindDefinition(name); | 59 return global_scope_->FindDefinition(name); |
| 59 } | 60 } |
| 60 | 61 |
| 61 } // namespace blink | 62 } // namespace blink |
| OLD | NEW |