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

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: rebased Created 3 years, 9 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/Modulator.h
diff --git a/third_party/WebKit/Source/core/dom/Modulator.h b/third_party/WebKit/Source/core/dom/Modulator.h
index 353c99511ea9f0a7798fa42629f7b07dd88e6e44..9eb91944eb17abeffc2e418763cd42d13b107cf6 100644
--- a/third_party/WebKit/Source/core/dom/Modulator.h
+++ b/third_party/WebKit/Source/core/dom/Modulator.h
@@ -5,7 +5,9 @@
#ifndef Modulator_h
#define Modulator_h
+#include "bindings/core/v8/ScriptWrappable.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"
@@ -13,12 +15,14 @@
namespace blink {
+class ExecutionContext;
class LocalFrame;
class ModuleScript;
class ModuleScriptFetchRequest;
class ModuleScriptLoaderClient;
class ScriptModule;
class ScriptModuleResolver;
+class ScriptValue;
class SecurityOrigin;
class WebTaskRunner;
@@ -30,6 +34,13 @@ class SingleModuleClient : public GarbageCollectedMixin {
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"
// https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-is-top-level
enum class ModuleGraphLevel { TopLevelModuleFetch, DependentModuleFetch };
@@ -39,15 +50,40 @@ enum class ModuleGraphLevel { TopLevelModuleFetch, DependentModuleFetch };
// https://html.spec.whatwg.org/#environment-settings-object
//
// A Modulator also serves as an entry point for various module spec algorithms.
-class CORE_EXPORT Modulator : public GarbageCollectedMixin {
+class CORE_EXPORT Modulator : public GarbageCollectedFinalized<Modulator>, public TraceWrapperBase {
public:
static Modulator* from(LocalFrame*);
+ virtual ~Modulator();
+
+ DEFINE_INLINE_VIRTUAL_TRACE() {}
virtual ScriptModuleResolver* scriptModuleResolver() = 0;
virtual WebTaskRunner* taskRunner() = 0;
+ virtual ExecutionContext* executionContext() = 0;
virtual ReferrerPolicy referrerPolicy() = 0;
virtual SecurityOrigin* securityOrigin() = 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* getFetchedModuleScript(const KURL&) = 0;
+
// https://html.spec.whatwg.org/#resolve-a-module-specifier
static KURL resolveModuleSpecifier(const String& moduleRequest,
const KURL& baseURL);
@@ -55,6 +91,12 @@ class CORE_EXPORT Modulator : public GarbageCollectedMixin {
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;

Powered by Google App Engine
This is Rietveld 408576698