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" |
11 #include "src/inspector/v8-debugger-agent-impl.h" | 11 #include "src/inspector/v8-debugger-agent-impl.h" |
12 #include "src/inspector/v8-inspector-impl.h" | 12 #include "src/inspector/v8-inspector-impl.h" |
13 #include "src/inspector/v8-internal-value-type.h" | 13 #include "src/inspector/v8-internal-value-type.h" |
14 #include "src/inspector/v8-stack-trace-impl.h" | 14 #include "src/inspector/v8-stack-trace-impl.h" |
15 #include "src/inspector/v8-value-copier.h" | 15 #include "src/inspector/v8-value-copier.h" |
16 | 16 |
17 namespace v8_inspector { | 17 namespace v8_inspector { |
18 | 18 |
19 namespace { | 19 namespace { |
20 const char stepIntoV8MethodName[] = "stepIntoStatement"; | 20 const char stepIntoV8MethodName[] = "stepIntoStatement"; |
21 const char stepOutV8MethodName[] = "stepOutOfFunction"; | 21 const char stepOutV8MethodName[] = "stepOutOfFunction"; |
22 static const char v8AsyncTaskEventEnqueue[] = "enqueue"; | 22 static const char v8AsyncTaskEventEnqueue[] = "enqueue"; |
| 23 static const char v8AsyncTaskEventEnqueueRecurring[] = "enqueueRecurring"; |
23 static const char v8AsyncTaskEventWillHandle[] = "willHandle"; | 24 static const char v8AsyncTaskEventWillHandle[] = "willHandle"; |
24 static const char v8AsyncTaskEventDidHandle[] = "didHandle"; | 25 static const char v8AsyncTaskEventDidHandle[] = "didHandle"; |
| 26 static const char v8AsyncTaskEventCancel[] = "cancel"; |
25 | 27 |
26 inline v8::Local<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) { | 28 inline v8::Local<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) { |
27 return value ? v8::True(isolate) : v8::False(isolate); | 29 return value ? v8::True(isolate) : v8::False(isolate); |
28 } | 30 } |
29 | 31 |
30 } // namespace | 32 } // namespace |
31 | 33 |
32 static bool inLiveEditScope = false; | 34 static bool inLiveEditScope = false; |
33 | 35 |
34 v8::MaybeLocal<v8::Value> V8Debugger::callDebuggerMethod( | 36 v8::MaybeLocal<v8::Value> V8Debugger::callDebuggerMethod( |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 int id = static_cast<int>(callInternalGetterFunction(eventData, "id") | 648 int id = static_cast<int>(callInternalGetterFunction(eventData, "id") |
647 ->ToInteger(context) | 649 ->ToInteger(context) |
648 .ToLocalChecked() | 650 .ToLocalChecked() |
649 ->Value()); | 651 ->Value()); |
650 // Async task events from Promises are given misaligned pointers to prevent | 652 // Async task events from Promises are given misaligned pointers to prevent |
651 // from overlapping with other Blink task identifiers. There is a single | 653 // from overlapping with other Blink task identifiers. There is a single |
652 // namespace of such ids, managed by src/js/promise.js. | 654 // namespace of such ids, managed by src/js/promise.js. |
653 void* ptr = reinterpret_cast<void*>(id * 2 + 1); | 655 void* ptr = reinterpret_cast<void*>(id * 2 + 1); |
654 if (type == v8AsyncTaskEventEnqueue) | 656 if (type == v8AsyncTaskEventEnqueue) |
655 asyncTaskScheduled(name, ptr, false); | 657 asyncTaskScheduled(name, ptr, false); |
| 658 else if (type == v8AsyncTaskEventEnqueueRecurring) |
| 659 asyncTaskScheduled(name, ptr, true); |
656 else if (type == v8AsyncTaskEventWillHandle) | 660 else if (type == v8AsyncTaskEventWillHandle) |
657 asyncTaskStarted(ptr); | 661 asyncTaskStarted(ptr); |
658 else if (type == v8AsyncTaskEventDidHandle) | 662 else if (type == v8AsyncTaskEventDidHandle) |
659 asyncTaskFinished(ptr); | 663 asyncTaskFinished(ptr); |
| 664 else if (type == v8AsyncTaskEventCancel) |
| 665 asyncTaskCanceled(ptr); |
660 else | 666 else |
661 UNREACHABLE(); | 667 UNREACHABLE(); |
662 } | 668 } |
663 | 669 |
664 V8StackTraceImpl* V8Debugger::currentAsyncCallChain() { | 670 V8StackTraceImpl* V8Debugger::currentAsyncCallChain() { |
665 if (!m_currentStacks.size()) return nullptr; | 671 if (!m_currentStacks.size()) return nullptr; |
666 return m_currentStacks.back().get(); | 672 return m_currentStacks.back().get(); |
667 } | 673 } |
668 | 674 |
669 void V8Debugger::compileDebuggerScript() { | 675 void V8Debugger::compileDebuggerScript() { |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 | 979 |
974 size_t stackSize = | 980 size_t stackSize = |
975 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 981 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
976 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 982 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
977 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 983 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
978 | 984 |
979 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 985 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
980 } | 986 } |
981 | 987 |
982 } // namespace v8_inspector | 988 } // namespace v8_inspector |
OLD | NEW |