Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: third_party/WebKit/Source/core/dom/ModulatorImpl.cpp

Issue 2826313003: Worklet: Enable module script loading for main thread worklets (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "core/dom/ModulatorImpl.h" 5 #include "core/dom/ModulatorImpl.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/ExecutionContext.h" 8 #include "core/dom/ExecutionContext.h"
9 #include "core/dom/ModuleMap.h" 9 #include "core/dom/ModuleMap.h"
10 #include "core/dom/ModuleScript.h" 10 #include "core/dom/ModuleScript.h"
11 #include "core/dom/ScriptModuleResolverImpl.h" 11 #include "core/dom/ScriptModuleResolverImpl.h"
12 #include "core/dom/TaskRunnerHelper.h" 12 #include "core/dom/TaskRunnerHelper.h"
13 #include "core/frame/LocalFrame.h" 13 #include "core/frame/LocalFrame.h"
14 #include "core/loader/modulescript/ModuleScriptFetchRequest.h" 14 #include "core/loader/modulescript/ModuleScriptFetchRequest.h"
15 #include "core/loader/modulescript/ModuleScriptLoaderRegistry.h" 15 #include "core/loader/modulescript/ModuleScriptLoaderRegistry.h"
16 #include "core/loader/modulescript/ModuleTreeLinkerRegistry.h" 16 #include "core/loader/modulescript/ModuleTreeLinkerRegistry.h"
17 #include "platform/loader/fetch/ResourceFetcher.h" 17 #include "platform/loader/fetch/ResourceFetcher.h"
18 18
19 namespace blink { 19 namespace blink {
20 20
21 ModulatorImpl* ModulatorImpl::Create(RefPtr<ScriptState> script_state, 21 ModulatorImpl* ModulatorImpl::Create(RefPtr<ScriptState> script_state,
22 Document& document) { 22 ExecutionContext& execution_context,
23 ResourceFetcher* fetcher) {
23 return new ModulatorImpl( 24 return new ModulatorImpl(
24 std::move(script_state), 25 std::move(script_state),
25 TaskRunnerHelper::Get(TaskType::kNetworking, &document), 26 TaskRunnerHelper::Get(TaskType::kNetworking, &execution_context),
kouhei (in TOK) 2017/05/01 10:15:32 shouldn't be needed.
nhiroki 2017/05/02 03:54:38 Done.
26 document.Fetcher()); 27 fetcher);
27 } 28 }
28 29
29 ModulatorImpl::ModulatorImpl(RefPtr<ScriptState> script_state, 30 ModulatorImpl::ModulatorImpl(RefPtr<ScriptState> script_state,
30 RefPtr<WebTaskRunner> task_runner, 31 RefPtr<WebTaskRunner> task_runner,
31 ResourceFetcher* fetcher) 32 ResourceFetcher* fetcher)
32 : script_state_(std::move(script_state)), 33 : script_state_(std::move(script_state)),
33 task_runner_(std::move(task_runner)), 34 task_runner_(std::move(task_runner)),
kouhei (in TOK) 2017/05/01 10:15:32 Maybe we should simply get this via TaskRunnerHelp
nhiroki 2017/05/02 03:54:38 Done.
34 fetcher_(fetcher), 35 fetcher_(fetcher),
35 map_(this, ModuleMap::Create(this)), 36 map_(this, ModuleMap::Create(this)),
36 loader_registry_(ModuleScriptLoaderRegistry::Create()), 37 loader_registry_(ModuleScriptLoaderRegistry::Create()),
37 tree_linker_registry_(ModuleTreeLinkerRegistry::Create()), 38 tree_linker_registry_(ModuleTreeLinkerRegistry::Create()),
38 script_module_resolver_(ScriptModuleResolverImpl::Create(this)) { 39 script_module_resolver_(ScriptModuleResolverImpl::Create(this)) {
39 DCHECK(script_state_); 40 DCHECK(script_state_);
40 DCHECK(task_runner_); 41 DCHECK(task_runner_);
41 DCHECK(fetcher_); 42 DCHECK(fetcher_);
42 } 43 }
43 44
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 visitor->Trace(loader_registry_); 219 visitor->Trace(loader_registry_);
219 visitor->Trace(tree_linker_registry_); 220 visitor->Trace(tree_linker_registry_);
220 visitor->Trace(script_module_resolver_); 221 visitor->Trace(script_module_resolver_);
221 } 222 }
222 223
223 DEFINE_TRACE_WRAPPERS(ModulatorImpl) { 224 DEFINE_TRACE_WRAPPERS(ModulatorImpl) {
224 visitor->TraceWrappers(map_); 225 visitor->TraceWrappers(map_);
225 } 226 }
226 227
227 } // namespace blink 228 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ModulatorImpl.h ('k') | third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698