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/loader/modulescript/ModuleTreeLinkerRegistry.h" | 5 #include "core/loader/modulescript/ModuleTreeLinkerRegistry.h" |
6 | 6 |
7 #include "core/loader/modulescript/ModuleTreeLinker.h" | 7 #include "core/loader/modulescript/ModuleTreeLinker.h" |
8 #include "platform/weborigin/KURL.h" | 8 #include "platform/weborigin/KURL.h" |
9 #include "platform/weborigin/KURLHash.h" | 9 #include "platform/weborigin/KURLHash.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 DEFINE_TRACE(ModuleTreeLinkerRegistry) { | 13 DEFINE_TRACE(ModuleTreeLinkerRegistry) { |
14 visitor->Trace(active_tree_linkers_); | 14 visitor->Trace(active_tree_linkers_); |
15 } | 15 } |
16 | 16 |
17 ModuleTreeLinker* ModuleTreeLinkerRegistry::Fetch( | 17 ModuleTreeLinker* ModuleTreeLinkerRegistry::Fetch( |
18 const ModuleScriptFetchRequest& request, | 18 const ModuleScriptFetchRequest& request, |
19 const AncestorList& ancestor_list, | 19 const AncestorList& ancestor_list, |
20 ModuleGraphLevel level, | 20 ModuleGraphLevel level, |
21 Modulator* modulator, | 21 Modulator* modulator, |
22 ModuleTreeClient* client) { | 22 ModuleTreeClient* client) { |
23 ModuleTreeLinker* fetcher = ModuleTreeLinker::Fetch( | 23 ModuleTreeLinker* fetcher = ModuleTreeLinker::Fetch( |
24 request, ancestor_list, level, modulator, this, client); | 24 request, ancestor_list, level, modulator, this, client); |
25 DCHECK(fetcher->IsFetching()); | 25 DCHECK(fetcher->IsFetching()); |
26 active_tree_linkers_.insert(fetcher); | 26 active_tree_linkers_.insert(fetcher); |
27 return fetcher; | 27 return fetcher; |
28 } | 28 } |
29 | 29 |
| 30 ModuleTreeLinker* ModuleTreeLinkerRegistry::FetchDescendantsForInlineScript( |
| 31 ModuleScript* module_script, |
| 32 Modulator* modulator, |
| 33 ModuleTreeClient* client) { |
| 34 ModuleTreeLinker* fetcher = ModuleTreeLinker::FetchDescendantsForInlineScript( |
| 35 module_script, modulator, this, client); |
| 36 DCHECK(fetcher->IsFetching()); |
| 37 active_tree_linkers_.insert(fetcher); |
| 38 return fetcher; |
| 39 } |
| 40 |
30 void ModuleTreeLinkerRegistry::ReleaseFinishedFetcher( | 41 void ModuleTreeLinkerRegistry::ReleaseFinishedFetcher( |
31 ModuleTreeLinker* fetcher) { | 42 ModuleTreeLinker* fetcher) { |
32 DCHECK(fetcher->HasFinished()); | 43 DCHECK(fetcher->HasFinished()); |
33 | 44 |
34 auto it = active_tree_linkers_.find(fetcher); | 45 auto it = active_tree_linkers_.find(fetcher); |
35 DCHECK_NE(it, active_tree_linkers_.end()); | 46 DCHECK_NE(it, active_tree_linkers_.end()); |
36 active_tree_linkers_.erase(it); | 47 active_tree_linkers_.erase(it); |
37 } | 48 } |
38 | 49 |
39 } // namespace blink | 50 } // namespace blink |
OLD | NEW |