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 "v8/include/v8.h" | 11 #include "v8/include/v8.h" |
12 #include "wtf/Allocator.h" | 12 #include "wtf/Allocator.h" |
13 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class CORE_EXPORT ScriptModule final { | 17 class CORE_EXPORT ScriptModule final { |
18 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 18 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
19 | 19 |
20 public: | 20 public: |
21 static ScriptModule compile(v8::Isolate*, | 21 static ScriptModule compile(v8::Isolate*, |
22 const String& source, | 22 const String& source, |
23 const String& fileName); | 23 const String& fileName); |
24 | 24 |
25 ScriptModule() {} | 25 ScriptModule() {} |
26 ScriptModule(const ScriptModule& module) : m_module(module.m_module) {} | 26 ScriptModule(const ScriptModule& module) : m_module(module.m_module) {} |
27 ~ScriptModule(); | 27 ~ScriptModule(); |
28 | 28 |
29 bool instantiate(ScriptState*); | 29 ScriptValue instantiate(ScriptState*); |
neis
2017/03/30 06:38:40
Please add a comment saying that this returns the
kouhei (in TOK)
2017/03/30 07:13:54
Done.
| |
30 void evaluate(ScriptState*); | 30 void evaluate(ScriptState*); |
31 | 31 |
32 bool isNull() const { return m_module->isEmpty(); } | 32 bool isNull() const { return m_module->isEmpty(); } |
33 | 33 |
34 private: | 34 private: |
35 ScriptModule(v8::Isolate*, v8::Local<v8::Module>); | 35 ScriptModule(v8::Isolate*, v8::Local<v8::Module>); |
36 | 36 |
37 static v8::MaybeLocal<v8::Module> resolveModuleCallback( | |
38 v8::Local<v8::Context>, | |
39 v8::Local<v8::String> specifier, | |
40 v8::Local<v8::Module> referrer); | |
41 | |
37 RefPtr<SharedPersistent<v8::Module>> m_module; | 42 RefPtr<SharedPersistent<v8::Module>> m_module; |
38 }; | 43 }; |
39 | 44 |
40 } // namespace blink | 45 } // namespace blink |
41 | 46 |
42 #endif // ScriptModule_h | 47 #endif // ScriptModule_h |
OLD | NEW |