| 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 } | 371 } |
| 372 return true; | 372 return true; |
| 373 } | 373 } |
| 374 // Compile error. | 374 // Compile error. |
| 375 case 1: { | 375 case 1: { |
| 376 *exceptionDetails = | 376 *exceptionDetails = |
| 377 protocol::Runtime::ExceptionDetails::create() | 377 protocol::Runtime::ExceptionDetails::create() |
| 378 .setExceptionId(m_inspector->nextExceptionId()) | 378 .setExceptionId(m_inspector->nextExceptionId()) |
| 379 .setText(toProtocolStringWithTypeCheck(resultTuple->Get(2))) | 379 .setText(toProtocolStringWithTypeCheck(resultTuple->Get(2))) |
| 380 .setLineNumber( | 380 .setLineNumber( |
| 381 resultTuple->Get(3)->ToInteger(m_isolate)->Value() - 1) | 381 static_cast<int>( |
| 382 resultTuple->Get(3)->ToInteger(m_isolate)->Value()) - |
| 383 1) |
| 382 .setColumnNumber( | 384 .setColumnNumber( |
| 383 resultTuple->Get(4)->ToInteger(m_isolate)->Value() - 1) | 385 static_cast<int>( |
| 386 resultTuple->Get(4)->ToInteger(m_isolate)->Value()) - |
| 387 1) |
| 384 .build(); | 388 .build(); |
| 385 return false; | 389 return false; |
| 386 } | 390 } |
| 387 } | 391 } |
| 388 *error = "Unknown error."; | 392 *error = "Unknown error."; |
| 389 return false; | 393 return false; |
| 390 } | 394 } |
| 391 | 395 |
| 392 JavaScriptCallFrames V8Debugger::currentCallFrames(int limit) { | 396 JavaScriptCallFrames V8Debugger::currentCallFrames(int limit) { |
| 393 if (!m_isolate->InContext()) return JavaScriptCallFrames(); | 397 if (!m_isolate->InContext()) return JavaScriptCallFrames(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 405 v8::Integer::New(m_isolate, limit)}; | 409 v8::Integer::New(m_isolate, limit)}; |
| 406 currentCallFramesV8 = | 410 currentCallFramesV8 = |
| 407 callDebuggerMethod("currentCallFrames", V8_INSPECTOR_ARRAY_LENGTH(argv), | 411 callDebuggerMethod("currentCallFrames", V8_INSPECTOR_ARRAY_LENGTH(argv), |
| 408 argv) | 412 argv) |
| 409 .ToLocalChecked(); | 413 .ToLocalChecked(); |
| 410 } | 414 } |
| 411 DCHECK(!currentCallFramesV8.IsEmpty()); | 415 DCHECK(!currentCallFramesV8.IsEmpty()); |
| 412 if (!currentCallFramesV8->IsArray()) return JavaScriptCallFrames(); | 416 if (!currentCallFramesV8->IsArray()) return JavaScriptCallFrames(); |
| 413 v8::Local<v8::Array> callFramesArray = currentCallFramesV8.As<v8::Array>(); | 417 v8::Local<v8::Array> callFramesArray = currentCallFramesV8.As<v8::Array>(); |
| 414 JavaScriptCallFrames callFrames; | 418 JavaScriptCallFrames callFrames; |
| 415 for (size_t i = 0; i < callFramesArray->Length(); ++i) { | 419 for (uint32_t i = 0; i < callFramesArray->Length(); ++i) { |
| 416 v8::Local<v8::Value> callFrameValue; | 420 v8::Local<v8::Value> callFrameValue; |
| 417 if (!callFramesArray->Get(debuggerContext(), i).ToLocal(&callFrameValue)) | 421 if (!callFramesArray->Get(debuggerContext(), i).ToLocal(&callFrameValue)) |
| 418 return JavaScriptCallFrames(); | 422 return JavaScriptCallFrames(); |
| 419 if (!callFrameValue->IsObject()) return JavaScriptCallFrames(); | 423 if (!callFrameValue->IsObject()) return JavaScriptCallFrames(); |
| 420 v8::Local<v8::Object> callFrameObject = callFrameValue.As<v8::Object>(); | 424 v8::Local<v8::Object> callFrameObject = callFrameValue.As<v8::Object>(); |
| 421 callFrames.push_back(JavaScriptCallFrame::create( | 425 callFrames.push_back(JavaScriptCallFrame::create( |
| 422 debuggerContext(), v8::Local<v8::Object>::Cast(callFrameObject))); | 426 debuggerContext(), v8::Local<v8::Object>::Cast(callFrameObject))); |
| 423 } | 427 } |
| 424 return callFrames; | 428 return callFrames; |
| 425 } | 429 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 451 // Don't allow nested breaks. | 455 // Don't allow nested breaks. |
| 452 if (m_runningNestedMessageLoop) return; | 456 if (m_runningNestedMessageLoop) return; |
| 453 | 457 |
| 454 V8DebuggerAgentImpl* agent = | 458 V8DebuggerAgentImpl* agent = |
| 455 m_inspector->enabledDebuggerAgentForGroup(getGroupId(pausedContext)); | 459 m_inspector->enabledDebuggerAgentForGroup(getGroupId(pausedContext)); |
| 456 if (!agent) return; | 460 if (!agent) return; |
| 457 | 461 |
| 458 std::vector<String16> breakpointIds; | 462 std::vector<String16> breakpointIds; |
| 459 if (!hitBreakpointNumbers.IsEmpty()) { | 463 if (!hitBreakpointNumbers.IsEmpty()) { |
| 460 breakpointIds.reserve(hitBreakpointNumbers->Length()); | 464 breakpointIds.reserve(hitBreakpointNumbers->Length()); |
| 461 for (size_t i = 0; i < hitBreakpointNumbers->Length(); i++) { | 465 for (uint32_t i = 0; i < hitBreakpointNumbers->Length(); i++) { |
| 462 v8::Local<v8::Value> hitBreakpointNumber = hitBreakpointNumbers->Get(i); | 466 v8::Local<v8::Value> hitBreakpointNumber = hitBreakpointNumbers->Get(i); |
| 463 DCHECK(!hitBreakpointNumber.IsEmpty() && hitBreakpointNumber->IsInt32()); | 467 DCHECK(!hitBreakpointNumber.IsEmpty() && hitBreakpointNumber->IsInt32()); |
| 464 breakpointIds.push_back( | 468 breakpointIds.push_back( |
| 465 String16::fromInteger(hitBreakpointNumber->Int32Value())); | 469 String16::fromInteger(hitBreakpointNumber->Int32Value())); |
| 466 } | 470 } |
| 467 } | 471 } |
| 468 | 472 |
| 469 m_pausedContext = pausedContext; | 473 m_pausedContext = pausedContext; |
| 470 m_executionState = executionState; | 474 m_executionState = executionState; |
| 471 V8DebuggerAgentImpl::SkipPauseRequest result = agent->didPause( | 475 V8DebuggerAgentImpl::SkipPauseRequest result = agent->didPause( |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 | 576 |
| 573 void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Context> context, | 577 void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Context> context, |
| 574 v8::Local<v8::Object> executionState, | 578 v8::Local<v8::Object> executionState, |
| 575 v8::Local<v8::Object> eventData) { | 579 v8::Local<v8::Object> eventData) { |
| 576 if (!m_maxAsyncCallStackDepth) return; | 580 if (!m_maxAsyncCallStackDepth) return; |
| 577 | 581 |
| 578 String16 type = toProtocolStringWithTypeCheck( | 582 String16 type = toProtocolStringWithTypeCheck( |
| 579 callInternalGetterFunction(eventData, "type")); | 583 callInternalGetterFunction(eventData, "type")); |
| 580 String16 name = toProtocolStringWithTypeCheck( | 584 String16 name = toProtocolStringWithTypeCheck( |
| 581 callInternalGetterFunction(eventData, "name")); | 585 callInternalGetterFunction(eventData, "name")); |
| 582 int id = callInternalGetterFunction(eventData, "id") | 586 int id = static_cast<int>(callInternalGetterFunction(eventData, "id") |
| 583 ->ToInteger(m_isolate) | 587 ->ToInteger(m_isolate) |
| 584 ->Value(); | 588 ->Value()); |
| 585 // The scopes for the ids are defined by the eventData.name namespaces. There | 589 // The scopes for the ids are defined by the eventData.name namespaces. There |
| 586 // are currently two namespaces: "Object." and "Promise.". | 590 // are currently two namespaces: "Object." and "Promise.". |
| 587 void* ptr = reinterpret_cast<void*>(id * 4 + (name[0] == 'P' ? 2 : 0) + 1); | 591 void* ptr = reinterpret_cast<void*>(id * 4 + (name[0] == 'P' ? 2 : 0) + 1); |
| 588 if (type == v8AsyncTaskEventEnqueue) | 592 if (type == v8AsyncTaskEventEnqueue) |
| 589 asyncTaskScheduled(name, ptr, false); | 593 asyncTaskScheduled(name, ptr, false); |
| 590 else if (type == v8AsyncTaskEventWillHandle) | 594 else if (type == v8AsyncTaskEventWillHandle) |
| 591 asyncTaskStarted(ptr); | 595 asyncTaskStarted(ptr); |
| 592 else if (type == v8AsyncTaskEventDidHandle) | 596 else if (type == v8AsyncTaskEventDidHandle) |
| 593 asyncTaskFinished(ptr); | 597 asyncTaskFinished(ptr); |
| 594 else | 598 else |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 | 911 |
| 908 size_t stackSize = | 912 size_t stackSize = |
| 909 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 913 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
| 910 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 914 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
| 911 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 915 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
| 912 | 916 |
| 913 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 917 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
| 914 } | 918 } |
| 915 | 919 |
| 916 } // namespace v8_inspector | 920 } // namespace v8_inspector |
| OLD | NEW |