| 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" |
| 11 #include "platform/bindings/V8PerContextData.h" | 11 #include "platform/bindings/V8PerContextData.h" |
| 12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 #include "platform/loader/fetch/AccessControlStatus.h" | 13 #include "platform/loader/fetch/AccessControlStatus.h" |
| 14 #include "platform/weborigin/KURL.h" | 14 #include "platform/weborigin/KURL.h" |
| 15 #include "platform/weborigin/ReferrerPolicy.h" | 15 #include "platform/weborigin/ReferrerPolicy.h" |
| 16 #include "platform/wtf/text/TextPosition.h" |
| 16 #include "platform/wtf/text/WTFString.h" | 17 #include "platform/wtf/text/WTFString.h" |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| 19 | 20 |
| 20 class ModuleScript; | 21 class ModuleScript; |
| 21 class ModuleScriptFetchRequest; | 22 class ModuleScriptFetchRequest; |
| 22 class ModuleScriptLoaderClient; | 23 class ModuleScriptLoaderClient; |
| 23 class ScriptModule; | 24 class ScriptModule; |
| 24 class ScriptModuleResolver; | 25 class ScriptModuleResolver; |
| 25 class ScriptState; | 26 class ScriptState; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 virtual ModuleScript* GetFetchedModuleScript(const KURL&) = 0; | 97 virtual ModuleScript* GetFetchedModuleScript(const KURL&) = 0; |
| 97 | 98 |
| 98 // https://html.spec.whatwg.org/#resolve-a-module-specifier | 99 // https://html.spec.whatwg.org/#resolve-a-module-specifier |
| 99 static KURL ResolveModuleSpecifier(const String& module_request, | 100 static KURL ResolveModuleSpecifier(const String& module_request, |
| 100 const KURL& base_url); | 101 const KURL& base_url); |
| 101 | 102 |
| 102 virtual bool HasValidContext() = 0; | 103 virtual bool HasValidContext() = 0; |
| 103 | 104 |
| 104 virtual ScriptModule CompileModule(const String& script, | 105 virtual ScriptModule CompileModule(const String& script, |
| 105 const String& url_str, | 106 const String& url_str, |
| 106 AccessControlStatus) = 0; | 107 AccessControlStatus, |
| 108 const TextPosition&) = 0; |
| 107 | 109 |
| 108 virtual ScriptValue InstantiateModule(ScriptModule) = 0; | 110 virtual ScriptValue InstantiateModule(ScriptModule) = 0; |
| 109 | 111 |
| 110 virtual ScriptValue GetInstantiationError(const ModuleScript*) = 0; | 112 virtual ScriptValue GetInstantiationError(const ModuleScript*) = 0; |
| 111 | 113 |
| 112 virtual Vector<String> ModuleRequestsFromScriptModule(ScriptModule) = 0; | 114 virtual Vector<String> ModuleRequestsFromScriptModule(ScriptModule) = 0; |
| 113 | 115 |
| 114 virtual void ExecuteModule(const ModuleScript*) = 0; | 116 virtual void ExecuteModule(const ModuleScript*) = 0; |
| 115 | 117 |
| 116 private: | 118 private: |
| 117 friend class ModuleMap; | 119 friend class ModuleMap; |
| 118 | 120 |
| 119 // Fetches a single module script. | 121 // Fetches a single module script. |
| 120 // This is triggered from fetchSingle() implementation (which is in ModuleMap) | 122 // This is triggered from fetchSingle() implementation (which is in ModuleMap) |
| 121 // if the cached entry doesn't exist. | 123 // if the cached entry doesn't exist. |
| 122 // The client can be notified either synchronously or asynchronously. | 124 // The client can be notified either synchronously or asynchronously. |
| 123 virtual void FetchNewSingleModule(const ModuleScriptFetchRequest&, | 125 virtual void FetchNewSingleModule(const ModuleScriptFetchRequest&, |
| 124 ModuleGraphLevel, | 126 ModuleGraphLevel, |
| 125 ModuleScriptLoaderClient*) = 0; | 127 ModuleScriptLoaderClient*) = 0; |
| 126 }; | 128 }; |
| 127 | 129 |
| 128 } // namespace blink | 130 } // namespace blink |
| 129 | 131 |
| 130 #endif | 132 #endif |
| OLD | NEW |