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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 asyncTaskScheduledForStack("Promise.reject", task, true); | 659 asyncTaskScheduledForStack("Promise.reject", task, true); |
660 break; | 660 break; |
661 case v8::debug::kDebugWillHandle: | 661 case v8::debug::kDebugWillHandle: |
662 asyncTaskStartedForStack(task); | 662 asyncTaskStartedForStack(task); |
663 asyncTaskStartedForStepping(task); | 663 asyncTaskStartedForStepping(task); |
664 break; | 664 break; |
665 case v8::debug::kDebugDidHandle: | 665 case v8::debug::kDebugDidHandle: |
666 asyncTaskFinishedForStack(task); | 666 asyncTaskFinishedForStack(task); |
667 asyncTaskFinishedForStepping(task); | 667 asyncTaskFinishedForStepping(task); |
668 break; | 668 break; |
669 case v8::debug::kDebugPromiseCollected: | |
670 asyncTaskCanceledForStack(task); | |
671 asyncTaskCanceledForStepping(task); | |
672 break; | |
673 } | 669 } |
674 } | 670 } |
675 | 671 |
676 std::shared_ptr<AsyncStackTrace> V8Debugger::currentAsyncParent() { | 672 std::shared_ptr<AsyncStackTrace> V8Debugger::currentAsyncParent() { |
677 return m_currentAsyncParent.empty() ? nullptr : m_currentAsyncParent.back(); | 673 return m_currentAsyncParent.empty() ? nullptr : m_currentAsyncParent.back(); |
678 } | 674 } |
679 | 675 |
680 std::shared_ptr<AsyncStackTrace> V8Debugger::currentAsyncCreation() { | 676 std::shared_ptr<AsyncStackTrace> V8Debugger::currentAsyncCreation() { |
681 return m_currentAsyncCreation.empty() ? nullptr | 677 return m_currentAsyncCreation.empty() ? nullptr |
682 : m_currentAsyncCreation.back(); | 678 : m_currentAsyncCreation.back(); |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 } | 1041 } |
1046 map.swap(cleanCopy); | 1042 map.swap(cleanCopy); |
1047 } | 1043 } |
1048 | 1044 |
1049 void V8Debugger::setMaxAsyncTaskStacksForTest(int limit) { | 1045 void V8Debugger::setMaxAsyncTaskStacksForTest(int limit) { |
1050 m_maxAsyncCallStacks = 0; | 1046 m_maxAsyncCallStacks = 0; |
1051 collectOldAsyncStacksIfNeeded(); | 1047 collectOldAsyncStacksIfNeeded(); |
1052 m_maxAsyncCallStacks = limit; | 1048 m_maxAsyncCallStacks = limit; |
1053 } | 1049 } |
1054 | 1050 |
| 1051 void V8Debugger::dumpAsyncTaskStacksStateForTest() { |
| 1052 fprintf(stdout, "Async stacks count: %d\n", m_asyncStacksCount); |
| 1053 fprintf(stdout, "Scheduled async tasks: %zu\n", m_asyncTaskStacks.size()); |
| 1054 fprintf(stdout, "Created async tasks: %zu\n", |
| 1055 m_asyncTaskCreationStacks.size()); |
| 1056 fprintf(stdout, "Async tasks with parent: %zu\n", m_parentTask.size()); |
| 1057 fprintf(stdout, "Recurring async tasks: %zu\n", m_recurringTasks.size()); |
| 1058 fprintf(stdout, "\n"); |
| 1059 } |
| 1060 |
1055 } // namespace v8_inspector | 1061 } // namespace v8_inspector |
OLD | NEW |