OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 , m_pausingOnNativeEvent(false) | 123 , m_pausingOnNativeEvent(false) |
124 , m_inAsyncOperationForStepInto(false) | 124 , m_inAsyncOperationForStepInto(false) |
125 , m_listener(nullptr) | 125 , m_listener(nullptr) |
126 , m_skippedStepFrameCount(0) | 126 , m_skippedStepFrameCount(0) |
127 , m_recursionLevelForStepOut(0) | 127 , m_recursionLevelForStepOut(0) |
128 , m_recursionLevelForStepFrame(0) | 128 , m_recursionLevelForStepFrame(0) |
129 , m_skipAllPauses(false) | 129 , m_skipAllPauses(false) |
130 , m_skipContentScripts(false) | 130 , m_skipContentScripts(false) |
131 , m_cachedSkipStackGeneration(0) | 131 , m_cachedSkipStackGeneration(0) |
132 , m_promiseTracker(PromiseTracker::create()) | 132 , m_promiseTracker(PromiseTracker::create()) |
133 , m_nextAsyncOperationId(1) | |
133 , m_maxAsyncCallStackDepth(0) | 134 , m_maxAsyncCallStackDepth(0) |
134 , m_currentAsyncCallChain(nullptr) | 135 , m_currentAsyncCallChain(nullptr) |
135 , m_nestedAsyncCallCount(0) | 136 , m_nestedAsyncCallCount(0) |
136 , m_performingAsyncStepIn(false) | 137 , m_performingAsyncStepIn(false) |
137 { | 138 { |
138 m_v8AsyncCallTracker = V8AsyncCallTracker::create(this); | 139 m_v8AsyncCallTracker = V8AsyncCallTracker::create(this); |
139 } | 140 } |
140 | 141 |
141 InspectorDebuggerAgent::~InspectorDebuggerAgent() | 142 InspectorDebuggerAgent::~InspectorDebuggerAgent() |
142 { | 143 { |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1076 } | 1077 } |
1077 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(v alue.scriptState()); | 1078 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(v alue.scriptState()); |
1078 promise = injectedScript.wrapObject(value, objectGroup ? *objectGroup : ""); | 1079 promise = injectedScript.wrapObject(value, objectGroup ? *objectGroup : ""); |
1079 } | 1080 } |
1080 | 1081 |
1081 const AsyncCallChain* InspectorDebuggerAgent::currentAsyncCallChain() const | 1082 const AsyncCallChain* InspectorDebuggerAgent::currentAsyncCallChain() const |
1082 { | 1083 { |
1083 return m_currentAsyncCallChain.get(); | 1084 return m_currentAsyncCallChain.get(); |
1084 } | 1085 } |
1085 | 1086 |
1086 PassRefPtrWillBeRawPtr<AsyncCallChain> InspectorDebuggerAgent::traceAsyncOperati onStarting(const String& description) | 1087 int InspectorDebuggerAgent::traceAsyncOperationStarting(const String& descriptio n) |
1087 { | 1088 { |
1088 ScriptValue callFrames = scriptDebugServer().currentCallFramesForAsyncStack( ); | 1089 ScriptValue callFrames = scriptDebugServer().currentCallFramesForAsyncStack( ); |
1089 if (callFrames.isEmpty()) { | 1090 if (callFrames.isEmpty()) { |
1090 if (!m_currentAsyncCallChain) | 1091 if (!m_currentAsyncCallChain) |
1091 return nullptr; | 1092 return 0; |
1092 RefPtrWillBeRawPtr<AsyncCallChain> chain = AsyncCallChain::create(nullpt r, m_currentAsyncCallChain.get(), m_maxAsyncCallStackDepth); | 1093 return createAsyncCallChain(nullptr); |
1093 didCreateAsyncCallChain(chain.get()); | |
1094 return chain.release(); // Propagate async call stack chain. | |
1095 } | 1094 } |
1096 RefPtrWillBeRawPtr<AsyncCallChain> chain = AsyncCallChain::create(adoptRefWi llBeNoop(new AsyncCallStack(description, callFrames)), m_currentAsyncCallChain.g et(), m_maxAsyncCallStackDepth); | 1095 return createAsyncCallChain(adoptRefWillBeNoop(new AsyncCallStack(descriptio n, callFrames))); |
1096 } | |
1097 | |
1098 int InspectorDebuggerAgent::createAsyncCallChain(PassRefPtrWillBeRawPtr<AsyncCal lStack> callStack) | |
aandrey
2015/01/20 14:33:36
inline this method?
yurys
2015/01/20 17:15:38
Done.
| |
1099 { | |
1100 RefPtrWillBeRawPtr<AsyncCallChain> chain = AsyncCallChain::create(callStack, m_currentAsyncCallChain.get(), m_maxAsyncCallStackDepth); | |
1101 while (!m_nextAsyncOperationId || m_asyncOperations.contains(m_nextAsyncOper ationId)) | |
1102 ++m_nextAsyncOperationId; | |
1103 int id = m_nextAsyncOperationId++; | |
aandrey
2015/01/20 14:33:36
should be circular, never negative
yurys
2015/01/20 17:15:38
Done.
| |
1104 m_asyncOperations.set(id, chain); | |
1097 didCreateAsyncCallChain(chain.get()); | 1105 didCreateAsyncCallChain(chain.get()); |
1098 return chain.release(); | 1106 return id; |
1099 } | 1107 } |
1100 | 1108 |
1101 void InspectorDebuggerAgent::didCreateAsyncCallChain(AsyncCallChain* chain) | 1109 void InspectorDebuggerAgent::didCreateAsyncCallChain(AsyncCallChain* chain) |
aandrey
2015/01/20 14:33:36
this can be inlined too
yurys
2015/01/20 17:15:38
Done.
| |
1102 { | 1110 { |
1103 if (!m_performingAsyncStepIn) | 1111 if (!m_performingAsyncStepIn) |
1104 return; | 1112 return; |
1105 if (m_inAsyncOperationForStepInto || m_asyncOperationsForStepInto.isEmpty()) | 1113 if (m_inAsyncOperationForStepInto || m_asyncOperationsForStepInto.isEmpty()) |
1106 m_asyncOperationsForStepInto.add(chain); | 1114 m_asyncOperationsForStepInto.add(chain); |
1107 } | 1115 } |
1108 | 1116 |
1109 void InspectorDebuggerAgent::traceAsyncCallbackCompleted() | 1117 void InspectorDebuggerAgent::traceAsyncCallbackCompleted() |
1110 { | 1118 { |
1111 if (!m_nestedAsyncCallCount) | 1119 if (!m_nestedAsyncCallCount) |
1112 return; | 1120 return; |
1113 ASSERT(m_currentAsyncCallChain); | 1121 ASSERT(m_currentAsyncCallChain); |
1114 --m_nestedAsyncCallCount; | 1122 --m_nestedAsyncCallCount; |
1115 if (!m_nestedAsyncCallCount) { | 1123 if (!m_nestedAsyncCallCount) { |
1116 m_currentAsyncCallChain.clear(); | 1124 m_currentAsyncCallChain.clear(); |
1117 if (!m_performingAsyncStepIn) | 1125 if (!m_performingAsyncStepIn) |
1118 return; | 1126 return; |
1119 if (!m_inAsyncOperationForStepInto) | 1127 if (!m_inAsyncOperationForStepInto) |
1120 return; | 1128 return; |
1121 m_inAsyncOperationForStepInto = false; | 1129 m_inAsyncOperationForStepInto = false; |
1122 m_scheduledDebuggerStep = NoStep; | 1130 m_scheduledDebuggerStep = NoStep; |
1123 scriptDebugServer().setPauseOnNextStatement(false); | 1131 scriptDebugServer().setPauseOnNextStatement(false); |
1124 if (m_asyncOperationsForStepInto.isEmpty()) | 1132 if (m_asyncOperationsForStepInto.isEmpty()) |
1125 clearStepIntoAsync(); | 1133 clearStepIntoAsync(); |
1126 } | 1134 } |
1127 } | 1135 } |
1128 | 1136 |
1129 void InspectorDebuggerAgent::traceAsyncCallbackStarting(v8::Isolate* isolate, Pa ssRefPtrWillBeRawPtr<AsyncCallChain> chain) | 1137 void InspectorDebuggerAgent::traceAsyncCallbackStarting(v8::Isolate* isolate, in t operationId) |
1130 { | 1138 { |
1139 AsyncCallChain* chain = m_asyncOperations.get(operationId); | |
aandrey
2015/01/20 14:33:36
ASSERT(operationId > 0);
yurys
2015/01/20 17:15:38
Done.
| |
1131 int recursionLevel = V8RecursionScope::recursionLevel(isolate); | 1140 int recursionLevel = V8RecursionScope::recursionLevel(isolate); |
1132 if (chain && (!recursionLevel || (recursionLevel == 1 && Microtask::performi ngCheckpoint(isolate)))) { | 1141 if (chain && (!recursionLevel || (recursionLevel == 1 && Microtask::performi ngCheckpoint(isolate)))) { |
1133 // Current AsyncCallChain corresponds to the bottommost JS call frame. | 1142 // Current AsyncCallChain corresponds to the bottommost JS call frame. |
1134 m_currentAsyncCallChain = chain; | 1143 m_currentAsyncCallChain = chain; |
1135 m_nestedAsyncCallCount = 1; | 1144 m_nestedAsyncCallCount = 1; |
1136 if (!m_performingAsyncStepIn) | 1145 if (!m_performingAsyncStepIn) |
1137 return; | 1146 return; |
1138 if (!m_asyncOperationsForStepInto.contains(m_currentAsyncCallChain.get() )) | 1147 if (!m_asyncOperationsForStepInto.contains(m_currentAsyncCallChain.get() )) |
1139 return; | 1148 return; |
1140 m_inAsyncOperationForStepInto = true; | 1149 m_inAsyncOperationForStepInto = true; |
1141 m_scheduledDebuggerStep = StepInto; | 1150 m_scheduledDebuggerStep = StepInto; |
1142 m_skippedStepFrameCount = 0; | 1151 m_skippedStepFrameCount = 0; |
1143 m_recursionLevelForStepFrame = 0; | 1152 m_recursionLevelForStepFrame = 0; |
1144 scriptDebugServer().setPauseOnNextStatement(true); | 1153 scriptDebugServer().setPauseOnNextStatement(true); |
1145 } else { | 1154 } else { |
1146 if (m_currentAsyncCallChain) | 1155 if (m_currentAsyncCallChain) |
1147 ++m_nestedAsyncCallCount; | 1156 ++m_nestedAsyncCallCount; |
1148 } | 1157 } |
1149 } | 1158 } |
1150 | 1159 |
1151 void InspectorDebuggerAgent::traceAsyncOperationCompleted(AsyncCallChain* chain) | 1160 void InspectorDebuggerAgent::traceAsyncOperationCompleted(int operationId) |
1152 { | 1161 { |
1162 RefPtrWillBeRawPtr<AsyncCallChain> chain = m_asyncOperations.take(operationI d); | |
aandrey
2015/01/20 14:33:36
ditto
yurys
2015/01/20 17:15:38
Done.
| |
1153 if (!m_performingAsyncStepIn) | 1163 if (!m_performingAsyncStepIn) |
1154 return; | 1164 return; |
1155 m_asyncOperationsForStepInto.remove(chain); | 1165 m_asyncOperationsForStepInto.remove(chain); |
aandrey
2015/01/20 14:33:36
can it be HashSet<int> now?
yurys
2015/01/20 17:15:38
Done.
| |
1156 if (!m_inAsyncOperationForStepInto && m_asyncOperationsForStepInto.isEmpty() ) | 1166 if (!m_inAsyncOperationForStepInto && m_asyncOperationsForStepInto.isEmpty() ) |
1157 clearStepIntoAsync(); | 1167 clearStepIntoAsync(); |
1158 } | 1168 } |
1159 | 1169 |
1160 void InspectorDebuggerAgent::resetAsyncCallTracker() | 1170 void InspectorDebuggerAgent::resetAsyncCallTracker() |
1161 { | 1171 { |
1162 m_currentAsyncCallChain.clear(); | 1172 m_currentAsyncCallChain.clear(); |
1163 m_nestedAsyncCallCount = 0; | 1173 m_nestedAsyncCallCount = 0; |
1164 for (auto& listener: m_asyncCallTrackingListeners) | 1174 for (auto& listener: m_asyncCallTrackingListeners) |
1165 listener->resetAsyncCallChains(); | 1175 listener->resetAsyncCallChains(); |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1558 visitor->trace(m_v8AsyncCallTracker); | 1568 visitor->trace(m_v8AsyncCallTracker); |
1559 visitor->trace(m_promiseTracker); | 1569 visitor->trace(m_promiseTracker); |
1560 visitor->trace(m_asyncOperationsForStepInto); | 1570 visitor->trace(m_asyncOperationsForStepInto); |
1561 visitor->trace(m_currentAsyncCallChain); | 1571 visitor->trace(m_currentAsyncCallChain); |
1562 visitor->trace(m_asyncCallTrackingListeners); | 1572 visitor->trace(m_asyncCallTrackingListeners); |
1563 #endif | 1573 #endif |
1564 InspectorBaseAgent::trace(visitor); | 1574 InspectorBaseAgent::trace(visitor); |
1565 } | 1575 } |
1566 | 1576 |
1567 } // namespace blink | 1577 } // namespace blink |
OLD | NEW |