| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium 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 "platform/v8_inspector/V8DebuggerAgentImpl.h" | 5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| 6 | 6 |
| 7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
| 8 #include "platform/inspector_protocol/Values.h" | 8 #include "platform/inspector_protocol/Values.h" |
| 9 #include "platform/v8_inspector/InjectedScript.h" | 9 #include "platform/v8_inspector/InjectedScript.h" |
| 10 #include "platform/v8_inspector/InspectedContext.h" | 10 #include "platform/v8_inspector/InspectedContext.h" |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 m_asyncTaskStacks.remove(task); | 1007 m_asyncTaskStacks.remove(task); |
| 1008 m_recurringTasks.remove(task); | 1008 m_recurringTasks.remove(task); |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 void V8DebuggerAgentImpl::asyncTaskStarted(void* task) | 1011 void V8DebuggerAgentImpl::asyncTaskStarted(void* task) |
| 1012 { | 1012 { |
| 1013 // Not enabled, return. | 1013 // Not enabled, return. |
| 1014 if (!m_maxAsyncCallStackDepth) | 1014 if (!m_maxAsyncCallStackDepth) |
| 1015 return; | 1015 return; |
| 1016 | 1016 |
| 1017 #if ENABLE(ASSERT) | |
| 1018 m_currentTasks.append(task); | 1017 m_currentTasks.append(task); |
| 1019 #endif | |
| 1020 | |
| 1021 V8StackTraceImpl* stack = m_asyncTaskStacks.get(task); | 1018 V8StackTraceImpl* stack = m_asyncTaskStacks.get(task); |
| 1022 // Needs to support following order of events: | 1019 // Needs to support following order of events: |
| 1023 // - asyncTaskScheduled | 1020 // - asyncTaskScheduled |
| 1024 // <-- attached here --> | 1021 // <-- attached here --> |
| 1025 // - asyncTaskStarted | 1022 // - asyncTaskStarted |
| 1026 // - asyncTaskCanceled <-- canceled before finished | 1023 // - asyncTaskCanceled <-- canceled before finished |
| 1027 // <-- async stack requested here --> | 1024 // <-- async stack requested here --> |
| 1028 // - asyncTaskFinished | 1025 // - asyncTaskFinished |
| 1029 m_currentStacks.append(stack ? stack->cloneImpl() : nullptr); | 1026 m_currentStacks.append(stack ? stack->cloneImpl() : nullptr); |
| 1030 } | 1027 } |
| 1031 | 1028 |
| 1032 void V8DebuggerAgentImpl::asyncTaskFinished(void* task) | 1029 void V8DebuggerAgentImpl::asyncTaskFinished(void* task) |
| 1033 { | 1030 { |
| 1034 if (!m_maxAsyncCallStackDepth) | 1031 if (!m_maxAsyncCallStackDepth) |
| 1035 return; | 1032 return; |
| 1036 // We could start instrumenting half way and the stack is empty. | 1033 // We could start instrumenting half way and the stack is empty. |
| 1037 if (!m_currentStacks.size()) | 1034 if (!m_currentStacks.size()) |
| 1038 return; | 1035 return; |
| 1039 | 1036 |
| 1040 #if ENABLE(ASSERT) | |
| 1041 DCHECK(m_currentTasks.last() == task); | 1037 DCHECK(m_currentTasks.last() == task); |
| 1042 m_currentTasks.removeLast(); | 1038 m_currentTasks.removeLast(); |
| 1043 #endif | |
| 1044 | 1039 |
| 1045 m_currentStacks.removeLast(); | 1040 m_currentStacks.removeLast(); |
| 1046 if (!m_recurringTasks.contains(task)) | 1041 if (!m_recurringTasks.contains(task)) |
| 1047 m_asyncTaskStacks.remove(task); | 1042 m_asyncTaskStacks.remove(task); |
| 1048 } | 1043 } |
| 1049 | 1044 |
| 1050 void V8DebuggerAgentImpl::allAsyncTasksCanceled() | 1045 void V8DebuggerAgentImpl::allAsyncTasksCanceled() |
| 1051 { | 1046 { |
| 1052 m_asyncTaskStacks.clear(); | 1047 m_asyncTaskStacks.clear(); |
| 1053 m_recurringTasks.clear(); | 1048 m_recurringTasks.clear(); |
| 1054 m_currentStacks.clear(); | 1049 m_currentStacks.clear(); |
| 1055 | |
| 1056 #if ENABLE(ASSERT) | |
| 1057 m_currentTasks.clear(); | 1050 m_currentTasks.clear(); |
| 1058 #endif | |
| 1059 } | 1051 } |
| 1060 | 1052 |
| 1061 void V8DebuggerAgentImpl::setBlackboxPatterns(ErrorString* errorString, std::uni
que_ptr<protocol::Array<String16>> patterns) | 1053 void V8DebuggerAgentImpl::setBlackboxPatterns(ErrorString* errorString, std::uni
que_ptr<protocol::Array<String16>> patterns) |
| 1062 { | 1054 { |
| 1063 if (!patterns->length()) { | 1055 if (!patterns->length()) { |
| 1064 m_blackboxPattern = nullptr; | 1056 m_blackboxPattern = nullptr; |
| 1065 m_state->remove(DebuggerAgentState::blackboxPattern); | 1057 m_state->remove(DebuggerAgentState::blackboxPattern); |
| 1066 return; | 1058 return; |
| 1067 } | 1059 } |
| 1068 | 1060 |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 if (!enabled()) | 1438 if (!enabled()) |
| 1447 return; | 1439 return; |
| 1448 m_scheduledDebuggerStep = NoStep; | 1440 m_scheduledDebuggerStep = NoStep; |
| 1449 m_scripts.clear(); | 1441 m_scripts.clear(); |
| 1450 m_blackboxedPositions.clear(); | 1442 m_blackboxedPositions.clear(); |
| 1451 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1443 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 1452 allAsyncTasksCanceled(); | 1444 allAsyncTasksCanceled(); |
| 1453 } | 1445 } |
| 1454 | 1446 |
| 1455 } // namespace blink | 1447 } // namespace blink |
| OLD | NEW |