OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef Modulator_h |
| 6 #define Modulator_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "platform/heap/Handle.h" |
| 10 #include "platform/weborigin/KURL.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class ModuleController; |
| 15 class ModuleScript; |
| 16 class ModuleScriptLoaderClient; |
| 17 class ScriptModuleResolver; |
| 18 class WebTaskRunner; |
| 19 |
| 20 // A SingleModuleClient is notified when single module script node load is |
| 21 // complete and its corresponding entry is created in module map. |
| 22 class SingleModuleClient : public GarbageCollectedMixin { |
| 23 public: |
| 24 virtual void notifyFinishedSingleModule(ModuleScript*) = 0; |
| 25 }; |
| 26 |
| 27 // A ModuleTreeClient is notified when a module script and its whole descendent |
| 28 // tree load is complete. |
| 29 class ModuleTreeClient : public GarbageCollectedMixin { |
| 30 public: |
| 31 virtual void notifyFinishedModuleTree(ModuleScript*) = 0; |
| 32 }; |
| 33 |
| 34 // A Modulator is an interface for "environment settings object" concept for |
| 35 // module scripts. |
| 36 // https://html.spec.whatwg.org/#environment-settings-object |
| 37 // |
| 38 // A Modulator also serves as an entry point for various module spec algorithms. |
| 39 class CORE_EXPORT Modulator : public GarbageCollectedMixin { |
| 40 public: |
| 41 virtual ModuleController* moduleController() { return nullptr; } |
| 42 virtual ScriptModuleResolver* scriptModuleResolver() { return nullptr; } |
| 43 virtual WebTaskRunner* taskRunner() { return nullptr; }; |
| 44 |
| 45 // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-scrip
t-tree |
| 46 virtual void fetchTree(const KURL&, |
| 47 const KURL& baseURL, |
| 48 ModuleTreeClient*) = 0; |
| 49 |
| 50 // fetchSingle asynchronously retrieves a single module script from module |
| 51 // map, |
| 52 // or initiates its fetch if corresponding module map entry doesn't exist. |
| 53 // https://html.spec.whatwg.org/#fetch-a-single-module-script |
| 54 virtual void fetchSingle( |
| 55 const KURL&, |
| 56 const KURL& baseURL, |
| 57 SingleModuleClient* |
| 58 /*, a fetch client settings object, a destination, a cryptographic nonce,
a parser state, a credentials mode, a module map settings object, a referrer, an
d a top-level module fetch flag*/) = 0; |
| 59 |
| 60 // fetchNewSingleModule asynchronously fetches a single module script. |
| 61 // This is triggered from fetchSingle() implementation if the cached entry |
| 62 // doesn't exist. |
| 63 virtual void fetchNewSingleModule( |
| 64 const KURL&, |
| 65 const KURL& baseURL, |
| 66 ModuleScriptLoaderClient* |
| 67 /*, a fetch client settings object, a destination, a cryptographic nonce,
a parser state, a credentials mode, a module map settings object, a referrer, an
d a top-level module fetch flag*/) = 0; |
| 68 |
| 69 // Synchronously retrieves a single module script from existing module map |
| 70 // entry. |
| 71 virtual ModuleScript* retrieveFetchedModuleScript(const KURL&) = 0; |
| 72 |
| 73 // https://html.spec.whatwg.org/#resolve-a-module-specifier |
| 74 static KURL resolveModuleSpecifier(const String& moduleRequest, |
| 75 const KURL& baseURL); |
| 76 }; |
| 77 |
| 78 } // namespace blink |
| 79 |
| 80 #endif |
OLD | NEW |