Chromium Code Reviews| 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/IgnoreExceptionsScope.h" | 9 #include "platform/v8_inspector/IgnoreExceptionsScope.h" |
| 10 #include "platform/v8_inspector/InjectedScript.h" | 10 #include "platform/v8_inspector/InjectedScript.h" |
| 11 #include "platform/v8_inspector/InspectedContext.h" | 11 #include "platform/v8_inspector/InspectedContext.h" |
| 12 #include "platform/v8_inspector/JavaScriptCallFrame.h" | 12 #include "platform/v8_inspector/JavaScriptCallFrame.h" |
| 13 #include "platform/v8_inspector/RemoteObjectId.h" | 13 #include "platform/v8_inspector/RemoteObjectId.h" |
| 14 #include "platform/v8_inspector/ScriptBreakpoint.h" | 14 #include "platform/v8_inspector/ScriptBreakpoint.h" |
| 15 #include "platform/v8_inspector/V8AsyncCallTracker.h" | |
| 16 #include "platform/v8_inspector/V8InspectorConnectionImpl.h" | 15 #include "platform/v8_inspector/V8InspectorConnectionImpl.h" |
| 17 #include "platform/v8_inspector/V8Regex.h" | 16 #include "platform/v8_inspector/V8Regex.h" |
| 18 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" | 17 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" |
| 19 #include "platform/v8_inspector/V8StackTraceImpl.h" | 18 #include "platform/v8_inspector/V8StackTraceImpl.h" |
| 20 #include "platform/v8_inspector/V8StringUtil.h" | 19 #include "platform/v8_inspector/V8StringUtil.h" |
| 21 #include "platform/v8_inspector/public/V8ContentSearchUtil.h" | 20 #include "platform/v8_inspector/public/V8ContentSearchUtil.h" |
| 22 #include "platform/v8_inspector/public/V8Debugger.h" | 21 #include "platform/v8_inspector/public/V8Debugger.h" |
| 23 #include "platform/v8_inspector/public/V8DebuggerClient.h" | 22 #include "platform/v8_inspector/public/V8DebuggerClient.h" |
| 24 #include "platform/v8_inspector/public/V8ToProtocolValue.h" | 23 #include "platform/v8_inspector/public/V8ToProtocolValue.h" |
| 25 | 24 |
| 26 using blink::protocol::Array; | 25 using blink::protocol::Array; |
| 27 using blink::protocol::Maybe; | 26 using blink::protocol::Maybe; |
| 28 using blink::protocol::Debugger::BreakpointId; | 27 using blink::protocol::Debugger::BreakpointId; |
| 29 using blink::protocol::Debugger::CallFrame; | 28 using blink::protocol::Debugger::CallFrame; |
| 30 using blink::protocol::Debugger::CollectionEntry; | 29 using blink::protocol::Debugger::CollectionEntry; |
| 31 using blink::protocol::Runtime::ExceptionDetails; | 30 using blink::protocol::Runtime::ExceptionDetails; |
| 32 using blink::protocol::Debugger::FunctionDetails; | 31 using blink::protocol::Debugger::FunctionDetails; |
| 33 using blink::protocol::Debugger::GeneratorObjectDetails; | 32 using blink::protocol::Debugger::GeneratorObjectDetails; |
| 34 using blink::protocol::Runtime::ScriptId; | 33 using blink::protocol::Runtime::ScriptId; |
| 35 using blink::protocol::Runtime::StackTrace; | 34 using blink::protocol::Runtime::StackTrace; |
| 36 using blink::protocol::Runtime::RemoteObject; | 35 using blink::protocol::Runtime::RemoteObject; |
| 37 | 36 |
| 37 namespace { | |
| 38 static const char v8AsyncTaskEventEnqueue[] = "enqueue"; | |
| 39 static const char v8AsyncTaskEventWillHandle[] = "willHandle"; | |
| 40 static const char v8AsyncTaskEventDidHandle[] = "didHandle"; | |
| 41 } | |
| 42 | |
| 38 namespace blink { | 43 namespace blink { |
| 39 | 44 |
| 40 namespace DebuggerAgentState { | 45 namespace DebuggerAgentState { |
| 41 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; | 46 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; |
| 42 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; | 47 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; |
| 43 static const char asyncCallStackDepth[] = "asyncCallStackDepth"; | 48 static const char asyncCallStackDepth[] = "asyncCallStackDepth"; |
| 44 | 49 |
| 45 // Breakpoint properties. | 50 // Breakpoint properties. |
| 46 static const char url[] = "url"; | 51 static const char url[] = "url"; |
| 47 static const char isRegex[] = "isRegex"; | 52 static const char isRegex[] = "isRegex"; |
| 48 static const char lineNumber[] = "lineNumber"; | 53 static const char lineNumber[] = "lineNumber"; |
| 49 static const char columnNumber[] = "columnNumber"; | 54 static const char columnNumber[] = "columnNumber"; |
| 50 static const char condition[] = "condition"; | 55 static const char condition[] = "condition"; |
| 51 static const char skipAllPauses[] = "skipAllPauses"; | 56 static const char skipAllPauses[] = "skipAllPauses"; |
| 52 | 57 |
| 53 } // namespace DebuggerAgentState; | 58 } // namespace DebuggerAgentState; |
| 54 | 59 |
| 55 static const int maxSkipStepFrameCount = 128; | 60 static const int maxSkipStepFrameCount = 128; |
| 56 | 61 |
| 57 const char V8DebuggerAgent::backtraceObjectGroup[] = "backtrace"; | 62 const char V8DebuggerAgent::backtraceObjectGroup[] = "backtrace"; |
| 58 | 63 |
| 59 const int V8DebuggerAgent::unknownAsyncOperationId = 0; | |
| 60 | |
| 61 static String16 breakpointIdSuffix(V8DebuggerAgentImpl::BreakpointSource source) | 64 static String16 breakpointIdSuffix(V8DebuggerAgentImpl::BreakpointSource source) |
| 62 { | 65 { |
| 63 switch (source) { | 66 switch (source) { |
| 64 case V8DebuggerAgentImpl::UserBreakpointSource: | 67 case V8DebuggerAgentImpl::UserBreakpointSource: |
| 65 break; | 68 break; |
| 66 case V8DebuggerAgentImpl::DebugCommandBreakpointSource: | 69 case V8DebuggerAgentImpl::DebugCommandBreakpointSource: |
| 67 return ":debug"; | 70 return ":debug"; |
| 68 case V8DebuggerAgentImpl::MonitorCommandBreakpointSource: | 71 case V8DebuggerAgentImpl::MonitorCommandBreakpointSource: |
| 69 return ":monitor"; | 72 return ":monitor"; |
| 70 } | 73 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 , m_breakReason(protocol::Debugger::Paused::ReasonEnum::Other) | 172 , m_breakReason(protocol::Debugger::Paused::ReasonEnum::Other) |
| 170 , m_scheduledDebuggerStep(NoStep) | 173 , m_scheduledDebuggerStep(NoStep) |
| 171 , m_skipNextDebuggerStepOut(false) | 174 , m_skipNextDebuggerStepOut(false) |
| 172 , m_javaScriptPauseScheduled(false) | 175 , m_javaScriptPauseScheduled(false) |
| 173 , m_steppingFromFramework(false) | 176 , m_steppingFromFramework(false) |
| 174 , m_pausingOnNativeEvent(false) | 177 , m_pausingOnNativeEvent(false) |
| 175 , m_skippedStepFrameCount(0) | 178 , m_skippedStepFrameCount(0) |
| 176 , m_recursionLevelForStepOut(0) | 179 , m_recursionLevelForStepOut(0) |
| 177 , m_recursionLevelForStepFrame(0) | 180 , m_recursionLevelForStepFrame(0) |
| 178 , m_skipAllPauses(false) | 181 , m_skipAllPauses(false) |
| 179 , m_lastAsyncOperationId(0) | |
| 180 , m_maxAsyncCallStackDepth(0) | 182 , m_maxAsyncCallStackDepth(0) |
| 181 , m_currentAsyncCallChain(nullptr) | |
| 182 , m_nestedAsyncCallCount(0) | |
| 183 , m_currentAsyncOperationId(unknownAsyncOperationId) | |
| 184 , m_pendingTraceAsyncOperationCompleted(false) | |
| 185 { | 183 { |
| 186 m_connection->setDebuggerAgent(this); | 184 m_connection->setDebuggerAgent(this); |
| 187 | |
| 188 // FIXME: remove once InjectedScriptManager moves to v8. | |
| 189 m_v8AsyncCallTracker = V8AsyncCallTracker::create(this); | |
| 190 clearBreakDetails(); | 185 clearBreakDetails(); |
| 191 } | 186 } |
| 192 | 187 |
| 193 V8DebuggerAgentImpl::~V8DebuggerAgentImpl() | 188 V8DebuggerAgentImpl::~V8DebuggerAgentImpl() |
| 194 { | 189 { |
| 195 m_connection->setDebuggerAgent(nullptr); | 190 m_connection->setDebuggerAgent(nullptr); |
| 196 } | 191 } |
| 197 | 192 |
| 198 bool V8DebuggerAgentImpl::checkEnabled(ErrorString* errorString) | 193 bool V8DebuggerAgentImpl::checkEnabled(ErrorString* errorString) |
| 199 { | 194 { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 m_skippedStepFrameCount = 0; | 250 m_skippedStepFrameCount = 0; |
| 256 m_recursionLevelForStepFrame = 0; | 251 m_recursionLevelForStepFrame = 0; |
| 257 m_skipAllPauses = false; | 252 m_skipAllPauses = false; |
| 258 m_enabled = false; | 253 m_enabled = false; |
| 259 } | 254 } |
| 260 | 255 |
| 261 void V8DebuggerAgentImpl::internalSetAsyncCallStackDepth(int depth) | 256 void V8DebuggerAgentImpl::internalSetAsyncCallStackDepth(int depth) |
| 262 { | 257 { |
| 263 if (depth <= 0) { | 258 if (depth <= 0) { |
| 264 m_maxAsyncCallStackDepth = 0; | 259 m_maxAsyncCallStackDepth = 0; |
| 265 resetAsyncCallTracker(); | 260 cancelAllAsyncTasks(); |
| 266 } else { | 261 } else { |
| 267 m_maxAsyncCallStackDepth = depth; | 262 m_maxAsyncCallStackDepth = depth; |
| 268 } | 263 } |
| 269 m_v8AsyncCallTracker->asyncCallTrackingStateChanged(m_maxAsyncCallStackDepth ); | |
| 270 } | 264 } |
| 271 | 265 |
| 272 void V8DebuggerAgentImpl::setInspectorState(protocol::DictionaryValue* state) | 266 void V8DebuggerAgentImpl::setInspectorState(protocol::DictionaryValue* state) |
| 273 { | 267 { |
| 274 m_state = state; | 268 m_state = state; |
| 275 } | 269 } |
| 276 | 270 |
| 277 void V8DebuggerAgentImpl::clearFrontend() | 271 void V8DebuggerAgentImpl::clearFrontend() |
| 278 { | 272 { |
| 279 ErrorString error; | 273 ErrorString error; |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 837 { | 831 { |
| 838 if (m_javaScriptPauseScheduled || isPaused()) | 832 if (m_javaScriptPauseScheduled || isPaused()) |
| 839 return; | 833 return; |
| 840 clearBreakDetails(); | 834 clearBreakDetails(); |
| 841 m_pausingOnNativeEvent = false; | 835 m_pausingOnNativeEvent = false; |
| 842 debugger().setPauseOnNextStatement(false); | 836 debugger().setPauseOnNextStatement(false); |
| 843 } | 837 } |
| 844 | 838 |
| 845 bool V8DebuggerAgentImpl::v8AsyncTaskEventsEnabled() const | 839 bool V8DebuggerAgentImpl::v8AsyncTaskEventsEnabled() const |
| 846 { | 840 { |
| 847 return trackingAsyncCalls(); | 841 return m_maxAsyncCallStackDepth; |
| 848 } | 842 } |
| 849 | 843 |
| 850 void V8DebuggerAgentImpl::didReceiveV8AsyncTaskEvent(v8::Local<v8::Context> cont ext, const String16& eventType, const String16& eventName, int id) | 844 void V8DebuggerAgentImpl::didReceiveV8AsyncTaskEvent(v8::Local<v8::Context> cont ext, const String16& eventType, const String16& eventName, int id) |
| 851 { | 845 { |
| 846 ASSERT(m_maxAsyncCallStackDepth); | |
| 847 void* ptr = reinterpret_cast<void*> (id * 2 + 1); | |
|
dgozman
2016/04/06 02:31:08
Should not clash different eventNames.
dgozman
2016/04/06 02:31:09
style: extra space
| |
| 852 ASSERT(trackingAsyncCalls()); | 848 ASSERT(trackingAsyncCalls()); |
| 853 m_v8AsyncCallTracker->didReceiveV8AsyncTaskEvent(context, eventType, eventNa me, id); | 849 if (eventType == v8AsyncTaskEventEnqueue) |
| 850 scheduleAsyncTask(eventName, ptr, false); | |
| 851 else if (eventType == v8AsyncTaskEventWillHandle) | |
| 852 asyncTaskStarted(ptr); | |
| 853 else if (eventType == v8AsyncTaskEventDidHandle) | |
| 854 asyncTaskFinished(ptr); | |
| 855 else | |
| 856 ASSERT_NOT_REACHED(); | |
| 854 } | 857 } |
| 855 | 858 |
| 856 void V8DebuggerAgentImpl::pause(ErrorString* errorString) | 859 void V8DebuggerAgentImpl::pause(ErrorString* errorString) |
| 857 { | 860 { |
| 858 if (!checkEnabled(errorString)) | 861 if (!checkEnabled(errorString)) |
| 859 return; | 862 return; |
| 860 if (m_javaScriptPauseScheduled || isPaused()) | 863 if (m_javaScriptPauseScheduled || isPaused()) |
| 861 return; | 864 return; |
| 862 clearBreakDetails(); | 865 clearBreakDetails(); |
| 863 m_javaScriptPauseScheduled = true; | 866 m_javaScriptPauseScheduled = true; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1039 } | 1042 } |
| 1040 | 1043 |
| 1041 void V8DebuggerAgentImpl::setAsyncCallStackDepth(ErrorString* errorString, int d epth) | 1044 void V8DebuggerAgentImpl::setAsyncCallStackDepth(ErrorString* errorString, int d epth) |
| 1042 { | 1045 { |
| 1043 if (!checkEnabled(errorString)) | 1046 if (!checkEnabled(errorString)) |
| 1044 return; | 1047 return; |
| 1045 m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, depth); | 1048 m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, depth); |
| 1046 internalSetAsyncCallStackDepth(depth); | 1049 internalSetAsyncCallStackDepth(depth); |
| 1047 } | 1050 } |
| 1048 | 1051 |
| 1049 int V8DebuggerAgentImpl::traceAsyncOperationStarting(const String16& description ) | 1052 void V8DebuggerAgentImpl::scheduleAsyncTask(const String16& taskName, void* task , bool recurring) |
| 1050 { | 1053 { |
| 1051 v8::HandleScope scope(m_isolate); | 1054 v8::HandleScope scope(m_isolate); |
|
dgozman
2016/04/06 02:31:09
Bailout if async is not enabled.
| |
| 1052 OwnPtr<V8StackTraceImpl> chain = V8StackTraceImpl::capture(this, V8StackTrac e::maxCallStackSizeToCapture, description); | 1055 OwnPtr<V8StackTraceImpl> chain = V8StackTraceImpl::capture(this, V8StackTrac e::maxCallStackSizeToCapture, taskName); |
| 1053 | 1056 if (chain) { |
| 1054 do { | 1057 m_asyncTaskStacks.set(task, chain.release()); |
| 1055 ++m_lastAsyncOperationId; | 1058 m_recurringTasks.add(task); |
|
dgozman
2016/04/06 02:31:08
if (recurring)
| |
| 1056 if (m_lastAsyncOperationId <= 0) | |
| 1057 m_lastAsyncOperationId = 1; | |
| 1058 } while (m_asyncOperations.contains(m_lastAsyncOperationId)); | |
| 1059 | |
| 1060 if (chain) | |
| 1061 m_asyncOperations.set(m_lastAsyncOperationId, chain.release()); | |
| 1062 | |
| 1063 return m_lastAsyncOperationId; | |
| 1064 } | |
| 1065 | |
| 1066 void V8DebuggerAgentImpl::traceAsyncCallbackStarting(int operationId) | |
| 1067 { | |
| 1068 ASSERT(operationId > 0 || operationId == unknownAsyncOperationId); | |
| 1069 V8StackTraceImpl* chain = operationId > 0 ? m_asyncOperations.get(operationI d) : nullptr; | |
| 1070 // FIXME: extract recursion check into a delegate. | |
| 1071 bool hasRecursionLevel = m_debugger->client()->hasRecursionLevel(); | |
|
dgozman
2016/04/06 02:31:09
Remove hasRecursionLevel.
| |
| 1072 if (chain && !hasRecursionLevel) { | |
| 1073 // There can be still an old m_currentAsyncCallChain set if we start run ning Microtasks | |
| 1074 // right after executing a JS callback but before the corresponding trac eAsyncCallbackCompleted(). | |
| 1075 // In this case just call traceAsyncCallbackCompleted() now, and the sub sequent ones will be ignored. | |
| 1076 // | |
| 1077 // The nested levels count may be greater than 1, for example, when even ts are guarded via custom | |
| 1078 // traceAsync* calls, like in window.postMessage(). In this case there w ill be a willHandleEvent | |
| 1079 // instrumentation with unknownAsyncOperationId bumping up the nested le vels count. | |
| 1080 if (m_currentAsyncCallChain) { | |
| 1081 ASSERT(m_nestedAsyncCallCount >= 1); | |
| 1082 m_nestedAsyncCallCount = 1; | |
| 1083 traceAsyncCallbackCompleted(); | |
| 1084 } | |
| 1085 | |
| 1086 // Current AsyncCallChain corresponds to the bottommost JS call frame. | |
| 1087 ASSERT(!m_currentAsyncCallChain); | |
| 1088 m_currentAsyncCallChain = chain->clone(); | |
| 1089 m_currentAsyncOperationId = operationId; | |
| 1090 m_pendingTraceAsyncOperationCompleted = false; | |
| 1091 m_nestedAsyncCallCount = 1; | |
| 1092 } else { | |
| 1093 if (m_currentAsyncCallChain) | |
| 1094 ++m_nestedAsyncCallCount; | |
| 1095 } | 1059 } |
| 1096 } | 1060 } |
| 1097 | 1061 |
| 1098 void V8DebuggerAgentImpl::traceAsyncCallbackCompleted() | 1062 void V8DebuggerAgentImpl::cancelAsyncTask(void* task) |
| 1099 { | 1063 { |
| 1100 if (!m_nestedAsyncCallCount) | 1064 m_asyncTaskStacks.remove(task); |
|
dgozman
2016/04/06 02:31:09
Bailout if async is not enabled.
| |
| 1101 return; | 1065 m_recurringTasks.remove(task); |
| 1102 ASSERT(m_currentAsyncCallChain); | |
| 1103 --m_nestedAsyncCallCount; | |
| 1104 if (!m_nestedAsyncCallCount) | |
| 1105 clearCurrentAsyncOperation(); | |
| 1106 } | 1066 } |
| 1107 | 1067 |
| 1108 void V8DebuggerAgentImpl::traceAsyncOperationCompleted(int operationId) | 1068 void V8DebuggerAgentImpl::cancelAllAsyncTasks() |
| 1109 { | 1069 { |
| 1110 ASSERT(operationId > 0 || operationId == unknownAsyncOperationId); | 1070 m_asyncTaskStacks.clear(); |
| 1111 if (operationId > 0) { | 1071 m_recurringTasks.clear(); |
| 1112 if (m_currentAsyncOperationId == operationId) { | |
| 1113 if (m_pendingTraceAsyncOperationCompleted) { | |
| 1114 m_pendingTraceAsyncOperationCompleted = false; | |
| 1115 } else { | |
| 1116 // Delay traceAsyncOperationCompleted() until the last async cal lback (being currently executed) is done. | |
| 1117 m_pendingTraceAsyncOperationCompleted = true; | |
| 1118 return; | |
| 1119 } | |
| 1120 } | |
| 1121 m_asyncOperations.remove(operationId); | |
| 1122 } | |
| 1123 } | 1072 } |
| 1124 | 1073 |
| 1125 void V8DebuggerAgentImpl::clearCurrentAsyncOperation() | 1074 void V8DebuggerAgentImpl::asyncTaskStarted(void* task) |
| 1126 { | 1075 { |
| 1127 if (m_pendingTraceAsyncOperationCompleted && m_currentAsyncOperationId != un knownAsyncOperationId) | 1076 m_currentTasks.append(task); |
| 1128 traceAsyncOperationCompleted(m_currentAsyncOperationId); | |
| 1129 | |
| 1130 m_currentAsyncOperationId = unknownAsyncOperationId; | |
| 1131 m_pendingTraceAsyncOperationCompleted = false; | |
| 1132 m_nestedAsyncCallCount = 0; | |
| 1133 m_currentAsyncCallChain.clear(); | |
| 1134 } | 1077 } |
| 1135 | 1078 |
| 1136 void V8DebuggerAgentImpl::resetAsyncCallTracker() | 1079 void V8DebuggerAgentImpl::asyncTaskFinished(void* task) |
| 1137 { | 1080 { |
| 1138 clearCurrentAsyncOperation(); | 1081 ASSERT(m_currentTasks.size() && m_currentTasks.last() == task); |
|
dgozman
2016/04/06 02:31:09
Embed cookie logic into AsyncTask.
| |
| 1139 m_v8AsyncCallTracker->resetAsyncOperations(); | 1082 m_currentTasks.removeLast(); |
| 1140 m_asyncOperations.clear(); | 1083 if (!m_recurringTasks.contains(task)) |
| 1084 m_asyncTaskStacks.remove(task); | |
| 1141 } | 1085 } |
| 1142 | 1086 |
| 1143 void V8DebuggerAgentImpl::setBlackboxedRanges(ErrorString* error, const String16 & scriptId, PassOwnPtr<protocol::Array<protocol::Debugger::ScriptPosition>> inPo sitions) | 1087 void V8DebuggerAgentImpl::setBlackboxedRanges(ErrorString* error, const String16 & scriptId, PassOwnPtr<protocol::Array<protocol::Debugger::ScriptPosition>> inPo sitions) |
| 1144 { | 1088 { |
| 1145 if (!m_scripts.contains(scriptId)) { | 1089 if (!m_scripts.contains(scriptId)) { |
| 1146 *error = "No script with passed id."; | 1090 *error = "No script with passed id."; |
| 1147 return; | 1091 return; |
| 1148 } | 1092 } |
| 1149 | 1093 |
| 1150 if (!inPositions->length()) { | 1094 if (!inPositions->length()) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1282 | 1226 |
| 1283 protocol::ErrorSupport errorSupport; | 1227 protocol::ErrorSupport errorSupport; |
| 1284 OwnPtr<Array<CallFrame>> callFrames = Array<CallFrame>::parse(toProtocolValu e(context, objects).get(), &errorSupport); | 1228 OwnPtr<Array<CallFrame>> callFrames = Array<CallFrame>::parse(toProtocolValu e(context, objects).get(), &errorSupport); |
| 1285 if (hasInternalError(errorString, !callFrames)) | 1229 if (hasInternalError(errorString, !callFrames)) |
| 1286 return Array<CallFrame>::create(); | 1230 return Array<CallFrame>::create(); |
| 1287 return callFrames.release(); | 1231 return callFrames.release(); |
| 1288 } | 1232 } |
| 1289 | 1233 |
| 1290 PassOwnPtr<StackTrace> V8DebuggerAgentImpl::currentAsyncStackTrace() | 1234 PassOwnPtr<StackTrace> V8DebuggerAgentImpl::currentAsyncStackTrace() |
| 1291 { | 1235 { |
| 1292 if (m_pausedContext.IsEmpty() || !trackingAsyncCalls() || !m_currentAsyncCal lChain) | 1236 if (m_pausedContext.IsEmpty() || !m_maxAsyncCallStackDepth || !m_currentTask s.size()) |
| 1293 return nullptr; | 1237 return nullptr; |
| 1294 | 1238 |
| 1295 return m_currentAsyncCallChain->buildInspectorObjectForTail(this); | 1239 return m_asyncTaskStacks.get(m_currentTasks.last())->buildInspectorObjectFor Tail(this); |
| 1296 } | 1240 } |
| 1297 | 1241 |
| 1298 V8StackTraceImpl* V8DebuggerAgentImpl::currentAsyncCallChain() | 1242 V8StackTraceImpl* V8DebuggerAgentImpl::currentAsyncCallChain() |
| 1299 { | 1243 { |
| 1300 return trackingAsyncCalls() ? m_currentAsyncCallChain.get() : nullptr; | 1244 if (!m_currentTasks.size()) |
| 1245 return nullptr; | |
| 1246 return m_asyncTaskStacks.get(m_currentTasks.last()); | |
| 1301 } | 1247 } |
| 1302 | 1248 |
| 1303 void V8DebuggerAgentImpl::didParseSource(const V8DebuggerParsedScript& parsedScr ipt) | 1249 void V8DebuggerAgentImpl::didParseSource(const V8DebuggerParsedScript& parsedScr ipt) |
| 1304 { | 1250 { |
| 1305 V8DebuggerScript script = parsedScript.script; | 1251 V8DebuggerScript script = parsedScript.script; |
| 1306 | 1252 |
| 1307 bool isDeprecatedSourceURL = false; | 1253 bool isDeprecatedSourceURL = false; |
| 1308 if (!parsedScript.success) | 1254 if (!parsedScript.success) |
| 1309 script.setSourceURL(V8ContentSearchUtil::findSourceURL(script.source(), false, &isDeprecatedSourceURL)); | 1255 script.setSourceURL(V8ContentSearchUtil::findSourceURL(script.source(), false, &isDeprecatedSourceURL)); |
| 1310 else if (script.hasSourceURL()) | 1256 else if (script.hasSourceURL()) |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1500 } | 1446 } |
| 1501 | 1447 |
| 1502 void V8DebuggerAgentImpl::reset() | 1448 void V8DebuggerAgentImpl::reset() |
| 1503 { | 1449 { |
| 1504 if (!enabled()) | 1450 if (!enabled()) |
| 1505 return; | 1451 return; |
| 1506 m_scheduledDebuggerStep = NoStep; | 1452 m_scheduledDebuggerStep = NoStep; |
| 1507 m_scripts.clear(); | 1453 m_scripts.clear(); |
| 1508 m_blackboxedPositions.clear(); | 1454 m_blackboxedPositions.clear(); |
| 1509 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1455 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 1510 resetAsyncCallTracker(); | 1456 cancelAllAsyncTasks(); |
| 1511 } | 1457 } |
| 1512 | 1458 |
| 1513 } // namespace blink | 1459 } // namespace blink |
| OLD | NEW |