OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ModuleMap_h |
| 6 #define ModuleMap_h |
| 7 |
| 8 #include "platform/heap/Handle.h" |
| 9 #include "platform/weborigin/KURL.h" |
| 10 #include "platform/weborigin/KURLHash.h" |
| 11 #include "wtf/HashMap.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class Modulator; |
| 16 class ModuleScript; |
| 17 class SingleModuleClient; |
| 18 |
| 19 // A ModuleMap implements "module map" spec. |
| 20 // https://html.spec.whatwg.org/#module-map |
| 21 class ModuleMap final : public GarbageCollected<ModuleMap> { |
| 22 WTF_MAKE_NONCOPYABLE(ModuleMap); |
| 23 class Entry; |
| 24 class LoaderHost; |
| 25 |
| 26 public: |
| 27 static ModuleMap* create(Modulator* modulator) { |
| 28 return new ModuleMap(modulator); |
| 29 } |
| 30 DECLARE_TRACE(); |
| 31 |
| 32 void retrieveAndFetchIfNeeded(const KURL&, |
| 33 const KURL& baseURL, |
| 34 SingleModuleClient*); |
| 35 ModuleScript* retrieveFetchedModuleScript(const KURL&); |
| 36 |
| 37 Modulator* modulator() { return m_modulator; } |
| 38 |
| 39 private: |
| 40 explicit ModuleMap(Modulator*); |
| 41 ModuleMap() = delete; |
| 42 |
| 43 using MapImpl = HeapHashMap<KURL, Member<Entry>>; |
| 44 |
| 45 // A module map is a map of absolute URLs to map entry. |
| 46 MapImpl m_map; |
| 47 |
| 48 Member<Modulator> m_modulator; |
| 49 }; |
| 50 |
| 51 } // namespace blink |
| 52 |
| 53 #endif |
OLD | NEW |