Chromium Code Reviews| 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 "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 #include "platform/weborigin/KURL.h" | 10 #include "platform/weborigin/KURL.h" |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 | 32 |
| 33 // spec: "top-level module fetch flag" | 33 // spec: "top-level module fetch flag" |
| 34 // https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-is-to p-level | 34 // https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-is-to p-level |
| 35 enum class ModuleGraphLevel { TopLevelModuleFetch, DependentModuleFetch }; | 35 enum class ModuleGraphLevel { TopLevelModuleFetch, DependentModuleFetch }; |
| 36 | 36 |
| 37 // A Modulator is an interface for "environment settings object" concept for | 37 // A Modulator is an interface for "environment settings object" concept for |
| 38 // module scripts. | 38 // module scripts. |
| 39 // https://html.spec.whatwg.org/#environment-settings-object | 39 // https://html.spec.whatwg.org/#environment-settings-object |
| 40 // | 40 // |
| 41 // A Modulator also serves as an entry point for various module spec algorithms. | 41 // A Modulator also serves as an entry point for various module spec algorithms. |
| 42 class CORE_EXPORT Modulator : public GarbageCollectedMixin { | 42 class CORE_EXPORT Modulator : public GarbageCollectedFinalized<Modulator> { |
|
yhirano
2017/03/30 07:22:42
Is "Finalized" needed?
| |
| 43 public: | 43 public: |
| 44 static Modulator* from(LocalFrame*); | 44 static Modulator* from(LocalFrame*); |
| 45 virtual ~Modulator(); | |
| 46 | |
| 47 DEFINE_INLINE_VIRTUAL_TRACE() {} | |
| 45 | 48 |
| 46 virtual ScriptModuleResolver* scriptModuleResolver() = 0; | 49 virtual ScriptModuleResolver* scriptModuleResolver() = 0; |
| 47 virtual WebTaskRunner* taskRunner() = 0; | 50 virtual WebTaskRunner* taskRunner() = 0; |
| 48 virtual ReferrerPolicy referrerPolicy() = 0; | 51 virtual ReferrerPolicy referrerPolicy() = 0; |
| 49 virtual SecurityOrigin* securityOrigin() = 0; | 52 virtual SecurityOrigin* securityOrigin() = 0; |
| 50 | 53 |
| 51 // https://html.spec.whatwg.org/#resolve-a-module-specifier | 54 // https://html.spec.whatwg.org/#resolve-a-module-specifier |
| 52 static KURL resolveModuleSpecifier(const String& moduleRequest, | 55 static KURL resolveModuleSpecifier(const String& moduleRequest, |
| 53 const KURL& baseURL); | 56 const KURL& baseURL); |
| 54 | 57 |
| 55 virtual ScriptModule compileModule(const String& script, | 58 virtual ScriptModule compileModule(const String& script, |
| 56 const String& urlStr) = 0; | 59 const String& urlStr) = 0; |
| 57 | 60 |
| 58 private: | 61 private: |
| 59 friend class ModuleMap; | 62 friend class ModuleMap; |
| 60 | 63 |
| 61 // Fetches a single module script. | 64 // Fetches a single module script. |
| 62 // This is triggered from fetchSingle() implementation (which is in ModuleMap) | 65 // This is triggered from fetchSingle() implementation (which is in ModuleMap) |
| 63 // if the cached entry doesn't exist. | 66 // if the cached entry doesn't exist. |
| 64 // The client can be notified either synchronously or asynchronously. | 67 // The client can be notified either synchronously or asynchronously. |
| 65 virtual void fetchNewSingleModule(const ModuleScriptFetchRequest&, | 68 virtual void fetchNewSingleModule(const ModuleScriptFetchRequest&, |
| 66 ModuleGraphLevel, | 69 ModuleGraphLevel, |
| 67 ModuleScriptLoaderClient*) = 0; | 70 ModuleScriptLoaderClient*) = 0; |
| 68 }; | 71 }; |
| 69 | 72 |
| 70 } // namespace blink | 73 } // namespace blink |
| 71 | 74 |
| 72 #endif | 75 #endif |
| OLD | NEW |