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

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

Issue 2555653002: [WIP Prototype] ES6 https://html.spec.whatwg.org/#fetch-a-single-module-script implementation (Closed)
Patch Set: snapshot 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/BUILD.gn ('k') | third_party/WebKit/Source/core/dom/Modulator.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/Modulator.h
diff --git a/third_party/WebKit/Source/core/dom/Modulator.h b/third_party/WebKit/Source/core/dom/Modulator.h
index 6f923196ec8333e0e90fe4fddcd3d2ff2b5dd196..0a688dd0f58b369360055c7324e2f9323723dd0c 100644
--- a/third_party/WebKit/Source/core/dom/Modulator.h
+++ b/third_party/WebKit/Source/core/dom/Modulator.h
@@ -6,12 +6,41 @@
#define Modulator_h
#include "core/CoreExport.h"
+#include "core/dom/AncestorList.h"
#include "platform/heap/Handle.h"
#include "platform/weborigin/KURL.h"
+#include "platform/weborigin/ReferrerPolicy.h"
+#include "wtf/text/WTFString.h"
namespace blink {
+class ExecutionContext;
class LocalFrame;
+class ModuleScript;
+class ModuleScriptLoaderClient;
+class ScriptModule;
+class ScriptModuleResolver;
+class ScriptValue;
+class WebTaskRunner;
+class ModuleScriptFetchRequest;
+
+// A SingleModuleClient is notified when single module script node (node as in a
+// module tree graph) load is complete and its corresponding entry is created in
+// module map.
+class SingleModuleClient : public GarbageCollectedMixin {
+ public:
+ virtual void notifyModuleLoadFinished(ModuleScript*) = 0;
+};
+
+// A ModuleTreeClient is notified when a module script and its whole descendent
+// tree load is complete.
+class ModuleTreeClient : public GarbageCollectedMixin {
+ public:
+ virtual void notifyModuleTreeLoadFinished(ModuleScript*) = 0;
+};
+
+// spec: "top-level module fetch flag"
+enum class ModuleGraphLevel { TopLevelModuleFetch, DependentModuleFetch };
// A Modulator is an interface for "environment settings object" concept for
// module scripts.
@@ -22,9 +51,55 @@ class CORE_EXPORT Modulator : public GarbageCollectedMixin {
public:
static Modulator* from(LocalFrame*);
+ virtual ScriptModuleResolver* scriptModuleResolver() = 0;
+ virtual WebTaskRunner* taskRunner() = 0;
+ virtual ExecutionContext* executionContext() = 0;
+ virtual ReferrerPolicy referrerPolicy() = 0;
+
+ // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-script-tree
+ virtual void fetchTree(const ModuleScriptFetchRequest&,
+ ModuleTreeClient*) = 0;
+
+ // https://html.spec.whatwg.org/#internal-module-script-graph-fetching-procedure
+ virtual void fetchTreeInternal(const ModuleScriptFetchRequest&,
+ const AncestorList&,
+ ModuleGraphLevel,
+ ModuleTreeClient*) = 0;
+
+ // Asynchronously retrieve a module script from the module map, or fetch it
+ // and put it in the map if it's not there already.
+ // https://html.spec.whatwg.org/#fetch-a-single-module-script
+ virtual void fetchSingle(const ModuleScriptFetchRequest&,
+ ModuleGraphLevel,
+ SingleModuleClient*) = 0;
+
+ // Synchronously retrieves a single module script from existing module map
+ // entry.
+ virtual ModuleScript* retrieveFetchedModuleScript(const KURL&) = 0;
+
// https://html.spec.whatwg.org/#resolve-a-module-specifier
static KURL resolveModuleSpecifier(const String& moduleRequest,
const KURL& baseURL);
+
+ // TODO(kouhei): script should be a ScriptSourceCode.
+ virtual ScriptModule compileModule(const String& script,
+ const String& urlStr) = 0;
+
+ virtual ScriptValue instantiateModule(ScriptModule) = 0;
+
+ virtual Vector<String> moduleRequestsFromScriptModule(ScriptModule) = 0;
+
+ virtual void executeModule(ScriptModule) = 0;
+
+ private:
+ friend class ModuleMap;
+
+ // Asynchronously fetches a single module script.
+ // This is triggered from fetchSingle() implementation (which is ModuleMap) if
+ // the cached entry doesn't exist.
+ virtual void fetchNewSingleModule(const ModuleScriptFetchRequest&,
+ ModuleGraphLevel,
+ ModuleScriptLoaderClient*) = 0;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/dom/BUILD.gn ('k') | third_party/WebKit/Source/core/dom/Modulator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698