| 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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 removeOldAsyncTasks(m_asyncTaskStacks); | 1023 removeOldAsyncTasks(m_asyncTaskStacks); |
| 1024 removeOldAsyncTasks(m_asyncTaskCreationStacks); | 1024 removeOldAsyncTasks(m_asyncTaskCreationStacks); |
| 1025 protocol::HashSet<void*> recurringLeft; | 1025 protocol::HashSet<void*> recurringLeft; |
| 1026 for (auto task : m_recurringTasks) { | 1026 for (auto task : m_recurringTasks) { |
| 1027 if (m_asyncTaskStacks.find(task) == m_asyncTaskStacks.end()) continue; | 1027 if (m_asyncTaskStacks.find(task) == m_asyncTaskStacks.end()) continue; |
| 1028 recurringLeft.insert(task); | 1028 recurringLeft.insert(task); |
| 1029 } | 1029 } |
| 1030 m_recurringTasks.swap(recurringLeft); | 1030 m_recurringTasks.swap(recurringLeft); |
| 1031 protocol::HashMap<void*, void*> parentLeft; | 1031 protocol::HashMap<void*, void*> parentLeft; |
| 1032 for (auto it : m_parentTask) { | 1032 for (auto it : m_parentTask) { |
| 1033 if (m_asyncTaskCreationStacks.find(it.second) == m_asyncTaskStacks.end()) { | 1033 if (m_asyncTaskCreationStacks.find(it.second) == |
| 1034 m_asyncTaskCreationStacks.end()) { |
| 1034 continue; | 1035 continue; |
| 1035 } | 1036 } |
| 1036 parentLeft.insert(it); | 1037 parentLeft.insert(it); |
| 1037 } | 1038 } |
| 1038 m_parentTask.swap(parentLeft); | 1039 m_parentTask.swap(parentLeft); |
| 1039 } | 1040 } |
| 1040 | 1041 |
| 1041 void V8Debugger::removeOldAsyncTasks(AsyncTaskToStackTrace& map) { | 1042 void V8Debugger::removeOldAsyncTasks(AsyncTaskToStackTrace& map) { |
| 1042 AsyncTaskToStackTrace cleanCopy; | 1043 AsyncTaskToStackTrace cleanCopy; |
| 1043 for (auto it : map) { | 1044 for (auto it : map) { |
| 1044 if (!it.second.expired()) cleanCopy.insert(it); | 1045 if (!it.second.expired()) cleanCopy.insert(it); |
| 1045 } | 1046 } |
| 1046 map.swap(cleanCopy); | 1047 map.swap(cleanCopy); |
| 1047 } | 1048 } |
| 1048 | 1049 |
| 1049 void V8Debugger::setMaxAsyncTaskStacksForTest(int limit) { | 1050 void V8Debugger::setMaxAsyncTaskStacksForTest(int limit) { |
| 1050 m_maxAsyncCallStacks = 0; | 1051 m_maxAsyncCallStacks = 0; |
| 1051 collectOldAsyncStacksIfNeeded(); | 1052 collectOldAsyncStacksIfNeeded(); |
| 1052 m_maxAsyncCallStacks = limit; | 1053 m_maxAsyncCallStacks = limit; |
| 1053 } | 1054 } |
| 1054 | 1055 |
| 1055 } // namespace v8_inspector | 1056 } // namespace v8_inspector |
| OLD | NEW |