OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "platform/v8_inspector/V8Debugger.h" | 5 #include "platform/v8_inspector/V8Debugger.h" |
6 | 6 |
7 #include "platform/v8_inspector/DebuggerScript.h" | 7 #include "platform/v8_inspector/DebuggerScript.h" |
8 #include "platform/v8_inspector/ScriptBreakpoint.h" | 8 #include "platform/v8_inspector/ScriptBreakpoint.h" |
9 #include "platform/v8_inspector/V8Compat.h" | 9 #include "platform/v8_inspector/V8Compat.h" |
10 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 10 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 return; | 131 return; |
132 DCHECK(value->IsArray()); | 132 DCHECK(value->IsArray()); |
133 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value); | 133 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value); |
134 result.reserve(scriptsArray->Length()); | 134 result.reserve(scriptsArray->Length()); |
135 for (unsigned i = 0; i < scriptsArray->Length(); ++i) { | 135 for (unsigned i = 0; i < scriptsArray->Length(); ++i) { |
136 v8::Local<v8::Object> scriptObject = v8::Local<v8::Object>::Cast(scripts
Array->Get(v8::Integer::New(m_isolate, i))); | 136 v8::Local<v8::Object> scriptObject = v8::Local<v8::Object>::Cast(scripts
Array->Get(v8::Integer::New(m_isolate, i))); |
137 result.push_back(wrapUnique(new V8DebuggerScript(m_isolate, scriptObject
, inLiveEditScope))); | 137 result.push_back(wrapUnique(new V8DebuggerScript(m_isolate, scriptObject
, inLiveEditScope))); |
138 } | 138 } |
139 } | 139 } |
140 | 140 |
141 String16 V8Debugger::setBreakpoint(const String16& sourceID, const ScriptBreakpo
int& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber, bool inte
rstatementLocation) | 141 String16 V8Debugger::setBreakpoint(const String16& sourceID, const ScriptBreakpo
int& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber) |
142 { | 142 { |
143 v8::HandleScope scope(m_isolate); | 143 v8::HandleScope scope(m_isolate); |
144 v8::Context::Scope contextScope(debuggerContext()); | 144 v8::Context::Scope contextScope(debuggerContext()); |
145 | 145 |
146 v8::Local<v8::Object> info = v8::Object::New(m_isolate); | 146 v8::Local<v8::Object> info = v8::Object::New(m_isolate); |
147 info->Set(toV8StringInternalized(m_isolate, "sourceID"), toV8String(m_isolat
e, sourceID)); | 147 info->Set(toV8StringInternalized(m_isolate, "sourceID"), toV8String(m_isolat
e, sourceID)); |
148 info->Set(toV8StringInternalized(m_isolate, "lineNumber"), v8::Integer::New(
m_isolate, scriptBreakpoint.lineNumber)); | 148 info->Set(toV8StringInternalized(m_isolate, "lineNumber"), v8::Integer::New(
m_isolate, scriptBreakpoint.lineNumber)); |
149 info->Set(toV8StringInternalized(m_isolate, "columnNumber"), v8::Integer::Ne
w(m_isolate, scriptBreakpoint.columnNumber)); | 149 info->Set(toV8StringInternalized(m_isolate, "columnNumber"), v8::Integer::Ne
w(m_isolate, scriptBreakpoint.columnNumber)); |
150 info->Set(toV8StringInternalized(m_isolate, "interstatementLocation"), v8Boo
lean(interstatementLocation, m_isolate)); | |
151 info->Set(toV8StringInternalized(m_isolate, "condition"), toV8String(m_isola
te, scriptBreakpoint.condition)); | 150 info->Set(toV8StringInternalized(m_isolate, "condition"), toV8String(m_isola
te, scriptBreakpoint.condition)); |
152 | 151 |
153 v8::Local<v8::Function> setBreakpointFunction = v8::Local<v8::Function>::Cas
t(m_debuggerScript.Get(m_isolate)->Get(toV8StringInternalized(m_isolate, "setBre
akpoint"))); | 152 v8::Local<v8::Function> setBreakpointFunction = v8::Local<v8::Function>::Cas
t(m_debuggerScript.Get(m_isolate)->Get(toV8StringInternalized(m_isolate, "setBre
akpoint"))); |
154 v8::Local<v8::Value> breakpointId = v8::Debug::Call(debuggerContext(), setBr
eakpointFunction, info).ToLocalChecked(); | 153 v8::Local<v8::Value> breakpointId = v8::Debug::Call(debuggerContext(), setBr
eakpointFunction, info).ToLocalChecked(); |
155 if (!breakpointId->IsString()) | 154 if (!breakpointId->IsString()) |
156 return ""; | 155 return ""; |
157 *actualLineNumber = info->Get(toV8StringInternalized(m_isolate, "lineNumber"
))->Int32Value(); | 156 *actualLineNumber = info->Get(toV8StringInternalized(m_isolate, "lineNumber"
))->Int32Value(); |
158 *actualColumnNumber = info->Get(toV8StringInternalized(m_isolate, "columnNum
ber"))->Int32Value(); | 157 *actualColumnNumber = info->Get(toV8StringInternalized(m_isolate, "columnNum
ber"))->Int32Value(); |
159 return toProtocolString(breakpointId.As<v8::String>()); | 158 return toProtocolString(breakpointId.As<v8::String>()); |
160 } | 159 } |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 return nullptr; | 828 return nullptr; |
830 | 829 |
831 size_t stackSize = fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture :
1; | 830 size_t stackSize = fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture :
1; |
832 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 831 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
833 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 832 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
834 | 833 |
835 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 834 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
836 } | 835 } |
837 | 836 |
838 } // namespace blink | 837 } // namespace blink |
OLD | NEW |