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

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

Issue 2886123002: Revert of [ES6 modules] ModuleMap::GetFetchedModuleScript to return nullptr when entry not found / "fetching" (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/ModuleMap.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/ModuleMap.h" 5 #include "core/dom/ModuleMap.h"
6 6
7 #include "core/dom/Modulator.h" 7 #include "core/dom/Modulator.h"
8 #include "core/dom/ModuleScript.h" 8 #include "core/dom/ModuleScript.h"
9 #include "core/loader/modulescript/ModuleScriptFetchRequest.h" 9 #include "core/loader/modulescript/ModuleScriptFetchRequest.h"
10 #include "core/loader/modulescript/ModuleScriptLoaderClient.h" 10 #include "core/loader/modulescript/ModuleScriptLoaderClient.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 module_script_ = module_script; 89 module_script_ = module_script;
90 is_fetching_ = false; 90 is_fetching_ = false;
91 91
92 for (const auto& client : clients_) { 92 for (const auto& client : clients_) {
93 DispatchFinishedNotificationAsync(client); 93 DispatchFinishedNotificationAsync(client);
94 } 94 }
95 clients_.clear(); 95 clients_.clear();
96 } 96 }
97 97
98 ModuleScript* ModuleMap::Entry::GetModuleScript() const { 98 ModuleScript* ModuleMap::Entry::GetModuleScript() const {
99 DCHECK(!is_fetching_);
99 return module_script_.Get(); 100 return module_script_.Get();
100 } 101 }
101 102
102 ModuleMap::ModuleMap(Modulator* modulator) : modulator_(modulator) { 103 ModuleMap::ModuleMap(Modulator* modulator) : modulator_(modulator) {
103 DCHECK(modulator); 104 DCHECK(modulator);
104 } 105 }
105 106
106 DEFINE_TRACE(ModuleMap) { 107 DEFINE_TRACE(ModuleMap) {
107 visitor->Trace(map_); 108 visitor->Trace(map_);
108 visitor->Trace(modulator_); 109 visitor->Trace(modulator_);
(...skipping 29 matching lines...) Expand all
138 139
139 // Step 3. If moduleMap[url] exists, asynchronously complete this algorithm 140 // Step 3. If moduleMap[url] exists, asynchronously complete this algorithm
140 // with moduleMap[url], and abort these steps. 141 // with moduleMap[url], and abort these steps.
141 // Step 10. Set moduleMap[url] to module script, and asynchronously complete 142 // Step 10. Set moduleMap[url] to module script, and asynchronously complete
142 // this algorithm with module script. 143 // this algorithm with module script.
143 entry->AddClient(client); 144 entry->AddClient(client);
144 } 145 }
145 146
146 ModuleScript* ModuleMap::GetFetchedModuleScript(const KURL& url) const { 147 ModuleScript* ModuleMap::GetFetchedModuleScript(const KURL& url) const {
147 MapImpl::const_iterator it = map_.find(url); 148 MapImpl::const_iterator it = map_.find(url);
148 if (it == map_.end()) 149 CHECK_NE(it, map_.end());
149 return nullptr;
150 return it->value->GetModuleScript(); 150 return it->value->GetModuleScript();
151 } 151 }
152 152
153 } // namespace blink 153 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ModuleMap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698