Chromium Code Reviews| Index: Source/bindings/core/v8/ScriptValue.h |
| diff --git a/Source/bindings/core/v8/ScriptValue.h b/Source/bindings/core/v8/ScriptValue.h |
| index 7ad2aecaed7c51507d12e55ea33d1dd2cecd2704..73b366d0cbe4fd67e4690ed372e1f78c823ac2d0 100644 |
| --- a/Source/bindings/core/v8/ScriptValue.h |
| +++ b/Source/bindings/core/v8/ScriptValue.h |
| @@ -67,6 +67,14 @@ public: |
| ASSERT(isEmpty() || m_scriptState); |
| } |
| + template <typename T> |
| + ScriptValue(ScriptState* scriptState, v8::MaybeLocal<T> value) |
| + : m_scriptState(scriptState) |
| + , m_value(value.IsEmpty() ? nullptr : SharedPersistent<v8::Value>::create(value.ToLocalChecked(), scriptState->isolate())) |
| + { |
| + ASSERT(isEmpty() || m_scriptState); |
| + } |
| + |
| ScriptValue(const ScriptValue& value) |
| : m_scriptState(value.m_scriptState) |
| , m_value(value.m_value) |
| @@ -84,6 +92,11 @@ public: |
| return m_scriptState ? m_scriptState->isolate() : v8::Isolate::GetCurrent(); |
| } |
| + v8::Local<v8::Context> context() const |
| + { |
| + return m_scriptState ? isolate()->GetCurrentContext() : v8::Local<v8::Context>(); |
|
haraken
2015/03/25 04:29:59
This seems wrong. We need to use m_scriptState->co
bashi
2015/03/25 04:56:00
Done.
|
| + } |
| + |
| ScriptValue& operator=(const ScriptValue& value) |
| { |
| if (this != &value) { |