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 "core/CoreExport.h" |
| 9 #include "platform/heap/Handle.h" |
| 10 #include "platform/weborigin/KURL.h" |
| 11 #include "platform/weborigin/KURLHash.h" |
| 12 #include "wtf/HashMap.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 class Modulator; |
| 17 class ModuleScript; |
| 18 class ModuleScriptFetchRequest; |
| 19 class SingleModuleClient; |
| 20 enum class ModuleGraphLevel; |
| 21 |
| 22 // A ModuleMap implements "module map" spec. |
| 23 // https://html.spec.whatwg.org/#module-map |
| 24 class CORE_EXPORT ModuleMap final : public GarbageCollected<ModuleMap> { |
| 25 WTF_MAKE_NONCOPYABLE(ModuleMap); |
| 26 class Entry; |
| 27 class LoaderHost; |
| 28 |
| 29 public: |
| 30 static ModuleMap* create(Modulator* modulator) { |
| 31 return new ModuleMap(modulator); |
| 32 } |
| 33 DECLARE_TRACE(); |
| 34 |
| 35 // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-modul
e-script |
| 36 void fetchSingleModuleScript(const ModuleScriptFetchRequest&, |
| 37 ModuleGraphLevel, |
| 38 SingleModuleClient*); |
| 39 |
| 40 // Synchronously get the ModuleScript for a given URL. |
| 41 // Note: fetchSingleModuleScript of the ModuleScript must be complete before |
| 42 // calling this. |
| 43 ModuleScript* getFetchedModuleScript(const KURL&) const; |
| 44 |
| 45 Modulator* modulator() { return m_modulator; } |
| 46 |
| 47 private: |
| 48 explicit ModuleMap(Modulator*); |
| 49 |
| 50 using MapImpl = HeapHashMap<KURL, Member<Entry>>; |
| 51 |
| 52 // A module map is a map of absolute URLs to map entry. |
| 53 MapImpl m_map; |
| 54 |
| 55 Member<Modulator> m_modulator; |
| 56 }; |
| 57 |
| 58 } // namespace blink |
| 59 |
| 60 #endif |
OLD | NEW |