Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/ModuleMap.h |
| diff --git a/third_party/WebKit/Source/core/dom/ModuleMap.h b/third_party/WebKit/Source/core/dom/ModuleMap.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b94ed0c07d33ba7cfce038386a12e846e03aba30 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/dom/ModuleMap.h |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ModuleMap_h |
| +#define ModuleMap_h |
| + |
| +#include "core/CoreExport.h" |
| +#include "platform/heap/Handle.h" |
| +#include "platform/weborigin/KURL.h" |
| +#include "platform/weborigin/KURLHash.h" |
| +#include "wtf/HashMap.h" |
| + |
| +namespace blink { |
| + |
| +class Modulator; |
| +class ModuleScript; |
| +class ModuleScriptFetchRequest; |
| +class SingleModuleClient; |
| +enum class ModuleGraphLevel; |
| + |
| +// A ModuleMap implements "module map" spec. |
| +// https://html.spec.whatwg.org/#module-map |
| +class CORE_EXPORT ModuleMap final : public GarbageCollected<ModuleMap> { |
| + WTF_MAKE_NONCOPYABLE(ModuleMap); |
| + class Entry; |
| + class LoaderHost; |
| + |
| + public: |
| + static ModuleMap* create(Modulator* modulator) { |
| + return new ModuleMap(modulator); |
| + } |
| + DECLARE_TRACE(); |
| + |
| + // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script |
| + void fetchSingleModuleScript(const ModuleScriptFetchRequest&, |
| + ModuleGraphLevel, |
| + SingleModuleClient*); |
| + ModuleScript* getFetchedModuleScript(const KURL&) const; |
|
yhirano
2017/02/22 09:10:42
Adding a comment for the DCHECK assumption would b
|
| + |
| + Modulator* modulator() { return m_modulator; } |
| + |
| + private: |
| + explicit ModuleMap(Modulator*); |
| + ModuleMap() = delete; |
|
yhirano
2017/02/22 09:10:42
Do we need this?
kouhei (in TOK)
2017/02/24 02:10:31
Removed
|
| + |
| + using MapImpl = HeapHashMap<KURL, Member<Entry>>; |
| + |
| + // A module map is a map of absolute URLs to map entry. |
| + MapImpl m_map; |
| + |
| + Member<Modulator> m_modulator; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif |