| 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/inspected-context.h" | 8 #include "src/inspector/inspected-context.h" |
| 9 #include "src/inspector/protocol/Protocol.h" | 9 #include "src/inspector/protocol/Protocol.h" |
| 10 #include "src/inspector/script-breakpoint.h" | 10 #include "src/inspector/script-breakpoint.h" |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 return; | 587 return; |
| 588 DCHECK(hitBreakpoints->IsArray()); | 588 DCHECK(hitBreakpoints->IsArray()); |
| 589 handleProgramBreak(eventContext, eventDetails.GetExecutionState(), | 589 handleProgramBreak(eventContext, eventDetails.GetExecutionState(), |
| 590 v8::Local<v8::Value>(), hitBreakpoints.As<v8::Array>()); | 590 v8::Local<v8::Value>(), hitBreakpoints.As<v8::Array>()); |
| 591 } | 591 } |
| 592 } | 592 } |
| 593 | 593 |
| 594 void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Object> eventData) { | 594 void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Object> eventData) { |
| 595 if (!m_maxAsyncCallStackDepth) return; | 595 if (!m_maxAsyncCallStackDepth) return; |
| 596 | 596 |
| 597 v8::debug::AsyncTaskEventType type = | 597 v8::Local<v8::debug::AsyncTaskEventData> data( |
| 598 static_cast<v8::debug::AsyncTaskEventType>( | 598 v8::Local<v8::debug::AsyncTaskEventData>::Cast(eventData)); |
| 599 callInternalGetterFunction(eventData, "type") | 599 |
| 600 ->ToInteger(m_isolate->GetCurrentContext()) | 600 v8::debug::AsyncTaskEventType type = data->type(); |
| 601 .ToLocalChecked() | 601 String16 name; |
| 602 ->Value()); | 602 v8::Local<v8::String> nameValue; |
| 603 String16 name = toProtocolStringWithTypeCheck( | 603 if (data->name().ToLocal(&nameValue)) |
| 604 callInternalGetterFunction(eventData, "name")); | 604 name = toProtocolStringWithTypeCheck(nameValue); |
| 605 int id = static_cast<int>(callInternalGetterFunction(eventData, "id") | |
| 606 ->ToInteger(m_isolate->GetCurrentContext()) | |
| 607 .ToLocalChecked() | |
| 608 ->Value()); | |
| 609 // Async task events from Promises are given misaligned pointers to prevent | 605 // Async task events from Promises are given misaligned pointers to prevent |
| 610 // from overlapping with other Blink task identifiers. There is a single | 606 // from overlapping with other Blink task identifiers. There is a single |
| 611 // namespace of such ids, managed by src/js/promise.js. | 607 // namespace of such ids, managed by src/js/promise.js. |
| 612 void* ptr = reinterpret_cast<void*>(id * 2 + 1); | 608 void* ptr = reinterpret_cast<void*>(data->id() * 2 + 1); |
| 613 if (type == v8::debug::EnqueueRecurring) | 609 if (type == v8::debug::EnqueueRecurring) |
| 614 asyncTaskScheduled(name, ptr, true); | 610 asyncTaskScheduled(name, ptr, true); |
| 615 else if (type == v8::debug::WillHandle) | 611 else if (type == v8::debug::WillHandle) |
| 616 asyncTaskStarted(ptr); | 612 asyncTaskStarted(ptr); |
| 617 else if (type == v8::debug::DidHandle) | 613 else if (type == v8::debug::DidHandle) |
| 618 asyncTaskFinished(ptr); | 614 asyncTaskFinished(ptr); |
| 619 else if (type == v8::debug::Cancel) | 615 else if (type == v8::debug::Cancel) |
| 620 asyncTaskCanceled(ptr); | 616 asyncTaskCanceled(ptr); |
| 621 else | 617 else |
| 622 UNREACHABLE(); | 618 UNREACHABLE(); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 | 986 |
| 991 size_t stackSize = | 987 size_t stackSize = |
| 992 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 988 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
| 993 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 989 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
| 994 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 990 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
| 995 | 991 |
| 996 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 992 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
| 997 } | 993 } |
| 998 | 994 |
| 999 } // namespace v8_inspector | 995 } // namespace v8_inspector |
| OLD | NEW |