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

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: ModuleScriptLoaderTest Created 3 years, 11 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
new file mode 100644
index 0000000000000000000000000000000000000000..7cb39e85f2a57dd93e5e6d266c5a233bb8b71423
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/Modulator.h
@@ -0,0 +1,80 @@
+// 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 Modulator_h
+#define Modulator_h
+
+#include "core/CoreExport.h"
+#include "platform/heap/Handle.h"
+#include "platform/weborigin/KURL.h"
+
+namespace blink {
+
+class ModuleController;
+class ModuleScript;
+class ModuleScriptLoaderClient;
+class ScriptModuleResolver;
+class WebTaskRunner;
+
+// A SingleModuleClient is notified when single module script node load is
+// complete and its corresponding entry is created in module map.
+class SingleModuleClient : public GarbageCollectedMixin {
+ public:
+ virtual void notifyFinishedSingleModule(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 notifyFinishedModuleTree(ModuleScript*) = 0;
+};
+
+// A Modulator is an interface for "environment settings object" concept for
+// module scripts.
+// 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 {
+ public:
+ virtual ModuleController* moduleController() { return nullptr; }
+ virtual ScriptModuleResolver* scriptModuleResolver() { return nullptr; }
+ virtual WebTaskRunner* taskRunner() { return nullptr; };
+
+ // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-script-tree
+ virtual void fetchTree(const KURL&,
+ const KURL& baseURL,
+ ModuleTreeClient*) = 0;
+
+ // fetchSingle asynchronously retrieves a single module script from module
+ // map,
+ // or initiates its fetch if corresponding module map entry doesn't exist.
+ // https://html.spec.whatwg.org/#fetch-a-single-module-script
+ virtual void fetchSingle(
+ const KURL&,
+ const KURL& baseURL,
+ SingleModuleClient*
+ /*, a fetch client settings object, a destination, a cryptographic nonce, a parser state, a credentials mode, a module map settings object, a referrer, and a top-level module fetch flag*/) = 0;
+
+ // fetchNewSingleModule asynchronously fetches a single module script.
+ // This is triggered from fetchSingle() implementation if the cached entry
+ // doesn't exist.
+ virtual void fetchNewSingleModule(
+ const KURL&,
+ const KURL& baseURL,
+ ModuleScriptLoaderClient*
+ /*, a fetch client settings object, a destination, a cryptographic nonce, a parser state, a credentials mode, a module map settings object, a referrer, and a top-level module fetch flag*/) = 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);
+};
+
+} // namespace blink
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698