| 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/V8Debugger.h" | 5 #include "src/inspector/V8Debugger.h" |
| 6 | 6 |
| 7 #include "src/inspector/DebuggerScript.h" | 7 #include "src/inspector/DebuggerScript.h" |
| 8 #include "src/inspector/ScriptBreakpoint.h" | 8 #include "src/inspector/ScriptBreakpoint.h" |
| 9 #include "src/inspector/StringUtil.h" | 9 #include "src/inspector/StringUtil.h" |
| 10 #include "src/inspector/V8DebuggerAgentImpl.h" | 10 #include "src/inspector/V8DebuggerAgentImpl.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 v8::MicrotasksScope::kDoNotRunMicrotasks); | 114 v8::MicrotasksScope::kDoNotRunMicrotasks); |
| 115 v8::Local<v8::Context> context = debuggerContext(); | 115 v8::Local<v8::Context> context = debuggerContext(); |
| 116 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); | 116 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); |
| 117 DCHECK(!debuggerScript->IsUndefined()); | 117 DCHECK(!debuggerScript->IsUndefined()); |
| 118 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast( | 118 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast( |
| 119 debuggerScript | 119 debuggerScript |
| 120 ->Get(context, toV8StringInternalized(m_isolate, "getScripts")) | 120 ->Get(context, toV8StringInternalized(m_isolate, "getScripts")) |
| 121 .ToLocalChecked()); | 121 .ToLocalChecked()); |
| 122 v8::Local<v8::Value> argv[] = {v8::Integer::New(m_isolate, contextGroupId)}; | 122 v8::Local<v8::Value> argv[] = {v8::Integer::New(m_isolate, contextGroupId)}; |
| 123 v8::Local<v8::Value> value; | 123 v8::Local<v8::Value> value; |
| 124 if (!getScriptsFunction | 124 if (!getScriptsFunction->Call(context, debuggerScript, arraysize(argv), argv) |
| 125 ->Call(context, debuggerScript, V8_INSPECTOR_ARRAY_LENGTH(argv), | |
| 126 argv) | |
| 127 .ToLocal(&value)) | 125 .ToLocal(&value)) |
| 128 return; | 126 return; |
| 129 DCHECK(value->IsArray()); | 127 DCHECK(value->IsArray()); |
| 130 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value); | 128 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value); |
| 131 result.reserve(scriptsArray->Length()); | 129 result.reserve(scriptsArray->Length()); |
| 132 for (unsigned i = 0; i < scriptsArray->Length(); ++i) { | 130 for (unsigned i = 0; i < scriptsArray->Length(); ++i) { |
| 133 v8::Local<v8::Object> scriptObject = v8::Local<v8::Object>::Cast( | 131 v8::Local<v8::Object> scriptObject = v8::Local<v8::Object>::Cast( |
| 134 scriptsArray->Get(context, v8::Integer::New(m_isolate, i)) | 132 scriptsArray->Get(context, v8::Integer::New(m_isolate, i)) |
| 135 .ToLocalChecked()); | 133 .ToLocalChecked()); |
| 136 result.push_back(wrapUnique( | 134 result.push_back(wrapUnique( |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 toV8StringInternalized(m_isolate, "currentCallFrames")) | 457 toV8StringInternalized(m_isolate, "currentCallFrames")) |
| 460 .ToLocalChecked()); | 458 .ToLocalChecked()); |
| 461 currentCallFramesV8 = | 459 currentCallFramesV8 = |
| 462 v8::Debug::Call(debuggerContext(), currentCallFramesFunction, | 460 v8::Debug::Call(debuggerContext(), currentCallFramesFunction, |
| 463 v8::Integer::New(m_isolate, limit)) | 461 v8::Integer::New(m_isolate, limit)) |
| 464 .ToLocalChecked(); | 462 .ToLocalChecked(); |
| 465 } else { | 463 } else { |
| 466 v8::Local<v8::Value> argv[] = {m_executionState, | 464 v8::Local<v8::Value> argv[] = {m_executionState, |
| 467 v8::Integer::New(m_isolate, limit)}; | 465 v8::Integer::New(m_isolate, limit)}; |
| 468 currentCallFramesV8 = | 466 currentCallFramesV8 = |
| 469 callDebuggerMethod("currentCallFrames", V8_INSPECTOR_ARRAY_LENGTH(argv), | 467 callDebuggerMethod("currentCallFrames", arraysize(argv), argv) |
| 470 argv) | |
| 471 .ToLocalChecked(); | 468 .ToLocalChecked(); |
| 472 } | 469 } |
| 473 DCHECK(!currentCallFramesV8.IsEmpty()); | 470 DCHECK(!currentCallFramesV8.IsEmpty()); |
| 474 if (!currentCallFramesV8->IsArray()) return JavaScriptCallFrames(); | 471 if (!currentCallFramesV8->IsArray()) return JavaScriptCallFrames(); |
| 475 v8::Local<v8::Array> callFramesArray = currentCallFramesV8.As<v8::Array>(); | 472 v8::Local<v8::Array> callFramesArray = currentCallFramesV8.As<v8::Array>(); |
| 476 JavaScriptCallFrames callFrames; | 473 JavaScriptCallFrames callFrames; |
| 477 for (size_t i = 0; i < callFramesArray->Length(); ++i) { | 474 for (size_t i = 0; i < callFramesArray->Length(); ++i) { |
| 478 v8::Local<v8::Value> callFrameValue; | 475 v8::Local<v8::Value> callFrameValue; |
| 479 if (!callFramesArray->Get(debuggerContext(), i).ToLocal(&callFrameValue)) | 476 if (!callFramesArray->Get(debuggerContext(), i).ToLocal(&callFrameValue)) |
| 480 return JavaScriptCallFrames(); | 477 return JavaScriptCallFrames(); |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 | 972 |
| 976 size_t stackSize = | 973 size_t stackSize = |
| 977 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 974 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
| 978 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 975 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
| 979 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 976 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
| 980 | 977 |
| 981 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 978 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
| 982 } | 979 } |
| 983 | 980 |
| 984 } // namespace v8_inspector | 981 } // namespace v8_inspector |
| OLD | NEW |