Index: third_party/WebKit/Source/core/dom/ScriptModuleResolverImpl.h |
diff --git a/third_party/WebKit/Source/core/dom/ScriptModuleResolverImpl.h b/third_party/WebKit/Source/core/dom/ScriptModuleResolverImpl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d54b3b517600ced8741dad9fd00173a2e4edd302 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/dom/ScriptModuleResolverImpl.h |
@@ -0,0 +1,47 @@ |
+// 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 ScriptModuleResolverImpl_h |
+#define ScriptModuleResolverImpl_h |
+ |
+#include "bindings/core/v8/ScriptModule.h" |
+#include "core/dom/ScriptModuleResolver.h" |
+#include "platform/heap/Handle.h" |
+#include "wtf/HashMap.h" |
+#include "wtf/text/WTFString.h" |
+ |
+namespace blink { |
+ |
+class Modulator; |
+class ModuleScript; |
+class ScriptModule; |
+ |
+class ScriptModuleResolverImpl final : public ScriptModuleResolver { |
+ public: |
+ static ScriptModuleResolverImpl* create(Modulator* modulator) { |
+ return new ScriptModuleResolverImpl(modulator); |
+ } |
+ |
+ DECLARE_VIRTUAL_TRACE(); |
+ |
+ // Implements ScriptModuleResolver: |
+ |
+ void registerModuleScript(ModuleScript*) override; |
+ // Implements "Runtime Semantics: HostResolveImportedModule" per HTML spec. |
+ // https://html.spec.whatwg.org/#hostresolveimportedmodule(referencingmodule,-specifier) |
+ ScriptModule resolve(const String& specifier, |
+ const ScriptModule& referrer, |
+ ExceptionState&) override; |
+ |
+ private: |
+ ScriptModuleResolverImpl(Modulator* modulator) : m_modulator(modulator) {} |
+ |
+ HeapHashMap<ScriptModule, Member<ModuleScript>> |
+ m_recordToModuleScriptMap; |
+ Member<Modulator> m_modulator; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // ScriptModuleResolverImpl_h |