OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/workers/MainThreadWorkletGlobalScope.h" | 5 #include "core/workers/MainThreadWorkletGlobalScope.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptSourceCode.h" | 7 #include "bindings/core/v8/ScriptSourceCode.h" |
8 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 8 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/frame/Deprecation.h" | 10 #include "core/frame/Deprecation.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // Step 2: "Let script by the result of fetch a worklet script given | 59 // Step 2: "Let script by the result of fetch a worklet script given |
60 // moduleURLRecord, moduleResponsesMap, credentialOptions, outsideSettings, | 60 // moduleURLRecord, moduleResponsesMap, credentialOptions, outsideSettings, |
61 // and insideSettings when it asynchronously completes." | 61 // and insideSettings when it asynchronously completes." |
62 // TODO(nhiroki): Replace this with module script loading. | 62 // TODO(nhiroki): Replace this with module script loading. |
63 WorkletScriptLoader* script_loader = | 63 WorkletScriptLoader* script_loader = |
64 WorkletScriptLoader::Create(GetFrame()->GetDocument()->Fetcher(), this); | 64 WorkletScriptLoader::Create(GetFrame()->GetDocument()->Fetcher(), this); |
65 loader_map_.Set(script_loader, pending_tasks); | 65 loader_map_.Set(script_loader, pending_tasks); |
66 script_loader->FetchScript(module_url_record); | 66 script_loader->FetchScript(module_url_record); |
67 } | 67 } |
68 | 68 |
69 void MainThreadWorkletGlobalScope::EvaluateScript( | |
70 const ScriptSourceCode& script_source_code) { | |
71 // This should be called only for threaded worklets that still use classic | |
72 // script loading. | |
73 NOTREACHED(); | |
74 } | |
75 | |
76 // TODO(nhiroki): Add tests for termination. | 69 // TODO(nhiroki): Add tests for termination. |
77 void MainThreadWorkletGlobalScope::TerminateWorkletGlobalScope() { | 70 void MainThreadWorkletGlobalScope::Terminate() { |
78 for (auto it = loader_map_.begin(); it != loader_map_.end();) { | 71 for (auto it = loader_map_.begin(); it != loader_map_.end();) { |
79 WorkletScriptLoader* script_loader = it->key; | 72 WorkletScriptLoader* script_loader = it->key; |
80 // Cancel() eventually calls NotifyWorkletScriptLoadingFinished() and | 73 // Cancel() eventually calls NotifyWorkletScriptLoadingFinished() and |
81 // removes |it| from |loader_map_|, so increment it in advance. | 74 // removes |it| from |loader_map_|, so increment it in advance. |
82 ++it; | 75 ++it; |
83 script_loader->Cancel(); | 76 script_loader->Cancel(); |
84 } | 77 } |
85 Dispose(); | 78 Dispose(); |
86 } | 79 } |
87 | 80 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 return probe::ToCoreProbeSink(GetFrame()); | 122 return probe::ToCoreProbeSink(GetFrame()); |
130 } | 123 } |
131 | 124 |
132 DEFINE_TRACE(MainThreadWorkletGlobalScope) { | 125 DEFINE_TRACE(MainThreadWorkletGlobalScope) { |
133 visitor->Trace(loader_map_); | 126 visitor->Trace(loader_map_); |
134 WorkletGlobalScope::Trace(visitor); | 127 WorkletGlobalScope::Trace(visitor); |
135 ContextClient::Trace(visitor); | 128 ContextClient::Trace(visitor); |
136 } | 129 } |
137 | 130 |
138 } // namespace blink | 131 } // namespace blink |
OLD | NEW |