| 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" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 const String& fileName); | 30 const String& fileName); |
| 31 | 31 |
| 32 ScriptModule() {} | 32 ScriptModule() {} |
| 33 ScriptModule(const ScriptModule& module) : m_module(module.m_module) {} | 33 ScriptModule(const ScriptModule& module) : m_module(module.m_module) {} |
| 34 ~ScriptModule(); | 34 ~ScriptModule(); |
| 35 | 35 |
| 36 // Returns exception, if any. | 36 // Returns exception, if any. |
| 37 ScriptValue instantiate(ScriptState*); | 37 ScriptValue instantiate(ScriptState*); |
| 38 void evaluate(ScriptState*); | 38 void evaluate(ScriptState*); |
| 39 | 39 |
| 40 bool isNull() const { return m_module->isEmpty(); } | 40 bool isNull() const { return !m_module || m_module->isEmpty(); } |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 ScriptModule(v8::Isolate*, v8::Local<v8::Module>); | 43 ScriptModule(v8::Isolate*, v8::Local<v8::Module>); |
| 44 | 44 |
| 45 static v8::MaybeLocal<v8::Module> resolveModuleCallback( | 45 static v8::MaybeLocal<v8::Module> resolveModuleCallback( |
| 46 v8::Local<v8::Context>, | 46 v8::Local<v8::Context>, |
| 47 v8::Local<v8::String> specifier, | 47 v8::Local<v8::String> specifier, |
| 48 v8::Local<v8::Module> referrer); | 48 v8::Local<v8::Module> referrer); |
| 49 | 49 |
| 50 RefPtr<SharedPersistent<v8::Module>> m_module; | 50 RefPtr<SharedPersistent<v8::Module>> m_module; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace blink | 53 } // namespace blink |
| 54 | 54 |
| 55 #endif // ScriptModule_h | 55 #endif // ScriptModule_h |
| OLD | NEW |