Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/ScriptState.h |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptState.h b/third_party/WebKit/Source/bindings/core/v8/ScriptState.h |
| index b0b0fd8530be5f9b3711f8272a63d42d98737c63..f17e013cbaf08e0f7655bd9434ce25eddc46dd0b 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/ScriptState.h |
| +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptState.h |
| @@ -183,6 +183,40 @@ class ScriptStateProtectingContext { |
| ScopedPersistent<v8::Context> m_context; |
| }; |
| +class ScriptStateForErrorEvent { |
| + STACK_ALLOCATED(); |
| + WTF_MAKE_NONCOPYABLE(ScriptStateForErrorEvent); |
| + |
| + public: |
| + static ScriptStateForErrorEvent* current() { return s_topOfStack; } |
| + |
| + ScriptStateForErrorEvent(v8::Local<v8::Context> context) |
|
haraken
2016/11/02 01:40:18
Add explicit.
|
| + : m_prev(s_topOfStack), |
| + m_isolate(context->GetIsolate()), |
| + m_context(m_isolate, context) { |
| + s_topOfStack = this; |
| + } |
| + |
| + ~ScriptStateForErrorEvent() { |
| + s_topOfStack = s_topOfStack->m_prev; |
| + } |
| + |
| + ScriptState* scriptState() { |
| + return ScriptState::from(m_context.newLocal(m_isolate)); |
| + } |
| + |
| + v8::Local<v8::Context> context() const { |
| + return m_context.newLocal(m_isolate); |
| + } |
| + |
| + private: |
| + static ScriptStateForErrorEvent* s_topOfStack; |
| + ScriptStateForErrorEvent* m_prev; |
| + |
| + v8::Isolate* m_isolate; |
| + ScopedPersistent<v8::Context> m_context; |
|
haraken
2016/11/02 01:40:18
You can use v8::Local<v8::Context> because ScriptS
|
| +}; |
| + |
| } // namespace blink |
| #endif // ScriptState_h |