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 ScriptModuleResolverImpl_h |
| 6 #define ScriptModuleResolverImpl_h |
| 7 |
| 8 #include "bindings/core/v8/ScriptModule.h" |
| 9 #include "core/dom/ScriptModuleResolver.h" |
| 10 #include "platform/heap/Handle.h" |
| 11 #include "wtf/HashMap.h" |
| 12 #include "wtf/text/WTFString.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 class Modulator; |
| 17 class ModuleScript; |
| 18 class ScriptModule; |
| 19 |
| 20 class ScriptModuleResolverImpl final : public ScriptModuleResolver { |
| 21 public: |
| 22 static ScriptModuleResolverImpl* create(Modulator* modulator) { |
| 23 return new ScriptModuleResolverImpl(modulator); |
| 24 } |
| 25 |
| 26 DECLARE_VIRTUAL_TRACE(); |
| 27 |
| 28 // Implements ScriptModuleResolver: |
| 29 |
| 30 void registerModuleScript(ModuleScript*) override; |
| 31 // Implements "Runtime Semantics: HostResolveImportedModule" per HTML spec. |
| 32 // https://html.spec.whatwg.org/#hostresolveimportedmodule(referencingmodule,-
specifier) |
| 33 ScriptModule resolve(const String& specifier, |
| 34 const ScriptModule& referrer, |
| 35 ExceptionState&) override; |
| 36 |
| 37 private: |
| 38 ScriptModuleResolverImpl(Modulator* modulator) : m_modulator(modulator) {} |
| 39 |
| 40 HeapHashMap<ScriptModule, Member<ModuleScript>> |
| 41 m_recordToModuleScriptMap; |
| 42 Member<Modulator> m_modulator; |
| 43 }; |
| 44 |
| 45 } // namespace blink |
| 46 |
| 47 #endif // ScriptModuleResolverImpl_h |
OLD | NEW |