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

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

Issue 2865003002: Make ModulatorImpl execution-context-agnostic (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/ModulatorImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
8 #include "core/dom/ExecutionContext.h" 7 #include "core/dom/ExecutionContext.h"
9 #include "core/dom/ModuleMap.h" 8 #include "core/dom/ModuleMap.h"
10 #include "core/dom/ModuleScript.h" 9 #include "core/dom/ModuleScript.h"
11 #include "core/dom/ScriptModuleResolverImpl.h" 10 #include "core/dom/ScriptModuleResolverImpl.h"
12 #include "core/dom/TaskRunnerHelper.h" 11 #include "core/dom/TaskRunnerHelper.h"
13 #include "core/frame/LocalFrame.h" 12 #include "core/frame/LocalFrame.h"
14 #include "core/loader/modulescript/ModuleScriptFetchRequest.h" 13 #include "core/loader/modulescript/ModuleScriptFetchRequest.h"
15 #include "core/loader/modulescript/ModuleScriptLoaderRegistry.h" 14 #include "core/loader/modulescript/ModuleScriptLoaderRegistry.h"
16 #include "core/loader/modulescript/ModuleTreeLinkerRegistry.h" 15 #include "core/loader/modulescript/ModuleTreeLinkerRegistry.h"
17 #include "platform/loader/fetch/ResourceFetcher.h" 16 #include "platform/loader/fetch/ResourceFetcher.h"
18 17
19 namespace blink { 18 namespace blink {
20 19
21 ModulatorImpl* ModulatorImpl::Create(RefPtr<ScriptState> script_state, 20 ModulatorImpl* ModulatorImpl::Create(RefPtr<ScriptState> script_state,
22 Document& document) { 21 ResourceFetcher* resource_fetcher) {
23 return new ModulatorImpl( 22 return new ModulatorImpl(std::move(script_state), resource_fetcher);
24 std::move(script_state),
25 TaskRunnerHelper::Get(TaskType::kNetworking, &document),
26 document.Fetcher());
27 } 23 }
28 24
29 ModulatorImpl::ModulatorImpl(RefPtr<ScriptState> script_state, 25 ModulatorImpl::ModulatorImpl(RefPtr<ScriptState> script_state,
30 RefPtr<WebTaskRunner> task_runner,
31 ResourceFetcher* fetcher) 26 ResourceFetcher* fetcher)
32 : script_state_(std::move(script_state)), 27 : script_state_(std::move(script_state)),
33 task_runner_(std::move(task_runner)), 28 task_runner_(
29 TaskRunnerHelper::Get(TaskType::kNetworking, script_state_.Get())),
34 fetcher_(fetcher), 30 fetcher_(fetcher),
35 map_(this, ModuleMap::Create(this)), 31 map_(this, ModuleMap::Create(this)),
36 loader_registry_(ModuleScriptLoaderRegistry::Create()), 32 loader_registry_(ModuleScriptLoaderRegistry::Create()),
37 tree_linker_registry_(ModuleTreeLinkerRegistry::Create()), 33 tree_linker_registry_(ModuleTreeLinkerRegistry::Create()),
38 script_module_resolver_(ScriptModuleResolverImpl::Create(this)) { 34 script_module_resolver_(ScriptModuleResolverImpl::Create(this)) {
39 DCHECK(script_state_); 35 DCHECK(script_state_);
40 DCHECK(task_runner_); 36 DCHECK(task_runner_);
41 DCHECK(fetcher_); 37 DCHECK(fetcher_);
42 } 38 }
43 39
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 visitor->Trace(loader_registry_); 214 visitor->Trace(loader_registry_);
219 visitor->Trace(tree_linker_registry_); 215 visitor->Trace(tree_linker_registry_);
220 visitor->Trace(script_module_resolver_); 216 visitor->Trace(script_module_resolver_);
221 } 217 }
222 218
223 DEFINE_TRACE_WRAPPERS(ModulatorImpl) { 219 DEFINE_TRACE_WRAPPERS(ModulatorImpl) {
224 visitor->TraceWrappers(map_); 220 visitor->TraceWrappers(map_);
225 } 221 }
226 222
227 } // namespace blink 223 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ModulatorImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698