OLD | NEW |
---|---|
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 Loading... | |
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_); | |
100 return module_script_.Get(); | 99 return module_script_.Get(); |
101 } | 100 } |
102 | 101 |
103 ModuleMap::ModuleMap(Modulator* modulator) : modulator_(modulator) { | 102 ModuleMap::ModuleMap(Modulator* modulator) : modulator_(modulator) { |
104 DCHECK(modulator); | 103 DCHECK(modulator); |
105 } | 104 } |
106 | 105 |
107 DEFINE_TRACE(ModuleMap) { | 106 DEFINE_TRACE(ModuleMap) { |
108 visitor->Trace(map_); | 107 visitor->Trace(map_); |
109 visitor->Trace(modulator_); | 108 visitor->Trace(modulator_); |
(...skipping 29 matching lines...) Expand all Loading... | |
139 | 138 |
140 // Step 3. If moduleMap[url] exists, asynchronously complete this algorithm | 139 // Step 3. If moduleMap[url] exists, asynchronously complete this algorithm |
141 // with moduleMap[url], and abort these steps. | 140 // with moduleMap[url], and abort these steps. |
142 // Step 10. Set moduleMap[url] to module script, and asynchronously complete | 141 // Step 10. Set moduleMap[url] to module script, and asynchronously complete |
143 // this algorithm with module script. | 142 // this algorithm with module script. |
144 entry->AddClient(client); | 143 entry->AddClient(client); |
145 } | 144 } |
146 | 145 |
147 ModuleScript* ModuleMap::GetFetchedModuleScript(const KURL& url) const { | 146 ModuleScript* ModuleMap::GetFetchedModuleScript(const KURL& url) const { |
148 MapImpl::const_iterator it = map_.find(url); | 147 MapImpl::const_iterator it = map_.find(url); |
149 CHECK_NE(it, map_.end()); | |
150 return it->value->GetModuleScript(); | 148 return it->value->GetModuleScript(); |
neis
2017/05/09 08:56:37
This return statement makes no sense if the url wa
kouhei (in TOK)
2017/05/12 20:48:46
Done.
| |
151 } | 149 } |
152 | 150 |
153 } // namespace blink | 151 } // namespace blink |
OLD | NEW |