Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1709)

Unified Diff: third_party/WebKit/Source/core/dom/ModuleMap.h

Issue 2704323002: [ES6 modules] Introduce ModuleMap (Closed)
Patch Set: no core expor Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/Modulator.h ('k') | third_party/WebKit/Source/core/dom/ModuleMap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..742bca5c9ba2b4308c1c84919e1f5a92ac46e7f3
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/ModuleMap.h
@@ -0,0 +1,60 @@
+// 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*);
+
+ // Synchronously get the ModuleScript for a given URL.
+ // Note: fetchSingleModuleScript of the ModuleScript must be complete before
+ // calling this.
+ ModuleScript* getFetchedModuleScript(const KURL&) const;
+
+ Modulator* modulator() { return m_modulator; }
+
+ private:
+ explicit ModuleMap(Modulator*);
+
+ 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Modulator.h ('k') | third_party/WebKit/Source/core/dom/ModuleMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698