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" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class LocalFrame; | 14 class LocalFrame; |
| 15 class ModuleScript; | |
| 16 class ModuleScriptFetchRequest; | |
| 17 class ModuleScriptLoaderClient; | |
| 18 class ScriptModuleResolver; | |
| 19 class WebTaskRunner; | |
| 20 | |
| 21 // A SingleModuleClient is notified when single module script node (node as in a | |
| 22 // module tree graph) load is complete and its corresponding entry is created in | |
| 23 // module map. | |
| 24 class SingleModuleClient : public GarbageCollectedMixin { | |
| 25 public: | |
| 26 virtual void notifyModuleLoadFinished(ModuleScript*) = 0; | |
| 27 }; | |
| 28 | |
| 29 // spec: "top-level module fetch flag" | |
|
hiroshige
2017/02/22 01:21:30
+link?
kouhei (in TOK)
2017/02/22 07:08:04
Done.
| |
| 30 enum class ModuleGraphLevel { TopLevelModuleFetch, DependentModuleFetch }; | |
| 15 | 31 |
| 16 // A Modulator is an interface for "environment settings object" concept for | 32 // A Modulator is an interface for "environment settings object" concept for |
| 17 // module scripts. | 33 // module scripts. |
| 18 // https://html.spec.whatwg.org/#environment-settings-object | 34 // https://html.spec.whatwg.org/#environment-settings-object |
| 19 // | 35 // |
| 20 // A Modulator also serves as an entry point for various module spec algorithms. | 36 // A Modulator also serves as an entry point for various module spec algorithms. |
| 21 class CORE_EXPORT Modulator : public GarbageCollectedMixin { | 37 class CORE_EXPORT Modulator : public GarbageCollectedMixin { |
| 22 public: | 38 public: |
| 23 static Modulator* from(LocalFrame*); | 39 static Modulator* from(LocalFrame*); |
| 24 | 40 |
| 41 virtual ScriptModuleResolver* scriptModuleResolver() = 0; | |
| 42 virtual WebTaskRunner* taskRunner() = 0; | |
| 43 | |
| 25 // https://html.spec.whatwg.org/#resolve-a-module-specifier | 44 // https://html.spec.whatwg.org/#resolve-a-module-specifier |
| 26 static KURL resolveModuleSpecifier(const String& moduleRequest, | 45 static KURL resolveModuleSpecifier(const String& moduleRequest, |
| 27 const KURL& baseURL); | 46 const KURL& baseURL); |
| 47 | |
| 48 private: | |
| 49 friend class ModuleMap; | |
| 50 | |
| 51 // Asynchronously fetches a single module script. | |
|
hiroshige
2017/02/22 01:21:29
If ModuleScriptLoader::fetch() can notify ModuleSc
kouhei (in TOK)
2017/02/22 07:08:04
Done.
| |
| 52 // This is triggered from fetchSingle() implementation (which is ModuleMap) if | |
|
hiroshige
2017/02/22 01:21:29
nit: s/which is/which is in/?
kouhei (in TOK)
2017/02/22 07:08:04
Done.
| |
| 53 // the cached entry doesn't exist. | |
| 54 virtual void fetchNewSingleModule(const ModuleScriptFetchRequest&, | |
| 55 ModuleGraphLevel, | |
| 56 ModuleScriptLoaderClient*) = 0; | |
| 28 }; | 57 }; |
| 29 | 58 |
| 30 } // namespace blink | 59 } // namespace blink |
| 31 | 60 |
| 32 #endif | 61 #endif |
| OLD | NEW |