| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 #include "src/inspector/v8-debugger.h" | 5 #include "src/inspector/v8-debugger.h" |
| 6 | 6 |
| 7 #include "src/inspector/debugger-script.h" | 7 #include "src/inspector/debugger-script.h" |
| 8 #include "src/inspector/protocol/Protocol.h" | 8 #include "src/inspector/protocol/Protocol.h" |
| 9 #include "src/inspector/script-breakpoint.h" | 9 #include "src/inspector/script-breakpoint.h" |
| 10 #include "src/inspector/string-util.h" | 10 #include "src/inspector/string-util.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 if (origin.IsEmbedderDebugScript()) continue; | 128 if (origin.IsEmbedderDebugScript()) continue; |
| 129 v8::Local<v8::String> v8ContextData; | 129 v8::Local<v8::String> v8ContextData; |
| 130 if (!script->ContextData().ToLocal(&v8ContextData)) continue; | 130 if (!script->ContextData().ToLocal(&v8ContextData)) continue; |
| 131 String16 contextData = toProtocolString(v8ContextData); | 131 String16 contextData = toProtocolString(v8ContextData); |
| 132 if (contextData.find(contextPrefix) != 0) continue; | 132 if (contextData.find(contextPrefix) != 0) continue; |
| 133 result.push_back( | 133 result.push_back( |
| 134 wrapUnique(new V8DebuggerScript(m_isolate, script, false))); | 134 wrapUnique(new V8DebuggerScript(m_isolate, script, false))); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 String16 V8Debugger::setBreakpoint(const String16& sourceID, | 138 String16 V8Debugger::setBreakpoint(const ScriptBreakpoint& breakpoint, |
| 139 const ScriptBreakpoint& scriptBreakpoint, | |
| 140 int* actualLineNumber, | 139 int* actualLineNumber, |
| 141 int* actualColumnNumber) { | 140 int* actualColumnNumber) { |
| 142 v8::HandleScope scope(m_isolate); | 141 v8::HandleScope scope(m_isolate); |
| 143 v8::Local<v8::Context> context = debuggerContext(); | 142 v8::Local<v8::Context> context = debuggerContext(); |
| 144 v8::Context::Scope contextScope(context); | 143 v8::Context::Scope contextScope(context); |
| 145 | 144 |
| 146 v8::Local<v8::Object> info = v8::Object::New(m_isolate); | 145 v8::Local<v8::Object> info = v8::Object::New(m_isolate); |
| 147 bool success = false; | 146 bool success = false; |
| 148 success = info->Set(context, toV8StringInternalized(m_isolate, "sourceID"), | 147 success = info->Set(context, toV8StringInternalized(m_isolate, "sourceID"), |
| 149 toV8String(m_isolate, sourceID)) | 148 toV8String(m_isolate, breakpoint.script_id)) |
| 150 .FromMaybe(false); | 149 .FromMaybe(false); |
| 151 DCHECK(success); | 150 DCHECK(success); |
| 152 success = info->Set(context, toV8StringInternalized(m_isolate, "lineNumber"), | 151 success = info->Set(context, toV8StringInternalized(m_isolate, "lineNumber"), |
| 153 v8::Integer::New(m_isolate, scriptBreakpoint.lineNumber)) | 152 v8::Integer::New(m_isolate, breakpoint.line_number)) |
| 154 .FromMaybe(false); | 153 .FromMaybe(false); |
| 155 DCHECK(success); | 154 DCHECK(success); |
| 156 success = | 155 success = |
| 157 info->Set(context, toV8StringInternalized(m_isolate, "columnNumber"), | 156 info->Set(context, toV8StringInternalized(m_isolate, "columnNumber"), |
| 158 v8::Integer::New(m_isolate, scriptBreakpoint.columnNumber)) | 157 v8::Integer::New(m_isolate, breakpoint.column_number)) |
| 159 .FromMaybe(false); | 158 .FromMaybe(false); |
| 160 DCHECK(success); | 159 DCHECK(success); |
| 161 success = info->Set(context, toV8StringInternalized(m_isolate, "condition"), | 160 success = info->Set(context, toV8StringInternalized(m_isolate, "condition"), |
| 162 toV8String(m_isolate, scriptBreakpoint.condition)) | 161 toV8String(m_isolate, breakpoint.condition)) |
| 163 .FromMaybe(false); | 162 .FromMaybe(false); |
| 164 DCHECK(success); | 163 DCHECK(success); |
| 165 | 164 |
| 166 v8::Local<v8::Function> setBreakpointFunction = v8::Local<v8::Function>::Cast( | 165 v8::Local<v8::Function> setBreakpointFunction = v8::Local<v8::Function>::Cast( |
| 167 m_debuggerScript.Get(m_isolate) | 166 m_debuggerScript.Get(m_isolate) |
| 168 ->Get(context, toV8StringInternalized(m_isolate, "setBreakpoint")) | 167 ->Get(context, toV8StringInternalized(m_isolate, "setBreakpoint")) |
| 169 .ToLocalChecked()); | 168 .ToLocalChecked()); |
| 170 v8::Local<v8::Value> breakpointId = | 169 v8::Local<v8::Value> breakpointId = |
| 171 v8::DebugInterface::Call(debuggerContext(), setBreakpointFunction, info) | 170 v8::DebugInterface::Call(debuggerContext(), setBreakpointFunction, info) |
| 172 .ToLocalChecked(); | 171 .ToLocalChecked(); |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 | 977 |
| 979 size_t stackSize = | 978 size_t stackSize = |
| 980 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 979 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
| 981 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 980 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
| 982 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 981 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
| 983 | 982 |
| 984 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 983 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
| 985 } | 984 } |
| 986 | 985 |
| 987 } // namespace v8_inspector | 986 } // namespace v8_inspector |
| OLD | NEW |