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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 WorkerThread* MainThreadWorkletGlobalScope::GetThread() const { | 44 WorkerThread* MainThreadWorkletGlobalScope::GetThread() const { |
45 NOTREACHED(); | 45 NOTREACHED(); |
46 return nullptr; | 46 return nullptr; |
47 } | 47 } |
48 | 48 |
49 // Implementation of the first half of the "fetch and invoke a worklet script" | 49 // Implementation of the first half of the "fetch and invoke a worklet script" |
50 // algorithm: | 50 // algorithm: |
51 // https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script | 51 // https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script |
52 void MainThreadWorkletGlobalScope::FetchAndInvokeScript( | 52 void MainThreadWorkletGlobalScope::FetchAndInvokeScript( |
53 const KURL& module_url_record, | 53 const KURL& module_url_record, |
| 54 WebURLRequest::FetchCredentialsMode credentials_mode, |
54 WorkletPendingTasks* pending_tasks) { | 55 WorkletPendingTasks* pending_tasks) { |
55 DCHECK(IsMainThread()); | 56 DCHECK(IsMainThread()); |
56 // Step 1: "Let insideSettings be the workletGlobalScope's associated | 57 // Step 1: "Let insideSettings be the workletGlobalScope's associated |
57 // environment settings object." | 58 // environment settings object." |
58 // 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 |
59 // moduleURLRecord, moduleResponsesMap, credentialOptions, outsideSettings, | 60 // moduleURLRecord, moduleResponsesMap, credentialOptions, outsideSettings, |
60 // and insideSettings when it asynchronously completes." | 61 // and insideSettings when it asynchronously completes." |
61 // TODO(nhiroki): Replace this with module script loading. | 62 // TODO(nhiroki): Replace this with module script loading. Set fetch request's |
| 63 // credentials mode to |credentials_mode|. |
62 WorkletScriptLoader* script_loader = | 64 WorkletScriptLoader* script_loader = |
63 WorkletScriptLoader::Create(GetFrame()->GetDocument()->Fetcher(), this); | 65 WorkletScriptLoader::Create(GetFrame()->GetDocument()->Fetcher(), this); |
64 loader_map_.Set(script_loader, pending_tasks); | 66 loader_map_.Set(script_loader, pending_tasks); |
65 script_loader->FetchScript(module_url_record); | 67 script_loader->FetchScript(module_url_record); |
66 } | 68 } |
67 | 69 |
68 // TODO(nhiroki): Add tests for termination. | 70 // TODO(nhiroki): Add tests for termination. |
69 void MainThreadWorkletGlobalScope::Terminate() { | 71 void MainThreadWorkletGlobalScope::Terminate() { |
70 for (auto it = loader_map_.begin(); it != loader_map_.end();) { | 72 for (auto it = loader_map_.begin(); it != loader_map_.end();) { |
71 WorkletScriptLoader* script_loader = it->key; | 73 WorkletScriptLoader* script_loader = it->key; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 return probe::ToCoreProbeSink(GetFrame()); | 123 return probe::ToCoreProbeSink(GetFrame()); |
122 } | 124 } |
123 | 125 |
124 DEFINE_TRACE(MainThreadWorkletGlobalScope) { | 126 DEFINE_TRACE(MainThreadWorkletGlobalScope) { |
125 visitor->Trace(loader_map_); | 127 visitor->Trace(loader_map_); |
126 WorkletGlobalScope::Trace(visitor); | 128 WorkletGlobalScope::Trace(visitor); |
127 ContextClient::Trace(visitor); | 129 ContextClient::Trace(visitor); |
128 } | 130 } |
129 | 131 |
130 } // namespace blink | 132 } // namespace blink |
OLD | NEW |