| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef Modulator_h | 5 #ifndef Modulator_h |
| 6 #define Modulator_h | 6 #define Modulator_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "bindings/core/v8/V8PerContextData.h" | 9 #include "bindings/core/v8/V8PerContextData.h" |
| 10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 // Asynchronously retrieve a module script from the module map, or fetch it | 83 // Asynchronously retrieve a module script from the module map, or fetch it |
| 84 // and put it in the map if it's not there already. | 84 // and put it in the map if it's not there already. |
| 85 // https://html.spec.whatwg.org/#fetch-a-single-module-script | 85 // https://html.spec.whatwg.org/#fetch-a-single-module-script |
| 86 virtual void FetchSingle(const ModuleScriptFetchRequest&, | 86 virtual void FetchSingle(const ModuleScriptFetchRequest&, |
| 87 ModuleGraphLevel, | 87 ModuleGraphLevel, |
| 88 SingleModuleClient*) = 0; | 88 SingleModuleClient*) = 0; |
| 89 | 89 |
| 90 // Synchronously retrieves a single module script from existing module map | 90 // Synchronously retrieves a single module script from existing module map |
| 91 // entry. | 91 // entry. |
| 92 // Note: returns nullptr if the module map entry is still "fetching". |
| 92 virtual ModuleScript* GetFetchedModuleScript(const KURL&) = 0; | 93 virtual ModuleScript* GetFetchedModuleScript(const KURL&) = 0; |
| 93 | 94 |
| 94 // https://html.spec.whatwg.org/#resolve-a-module-specifier | 95 // https://html.spec.whatwg.org/#resolve-a-module-specifier |
| 95 static KURL ResolveModuleSpecifier(const String& module_request, | 96 static KURL ResolveModuleSpecifier(const String& module_request, |
| 96 const KURL& base_url); | 97 const KURL& base_url); |
| 97 | 98 |
| 98 virtual ScriptModule CompileModule(const String& script, | 99 virtual ScriptModule CompileModule(const String& script, |
| 99 const String& url_str, | 100 const String& url_str, |
| 100 AccessControlStatus) = 0; | 101 AccessControlStatus) = 0; |
| 101 | 102 |
| 102 virtual ScriptValue InstantiateModule(ScriptModule) = 0; | 103 virtual ScriptValue InstantiateModule(ScriptModule) = 0; |
| 103 | 104 |
| 104 virtual Vector<String> ModuleRequestsFromScriptModule(ScriptModule) = 0; | 105 virtual Vector<String> ModuleRequestsFromScriptModule(ScriptModule) = 0; |
| 105 | 106 |
| 106 private: | 107 private: |
| 107 friend class ModuleMap; | 108 friend class ModuleMap; |
| 108 | 109 |
| 109 // Fetches a single module script. | 110 // Fetches a single module script. |
| 110 // This is triggered from fetchSingle() implementation (which is in ModuleMap) | 111 // This is triggered from fetchSingle() implementation (which is in ModuleMap) |
| 111 // if the cached entry doesn't exist. | 112 // if the cached entry doesn't exist. |
| 112 // The client can be notified either synchronously or asynchronously. | 113 // The client can be notified either synchronously or asynchronously. |
| 113 virtual void FetchNewSingleModule(const ModuleScriptFetchRequest&, | 114 virtual void FetchNewSingleModule(const ModuleScriptFetchRequest&, |
| 114 ModuleGraphLevel, | 115 ModuleGraphLevel, |
| 115 ModuleScriptLoaderClient*) = 0; | 116 ModuleScriptLoaderClient*) = 0; |
| 116 }; | 117 }; |
| 117 | 118 |
| 118 } // namespace blink | 119 } // namespace blink |
| 119 | 120 |
| 120 #endif | 121 #endif |
| OLD | NEW |