| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ScriptState_h | 5 #ifndef ScriptState_h |
| 6 #define ScriptState_h | 6 #define ScriptState_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
| 9 #include "bindings/core/v8/V8PerContextData.h" | 9 #include "bindings/core/v8/V8PerContextData.h" |
| 10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 static ScriptState* forReceiverObject( | 69 static ScriptState* forReceiverObject( |
| 70 const v8::FunctionCallbackInfo<v8::Value>& info) { | 70 const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 71 return from(info.Holder()->CreationContext()); | 71 return from(info.Holder()->CreationContext()); |
| 72 } | 72 } |
| 73 | 73 |
| 74 static ScriptState* forReceiverObject( | 74 static ScriptState* forReceiverObject( |
| 75 const v8::PropertyCallbackInfo<v8::Value>& info) { | 75 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 76 return from(info.Holder()->CreationContext()); | 76 return from(info.Holder()->CreationContext()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 static ScriptState* forReceiverObject( |
| 80 const v8::PropertyCallbackInfo<void>& info) { |
| 81 return from(info.Holder()->CreationContext()); |
| 82 } |
| 83 |
| 79 // Debugger context doesn't have associated ScriptState and when current | 84 // Debugger context doesn't have associated ScriptState and when current |
| 80 // context is debugger it should be treated as if context stack was empty. | 85 // context is debugger it should be treated as if context stack was empty. |
| 81 static bool hasCurrentScriptState(v8::Isolate* isolate) { | 86 static bool hasCurrentScriptState(v8::Isolate* isolate) { |
| 82 v8::HandleScope scope(isolate); | 87 v8::HandleScope scope(isolate); |
| 83 v8::Local<v8::Context> context = isolate->GetCurrentContext(); | 88 v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
| 84 if (context.IsEmpty()) | 89 if (context.IsEmpty()) |
| 85 return false; | 90 return false; |
| 86 return context != v8::Debug::GetDebugContext(isolate); | 91 return context != v8::Debug::GetDebugContext(isolate); |
| 87 } | 92 } |
| 88 | 93 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 179 } |
| 175 | 180 |
| 176 private: | 181 private: |
| 177 RefPtr<ScriptState> m_scriptState; | 182 RefPtr<ScriptState> m_scriptState; |
| 178 ScopedPersistent<v8::Context> m_context; | 183 ScopedPersistent<v8::Context> m_context; |
| 179 }; | 184 }; |
| 180 | 185 |
| 181 } // namespace blink | 186 } // namespace blink |
| 182 | 187 |
| 183 #endif // ScriptState_h | 188 #endif // ScriptState_h |
| OLD | NEW |