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 |