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 ScriptModule_h | 5 #ifndef ScriptModule_h |
6 #define ScriptModule_h | 6 #define ScriptModule_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "bindings/core/v8/SharedPersistent.h" | 9 #include "bindings/core/v8/SharedPersistent.h" |
10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
| 11 #include "platform/loader/fetch/AccessControlStatus.h" |
11 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
12 #include "wtf/Allocator.h" | 13 #include "wtf/Allocator.h" |
13 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
14 #include "wtf/text/WTFString.h" | 15 #include "wtf/text/WTFString.h" |
15 | 16 |
16 namespace blink { | 17 namespace blink { |
17 | 18 |
18 // ScriptModule wraps a handle to a v8::Module for use in core. | 19 // ScriptModule wraps a handle to a v8::Module for use in core. |
19 // | 20 // |
20 // Using ScriptModules needs a ScriptState and its scope to operate in. You | 21 // Using ScriptModules needs a ScriptState and its scope to operate in. You |
21 // should always provide the same ScriptState and not try to reuse ScriptModules | 22 // should always provide the same ScriptState and not try to reuse ScriptModules |
22 // across different contexts. | 23 // across different contexts. |
23 // Currently all ScriptModule users can easily access its context Modulator, so | 24 // Currently all ScriptModule users can easily access its context Modulator, so |
24 // we use it to fill ScriptState in. | 25 // we use it to fill ScriptState in. |
25 class CORE_EXPORT ScriptModule final { | 26 class CORE_EXPORT ScriptModule final { |
26 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 27 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
27 | 28 |
28 public: | 29 public: |
29 static ScriptModule compile(v8::Isolate*, | 30 static ScriptModule compile(v8::Isolate*, |
30 const String& source, | 31 const String& source, |
31 const String& fileName); | 32 const String& fileName, |
| 33 AccessControlStatus); |
32 | 34 |
33 // TODO(kouhei): Remove copy ctor | 35 // TODO(kouhei): Remove copy ctor |
34 ScriptModule() {} | 36 ScriptModule() {} |
35 ScriptModule(WTF::HashTableDeletedValueType) | 37 ScriptModule(WTF::HashTableDeletedValueType) |
36 : m_module(WTF::HashTableDeletedValue) {} | 38 : m_module(WTF::HashTableDeletedValue) {} |
37 ~ScriptModule(); | 39 ~ScriptModule(); |
38 | 40 |
39 // Returns exception, if any. | 41 // Returns exception, if any. |
40 ScriptValue instantiate(ScriptState*); | 42 ScriptValue instantiate(ScriptState*); |
41 void evaluate(ScriptState*); | 43 void evaluate(ScriptState*); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 using Hash = blink::ScriptModuleHash; | 109 using Hash = blink::ScriptModuleHash; |
108 }; | 110 }; |
109 | 111 |
110 template <> | 112 template <> |
111 struct HashTraits<blink::ScriptModule> | 113 struct HashTraits<blink::ScriptModule> |
112 : public SimpleClassHashTraits<blink::ScriptModule> {}; | 114 : public SimpleClassHashTraits<blink::ScriptModule> {}; |
113 | 115 |
114 } // namespace WTF | 116 } // namespace WTF |
115 | 117 |
116 #endif // ScriptModule_h | 118 #endif // ScriptModule_h |
OLD | NEW |