| 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 "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/dom/AncestorList.h" | 9 #include "core/dom/AncestorList.h" |
| 10 #include "platform/bindings/ScriptWrappable.h" | 10 #include "platform/bindings/ScriptWrappable.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // Synchronously retrieves a single module script from existing module map | 93 // Synchronously retrieves a single module script from existing module map |
| 94 // entry. | 94 // entry. |
| 95 // Note: returns nullptr if the module map entry is still "fetching". | 95 // Note: returns nullptr if the module map entry is still "fetching". |
| 96 virtual ModuleScript* GetFetchedModuleScript(const KURL&) = 0; | 96 virtual ModuleScript* GetFetchedModuleScript(const KURL&) = 0; |
| 97 | 97 |
| 98 // https://html.spec.whatwg.org/#resolve-a-module-specifier | 98 // https://html.spec.whatwg.org/#resolve-a-module-specifier |
| 99 static KURL ResolveModuleSpecifier(const String& module_request, | 99 static KURL ResolveModuleSpecifier(const String& module_request, |
| 100 const KURL& base_url); | 100 const KURL& base_url); |
| 101 | 101 |
| 102 virtual bool HasValidContext() = 0; |
| 103 |
| 102 virtual ScriptModule CompileModule(const String& script, | 104 virtual ScriptModule CompileModule(const String& script, |
| 103 const String& url_str, | 105 const String& url_str, |
| 104 AccessControlStatus) = 0; | 106 AccessControlStatus) = 0; |
| 105 | 107 |
| 106 virtual ScriptValue InstantiateModule(ScriptModule) = 0; | 108 virtual ScriptValue InstantiateModule(ScriptModule) = 0; |
| 107 | 109 |
| 108 virtual ScriptValue GetInstantiationError(const ModuleScript*) = 0; | 110 virtual ScriptValue GetInstantiationError(const ModuleScript*) = 0; |
| 109 | 111 |
| 110 virtual Vector<String> ModuleRequestsFromScriptModule(ScriptModule) = 0; | 112 virtual Vector<String> ModuleRequestsFromScriptModule(ScriptModule) = 0; |
| 111 | 113 |
| 112 virtual void ExecuteModule(const ModuleScript*) = 0; | 114 virtual void ExecuteModule(const ModuleScript*) = 0; |
| 113 | 115 |
| 114 private: | 116 private: |
| 115 friend class ModuleMap; | 117 friend class ModuleMap; |
| 116 | 118 |
| 117 // Fetches a single module script. | 119 // Fetches a single module script. |
| 118 // This is triggered from fetchSingle() implementation (which is in ModuleMap) | 120 // This is triggered from fetchSingle() implementation (which is in ModuleMap) |
| 119 // if the cached entry doesn't exist. | 121 // if the cached entry doesn't exist. |
| 120 // The client can be notified either synchronously or asynchronously. | 122 // The client can be notified either synchronously or asynchronously. |
| 121 virtual void FetchNewSingleModule(const ModuleScriptFetchRequest&, | 123 virtual void FetchNewSingleModule(const ModuleScriptFetchRequest&, |
| 122 ModuleGraphLevel, | 124 ModuleGraphLevel, |
| 123 ModuleScriptLoaderClient*) = 0; | 125 ModuleScriptLoaderClient*) = 0; |
| 124 }; | 126 }; |
| 125 | 127 |
| 126 } // namespace blink | 128 } // namespace blink |
| 127 | 129 |
| 128 #endif | 130 #endif |
| OLD | NEW |