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 RefPtr<WebTaskRunner> parent_frame_task_runner, |
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, |
| 39 std::move(parent_frame_task_runner), |
38 pending_tasks); | 40 pending_tasks); |
39 } | 41 } |
40 | 42 |
41 void PaintWorkletGlobalScopeProxy::EvaluateScript( | 43 void PaintWorkletGlobalScopeProxy::EvaluateScript( |
42 const ScriptSourceCode& script_source_code) { | 44 const ScriptSourceCode& script_source_code) { |
43 // This should be called only for threaded worklets that still use classic | 45 // This should be called only for threaded worklets that still use classic |
44 // script loading. | 46 // script loading. |
45 NOTREACHED(); | 47 NOTREACHED(); |
46 } | 48 } |
47 | 49 |
48 void PaintWorkletGlobalScopeProxy::TerminateWorkletGlobalScope() { | 50 void PaintWorkletGlobalScopeProxy::TerminateWorkletGlobalScope() { |
49 DCHECK(IsMainThread()); | 51 DCHECK(IsMainThread()); |
50 global_scope_->Terminate(); | 52 global_scope_->Terminate(); |
51 // Nullify the global scope to cut a potential reference cycle. | 53 // Nullify the global scope to cut a potential reference cycle. |
52 global_scope_ = nullptr; | 54 global_scope_ = nullptr; |
53 } | 55 } |
54 | 56 |
55 CSSPaintDefinition* PaintWorkletGlobalScopeProxy::FindDefinition( | 57 CSSPaintDefinition* PaintWorkletGlobalScopeProxy::FindDefinition( |
56 const String& name) { | 58 const String& name) { |
57 DCHECK(IsMainThread()); | 59 DCHECK(IsMainThread()); |
58 return global_scope_->FindDefinition(name); | 60 return global_scope_->FindDefinition(name); |
59 } | 61 } |
60 | 62 |
61 } // namespace blink | 63 } // namespace blink |
OLD | NEW |