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

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

Issue 2826903002: [ES6 modules] Integrate ModuleTreeLinkerRegistry into ModulatorImpl back-plane (Closed)
Patch Set: rebased Created 3 years, 8 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" 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 "platform/loader/fetch/ResourceFetcher.h" 17 #include "platform/loader/fetch/ResourceFetcher.h"
17 18
18 namespace blink { 19 namespace blink {
19 20
20 ModulatorImpl* ModulatorImpl::Create(RefPtr<ScriptState> script_state, 21 ModulatorImpl* ModulatorImpl::Create(RefPtr<ScriptState> script_state,
21 Document& document) { 22 Document& document) {
22 return new ModulatorImpl( 23 return new ModulatorImpl(
23 std::move(script_state), 24 std::move(script_state),
24 TaskRunnerHelper::Get(TaskType::kNetworking, &document), 25 TaskRunnerHelper::Get(TaskType::kNetworking, &document),
25 document.Fetcher()); 26 document.Fetcher());
26 } 27 }
27 28
28 ModulatorImpl::ModulatorImpl(RefPtr<ScriptState> script_state, 29 ModulatorImpl::ModulatorImpl(RefPtr<ScriptState> script_state,
29 RefPtr<WebTaskRunner> task_runner, 30 RefPtr<WebTaskRunner> task_runner,
30 ResourceFetcher* fetcher) 31 ResourceFetcher* fetcher)
31 : script_state_(std::move(script_state)), 32 : script_state_(std::move(script_state)),
32 task_runner_(std::move(task_runner)), 33 task_runner_(std::move(task_runner)),
33 fetcher_(fetcher), 34 fetcher_(fetcher),
34 map_(this, ModuleMap::Create(this)), 35 map_(this, ModuleMap::Create(this)),
35 loader_registry_(ModuleScriptLoaderRegistry::Create()), 36 loader_registry_(ModuleScriptLoaderRegistry::Create()),
37 tree_linker_registry_(ModuleTreeLinkerRegistry::Create()),
36 script_module_resolver_(ScriptModuleResolverImpl::Create(this)) { 38 script_module_resolver_(ScriptModuleResolverImpl::Create(this)) {
37 DCHECK(script_state_); 39 DCHECK(script_state_);
38 DCHECK(task_runner_); 40 DCHECK(task_runner_);
39 DCHECK(fetcher_); 41 DCHECK(fetcher_);
40 } 42 }
41 43
42 ModulatorImpl::~ModulatorImpl() {} 44 ModulatorImpl::~ModulatorImpl() {}
43 45
44 ReferrerPolicy ModulatorImpl::GetReferrerPolicy() { 46 ReferrerPolicy ModulatorImpl::GetReferrerPolicy() {
45 return GetExecutionContext()->GetReferrerPolicy(); 47 return GetExecutionContext()->GetReferrerPolicy();
(...skipping 22 matching lines...) Expand all
68 // Step 2. When the internal module script graph fetching procedure 70 // Step 2. When the internal module script graph fetching procedure
69 // asynchronously completes with result, asynchronously complete this 71 // asynchronously completes with result, asynchronously complete this
70 // algorithm with result. 72 // algorithm with result.
71 // Note: We delegate to ModuleTreeLinker to notify ModuleTreeClient. 73 // Note: We delegate to ModuleTreeLinker to notify ModuleTreeClient.
72 } 74 }
73 75
74 void ModulatorImpl::FetchTreeInternal(const ModuleScriptFetchRequest& request, 76 void ModulatorImpl::FetchTreeInternal(const ModuleScriptFetchRequest& request,
75 const AncestorList& ancestor_list, 77 const AncestorList& ancestor_list,
76 ModuleGraphLevel level, 78 ModuleGraphLevel level,
77 ModuleTreeClient* client) { 79 ModuleTreeClient* client) {
78 NOTIMPLEMENTED(); 80 tree_linker_registry_->Fetch(request, ancestor_list, level, this, client);
79 } 81 }
80 82
81 void ModulatorImpl::FetchSingle(const ModuleScriptFetchRequest& request, 83 void ModulatorImpl::FetchSingle(const ModuleScriptFetchRequest& request,
82 ModuleGraphLevel level, 84 ModuleGraphLevel level,
83 SingleModuleClient* client) { 85 SingleModuleClient* client) {
84 map_->FetchSingleModuleScript(request, level, client); 86 map_->FetchSingleModuleScript(request, level, client);
85 } 87 }
86 88
87 void ModulatorImpl::FetchNewSingleModule( 89 void ModulatorImpl::FetchNewSingleModule(
88 const ModuleScriptFetchRequest& request, 90 const ModuleScriptFetchRequest& request,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 136
135 inline ExecutionContext* ModulatorImpl::GetExecutionContext() const { 137 inline ExecutionContext* ModulatorImpl::GetExecutionContext() const {
136 return ExecutionContext::From(script_state_.Get()); 138 return ExecutionContext::From(script_state_.Get());
137 } 139 }
138 140
139 DEFINE_TRACE(ModulatorImpl) { 141 DEFINE_TRACE(ModulatorImpl) {
140 Modulator::Trace(visitor); 142 Modulator::Trace(visitor);
141 visitor->Trace(fetcher_); 143 visitor->Trace(fetcher_);
142 visitor->Trace(map_); 144 visitor->Trace(map_);
143 visitor->Trace(loader_registry_); 145 visitor->Trace(loader_registry_);
146 visitor->Trace(tree_linker_registry_);
144 visitor->Trace(script_module_resolver_); 147 visitor->Trace(script_module_resolver_);
145 } 148 }
146 149
147 DEFINE_TRACE_WRAPPERS(ModulatorImpl) { 150 DEFINE_TRACE_WRAPPERS(ModulatorImpl) {
148 visitor->TraceWrappers(map_); 151 visitor->TraceWrappers(map_);
149 } 152 }
150 153
151 } // namespace blink 154 } // 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