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

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

Issue 2803843002: Change Modulator functions to use ScriptState instead of LocalFrame (Closed)
Patch Set: Rebase Created 3 years, 8 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 "bindings/core/v8/V8PerContextData.h" 8 #include "bindings/core/v8/V8PerContextData.h"
9 #include "core/CoreExport.h" 9 #include "core/CoreExport.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
11 #include "platform/loader/fetch/AccessControlStatus.h" 11 #include "platform/loader/fetch/AccessControlStatus.h"
12 #include "platform/weborigin/KURL.h" 12 #include "platform/weborigin/KURL.h"
13 #include "platform/weborigin/ReferrerPolicy.h" 13 #include "platform/weborigin/ReferrerPolicy.h"
14 #include "wtf/text/WTFString.h" 14 #include "wtf/text/WTFString.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class LocalFrame;
19 class ModuleScript; 18 class ModuleScript;
20 class ModuleScriptFetchRequest; 19 class ModuleScriptFetchRequest;
21 class ModuleScriptLoaderClient; 20 class ModuleScriptLoaderClient;
22 class ScriptModule; 21 class ScriptModule;
23 class ScriptModuleResolver; 22 class ScriptModuleResolver;
23 class ScriptState;
24 class SecurityOrigin; 24 class SecurityOrigin;
25 class WebTaskRunner; 25 class WebTaskRunner;
26 26
27 // A SingleModuleClient is notified when single module script node (node as in a 27 // A SingleModuleClient is notified when single module script node (node as in a
28 // module tree graph) load is complete and its corresponding entry is created in 28 // module tree graph) load is complete and its corresponding entry is created in
29 // module map. 29 // module map.
30 class SingleModuleClient : public GarbageCollectedMixin { 30 class SingleModuleClient : public GarbageCollectedMixin {
31 public: 31 public:
32 virtual void notifyModuleLoadFinished(ModuleScript*) = 0; 32 virtual void notifyModuleLoadFinished(ModuleScript*) = 0;
33 }; 33 };
34 34
35 // spec: "top-level module fetch flag" 35 // spec: "top-level module fetch flag"
36 // https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-is-to p-level 36 // https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-is-to p-level
37 enum class ModuleGraphLevel { TopLevelModuleFetch, DependentModuleFetch }; 37 enum class ModuleGraphLevel { TopLevelModuleFetch, DependentModuleFetch };
38 38
39 // A Modulator is an interface for "environment settings object" concept for 39 // A Modulator is an interface for "environment settings object" concept for
40 // module scripts. 40 // module scripts.
41 // https://html.spec.whatwg.org/#environment-settings-object 41 // https://html.spec.whatwg.org/#environment-settings-object
42 // 42 //
43 // A Modulator also serves as an entry point for various module spec algorithms. 43 // A Modulator also serves as an entry point for various module spec algorithms.
44 class CORE_EXPORT Modulator : public GarbageCollectedFinalized<Modulator>, 44 class CORE_EXPORT Modulator : public GarbageCollectedFinalized<Modulator>,
45 public V8PerContextData::Data { 45 public V8PerContextData::Data {
46 USING_GARBAGE_COLLECTED_MIXIN(Modulator); 46 USING_GARBAGE_COLLECTED_MIXIN(Modulator);
47 47
48 public: 48 public:
49 static Modulator* from(LocalFrame*); 49 static Modulator* from(ScriptState*);
50 static Modulator* from(V8PerContextData*);
51 virtual ~Modulator(); 50 virtual ~Modulator();
52 51
53 static void setModulator(LocalFrame*, Modulator*); 52 static void setModulator(ScriptState*, Modulator*);
54 static void clearModulator(LocalFrame*); 53 static void clearModulator(ScriptState*);
55 54
56 DEFINE_INLINE_VIRTUAL_TRACE() {} 55 DEFINE_INLINE_VIRTUAL_TRACE() {}
57 56
58 virtual ScriptModuleResolver* scriptModuleResolver() = 0; 57 virtual ScriptModuleResolver* scriptModuleResolver() = 0;
59 virtual WebTaskRunner* taskRunner() = 0; 58 virtual WebTaskRunner* taskRunner() = 0;
60 virtual ReferrerPolicy referrerPolicy() = 0; 59 virtual ReferrerPolicy referrerPolicy() = 0;
61 virtual SecurityOrigin* securityOrigin() = 0; 60 virtual SecurityOrigin* securityOrigin() = 0;
62 61
63 // https://html.spec.whatwg.org/#resolve-a-module-specifier 62 // https://html.spec.whatwg.org/#resolve-a-module-specifier
64 static KURL resolveModuleSpecifier(const String& moduleRequest, 63 static KURL resolveModuleSpecifier(const String& moduleRequest,
(...skipping 11 matching lines...) Expand all
76 // if the cached entry doesn't exist. 75 // if the cached entry doesn't exist.
77 // The client can be notified either synchronously or asynchronously. 76 // The client can be notified either synchronously or asynchronously.
78 virtual void fetchNewSingleModule(const ModuleScriptFetchRequest&, 77 virtual void fetchNewSingleModule(const ModuleScriptFetchRequest&,
79 ModuleGraphLevel, 78 ModuleGraphLevel,
80 ModuleScriptLoaderClient*) = 0; 79 ModuleScriptLoaderClient*) = 0;
81 }; 80 };
82 81
83 } // namespace blink 82 } // namespace blink
84 83
85 #endif 84 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptModuleTest.cpp ('k') | third_party/WebKit/Source/core/dom/Modulator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698