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

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

Issue 2795593006: Abstract out Modulator from V8PerContextData (Closed)
Patch Set: Fix tests 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 "core/CoreExport.h" 9 #include "core/CoreExport.h"
9 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
10 #include "platform/loader/fetch/AccessControlStatus.h" 11 #include "platform/loader/fetch/AccessControlStatus.h"
11 #include "platform/weborigin/KURL.h" 12 #include "platform/weborigin/KURL.h"
12 #include "platform/weborigin/ReferrerPolicy.h" 13 #include "platform/weborigin/ReferrerPolicy.h"
13 #include "wtf/text/WTFString.h" 14 #include "wtf/text/WTFString.h"
14 15
15 namespace blink { 16 namespace blink {
16 17
17 class LocalFrame; 18 class LocalFrame;
(...skipping 15 matching lines...) Expand all
33 34
34 // spec: "top-level module fetch flag" 35 // spec: "top-level module fetch flag"
35 // 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
36 enum class ModuleGraphLevel { TopLevelModuleFetch, DependentModuleFetch }; 37 enum class ModuleGraphLevel { TopLevelModuleFetch, DependentModuleFetch };
37 38
38 // A Modulator is an interface for "environment settings object" concept for 39 // A Modulator is an interface for "environment settings object" concept for
39 // module scripts. 40 // module scripts.
40 // https://html.spec.whatwg.org/#environment-settings-object 41 // https://html.spec.whatwg.org/#environment-settings-object
41 // 42 //
42 // 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.
43 class CORE_EXPORT Modulator : public GarbageCollectedFinalized<Modulator> { 44 class CORE_EXPORT Modulator : public GarbageCollectedFinalized<Modulator>,
45 public V8PerContextData::Data {
46 USING_GARBAGE_COLLECTED_MIXIN(Modulator);
47
44 public: 48 public:
45 static Modulator* from(LocalFrame*); 49 static Modulator* from(LocalFrame*);
50 static Modulator* from(V8PerContextData*);
46 virtual ~Modulator(); 51 virtual ~Modulator();
47 52
53 static void setModulator(LocalFrame*, Modulator*);
54 static void clearModulator(LocalFrame*);
55
48 DEFINE_INLINE_VIRTUAL_TRACE() {} 56 DEFINE_INLINE_VIRTUAL_TRACE() {}
49 57
50 virtual ScriptModuleResolver* scriptModuleResolver() = 0; 58 virtual ScriptModuleResolver* scriptModuleResolver() = 0;
51 virtual WebTaskRunner* taskRunner() = 0; 59 virtual WebTaskRunner* taskRunner() = 0;
52 virtual ReferrerPolicy referrerPolicy() = 0; 60 virtual ReferrerPolicy referrerPolicy() = 0;
53 virtual SecurityOrigin* securityOrigin() = 0; 61 virtual SecurityOrigin* securityOrigin() = 0;
54 62
55 // https://html.spec.whatwg.org/#resolve-a-module-specifier 63 // https://html.spec.whatwg.org/#resolve-a-module-specifier
56 static KURL resolveModuleSpecifier(const String& moduleRequest, 64 static KURL resolveModuleSpecifier(const String& moduleRequest,
57 const KURL& baseURL); 65 const KURL& baseURL);
(...skipping 10 matching lines...) Expand all
68 // if the cached entry doesn't exist. 76 // if the cached entry doesn't exist.
69 // The client can be notified either synchronously or asynchronously. 77 // The client can be notified either synchronously or asynchronously.
70 virtual void fetchNewSingleModule(const ModuleScriptFetchRequest&, 78 virtual void fetchNewSingleModule(const ModuleScriptFetchRequest&,
71 ModuleGraphLevel, 79 ModuleGraphLevel,
72 ModuleScriptLoaderClient*) = 0; 80 ModuleScriptLoaderClient*) = 0;
73 }; 81 };
74 82
75 } // namespace blink 83 } // namespace blink
76 84
77 #endif 85 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8PerContextData.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