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

Unified Diff: third_party/WebKit/Source/core/dom/ScriptModuleResolver.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
Index: third_party/WebKit/Source/core/dom/ScriptModuleResolver.h
diff --git a/third_party/WebKit/Source/core/dom/ScriptModuleResolver.h b/third_party/WebKit/Source/core/dom/ScriptModuleResolver.h
new file mode 100644
index 0000000000000000000000000000000000000000..72816c9b443375ae502db6e83278515fee2024f5
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/ScriptModuleResolver.h
@@ -0,0 +1,43 @@
+// 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 ScriptModuleResolver_h
+#define ScriptModuleResolver_h
+
+#include "bindings/core/v8/ExceptionState.h"
+#include "platform/heap/Handle.h"
+#include "wtf/text/WTFString.h"
+
+namespace blink {
+
+class ScriptModule;
+class ModuleScript;
+
+// The ScriptModuleResolver interface is used from V8 module bindings
+// when it need the ScriptModule's descendants.
+//
+// When a module writes import 'x', the module is called the referrer, 'x' is
+// the specifier, and the module identified by 'x' is the descendant.
+// ScriptModuleResolver, given a referrer and specifier, can look up the
+// descendant.
+class ScriptModuleResolver : public GarbageCollected<ScriptModuleResolver> {
+ public:
+ DEFINE_INLINE_VIRTUAL_TRACE() {}
+
+ // Notify the ScriptModuleResolver that a ModuleScript exists.
+ // This hook gives a chance for the resolver impl to populate module record
+ // identifier -> ModuleScript mapping entry.
+ virtual void registerModuleScript(ModuleScript*) = 0;
+
+ // Implements "Runtime Semantics: HostResolveImportedModule"
+ // https://tc39.github.io/ecma262/#sec-hostresolveimportedmodule
+ // This returns a null ScriptModule when an exception is thrown.
+ virtual ScriptModule resolve(const String& specifier,
+ const ScriptModule& referrer,
+ ExceptionState&) = 0;
+};
+
+} // namespace blink
+
+#endif // ScriptModuleResolver_h
« no previous file with comments | « third_party/WebKit/Source/core/dom/ModuleMapTest.cpp ('k') | third_party/WebKit/Source/core/testing/DummyModulator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698