Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: third_party/WebKit/Source/core/dom/Modulator.h

Issue 2704323002: [ES6 modules] Introduce ModuleMap (Closed)
Patch Set: no core expor Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
30 // https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-is-to p-level
31 enum class ModuleGraphLevel { TopLevelModuleFetch, DependentModuleFetch };
15 32
16 // A Modulator is an interface for "environment settings object" concept for 33 // A Modulator is an interface for "environment settings object" concept for
17 // module scripts. 34 // module scripts.
18 // https://html.spec.whatwg.org/#environment-settings-object 35 // https://html.spec.whatwg.org/#environment-settings-object
19 // 36 //
20 // A Modulator also serves as an entry point for various module spec algorithms. 37 // A Modulator also serves as an entry point for various module spec algorithms.
21 class CORE_EXPORT Modulator : public GarbageCollectedMixin { 38 class CORE_EXPORT Modulator : public GarbageCollectedMixin {
22 public: 39 public:
23 static Modulator* from(LocalFrame*); 40 static Modulator* from(LocalFrame*);
24 41
42 virtual ScriptModuleResolver* scriptModuleResolver() = 0;
43 virtual WebTaskRunner* taskRunner() = 0;
44
25 // https://html.spec.whatwg.org/#resolve-a-module-specifier 45 // https://html.spec.whatwg.org/#resolve-a-module-specifier
26 static KURL resolveModuleSpecifier(const String& moduleRequest, 46 static KURL resolveModuleSpecifier(const String& moduleRequest,
27 const KURL& baseURL); 47 const KURL& baseURL);
48
49 private:
50 friend class ModuleMap;
51
52 // Fetches a single module script.
53 // This is triggered from fetchSingle() implementation (which is in ModuleMap)
54 // if the cached entry doesn't exist.
55 // The client can be notified either synchronously or asynchronously.
56 virtual void fetchNewSingleModule(const ModuleScriptFetchRequest&,
57 ModuleGraphLevel,
58 ModuleScriptLoaderClient*) = 0;
28 }; 59 };
29 60
30 } // namespace blink 61 } // namespace blink
31 62
32 #endif 63 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/BUILD.gn ('k') | third_party/WebKit/Source/core/dom/ModuleMap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698