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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 if (m_asyncCallStackTracker.isEnabled()) | 831 if (m_asyncCallStackTracker.isEnabled()) |
832 m_asyncCallStackTracker.willPerformExecutionContextTask(context, task); | 832 m_asyncCallStackTracker.willPerformExecutionContextTask(context, task); |
833 } | 833 } |
834 | 834 |
835 void InspectorDebuggerAgent::didPerformExecutionContextTask() | 835 void InspectorDebuggerAgent::didPerformExecutionContextTask() |
836 { | 836 { |
837 if (m_asyncCallStackTracker.isEnabled()) | 837 if (m_asyncCallStackTracker.isEnabled()) |
838 m_asyncCallStackTracker.didFireAsyncCall(); | 838 m_asyncCallStackTracker.didFireAsyncCall(); |
839 } | 839 } |
840 | 840 |
| 841 int InspectorDebuggerAgent::traceAsyncOperationStarting(ExecutionContext* contex
t, const String& operationName) |
| 842 { |
| 843 if (m_asyncCallStackTracker.isEnabled()) |
| 844 return m_asyncCallStackTracker.traceAsyncOperationStarting(context, oper
ationName, scriptDebugServer().currentCallFramesForAsyncStack()); |
| 845 return 0; |
| 846 } |
| 847 |
| 848 void InspectorDebuggerAgent::traceAsyncOperationCompleted(ExecutionContext* cont
ext, int operationId) |
| 849 { |
| 850 if (m_asyncCallStackTracker.isEnabled()) |
| 851 m_asyncCallStackTracker.traceAsyncOperationCompleted(context, operationI
d); |
| 852 } |
| 853 |
| 854 void InspectorDebuggerAgent::traceAsyncOperationCompletedCallbackStarting(Execut
ionContext* context, int operationId) |
| 855 { |
| 856 if (!m_asyncCallStackTracker.isEnabled()) |
| 857 return; |
| 858 m_asyncCallStackTracker.traceAsyncCallbackStarting(context, operationId); |
| 859 m_asyncCallStackTracker.traceAsyncOperationCompleted(context, operationId); |
| 860 } |
| 861 |
| 862 void InspectorDebuggerAgent::traceAsyncCallbackStarting(ExecutionContext* contex
t, int operationId) |
| 863 { |
| 864 if (m_asyncCallStackTracker.isEnabled()) |
| 865 m_asyncCallStackTracker.traceAsyncCallbackStarting(context, operationId)
; |
| 866 } |
| 867 |
| 868 void InspectorDebuggerAgent::traceAsyncCallbackCompleted() |
| 869 { |
| 870 if (m_asyncCallStackTracker.isEnabled()) |
| 871 m_asyncCallStackTracker.didFireAsyncCall(); |
| 872 } |
| 873 |
841 void InspectorDebuggerAgent::didReceiveV8AsyncTaskEvent(ExecutionContext* contex
t, const String& eventType, const String& eventName, int id) | 874 void InspectorDebuggerAgent::didReceiveV8AsyncTaskEvent(ExecutionContext* contex
t, const String& eventType, const String& eventName, int id) |
842 { | 875 { |
843 if (!m_asyncCallStackTracker.isEnabled()) | 876 if (!m_asyncCallStackTracker.isEnabled()) |
844 return; | 877 return; |
845 if (eventType == v8AsyncTaskEventEnqueue) | 878 if (eventType == v8AsyncTaskEventEnqueue) |
846 m_asyncCallStackTracker.didEnqueueV8AsyncTask(context, eventName, id, sc
riptDebugServer().currentCallFramesForAsyncStack()); | 879 m_asyncCallStackTracker.didEnqueueV8AsyncTask(context, eventName, id, sc
riptDebugServer().currentCallFramesForAsyncStack()); |
847 else if (eventType == v8AsyncTaskEventWillHandle) | 880 else if (eventType == v8AsyncTaskEventWillHandle) |
848 m_asyncCallStackTracker.willHandleV8AsyncTask(context, eventName, id); | 881 m_asyncCallStackTracker.willHandleV8AsyncTask(context, eventName, id); |
849 else if (eventType == v8AsyncTaskEventDidHandle) | 882 else if (eventType == v8AsyncTaskEventDidHandle) |
850 m_asyncCallStackTracker.didFireAsyncCall(); | 883 m_asyncCallStackTracker.didFireAsyncCall(); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 ASSERT_NOT_REACHED(); | 1144 ASSERT_NOT_REACHED(); |
1112 return Array<CallFrame>::create(); | 1145 return Array<CallFrame>::create(); |
1113 } | 1146 } |
1114 return injectedScript.wrapCallFrames(m_currentCallStack, 0); | 1147 return injectedScript.wrapCallFrames(m_currentCallStack, 0); |
1115 } | 1148 } |
1116 | 1149 |
1117 PassRefPtr<StackTrace> InspectorDebuggerAgent::currentAsyncStackTrace() | 1150 PassRefPtr<StackTrace> InspectorDebuggerAgent::currentAsyncStackTrace() |
1118 { | 1151 { |
1119 if (!m_pausedScriptState || !m_asyncCallStackTracker.isEnabled()) | 1152 if (!m_pausedScriptState || !m_asyncCallStackTracker.isEnabled()) |
1120 return nullptr; | 1153 return nullptr; |
1121 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
_pausedScriptState.get()); | |
1122 if (injectedScript.isEmpty()) { | |
1123 ASSERT_NOT_REACHED(); | |
1124 return nullptr; | |
1125 } | |
1126 const AsyncCallStackTracker::AsyncCallChain* chain = m_asyncCallStackTracker
.currentAsyncCallChain(); | 1154 const AsyncCallStackTracker::AsyncCallChain* chain = m_asyncCallStackTracker
.currentAsyncCallChain(); |
1127 if (!chain) | 1155 if (!chain) |
1128 return nullptr; | 1156 return nullptr; |
1129 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = chain->callS
tacks(); | 1157 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = chain->callS
tacks(); |
1130 if (callStacks.isEmpty()) | 1158 if (callStacks.isEmpty()) |
1131 return nullptr; | 1159 return nullptr; |
1132 RefPtr<StackTrace> result; | 1160 RefPtr<StackTrace> result; |
1133 int asyncOrdinal = callStacks.size(); | 1161 int asyncOrdinal = callStacks.size(); |
1134 for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it
= callStacks.rbegin(); it != callStacks.rend(); ++it) { | 1162 for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it
= callStacks.rbegin(); it != callStacks.rend(); ++it, --asyncOrdinal) { |
| 1163 ScriptValue callFrames = (*it)->callFrames(); |
| 1164 ScriptState* scriptState = callFrames.scriptState(); |
| 1165 InjectedScript injectedScript = scriptState ? m_injectedScriptManager->i
njectedScriptFor(scriptState) : InjectedScript(); |
| 1166 if (injectedScript.isEmpty()) { |
| 1167 result.clear(); |
| 1168 continue; |
| 1169 } |
1135 RefPtr<StackTrace> next = StackTrace::create() | 1170 RefPtr<StackTrace> next = StackTrace::create() |
1136 .setCallFrames(injectedScript.wrapCallFrames((*it)->callFrames(), as
yncOrdinal--)) | 1171 .setCallFrames(injectedScript.wrapCallFrames(callFrames, asyncOrdina
l)) |
1137 .release(); | 1172 .release(); |
1138 next->setDescription((*it)->description()); | 1173 next->setDescription((*it)->description()); |
1139 if (result) | 1174 if (result) |
1140 next->setAsyncStackTrace(result.release()); | 1175 next->setAsyncStackTrace(result.release()); |
1141 result.swap(next); | 1176 result.swap(next); |
1142 } | 1177 } |
1143 return result.release(); | 1178 return result.release(); |
1144 } | 1179 } |
1145 | 1180 |
1146 static PassRefPtrWillBeRawPtr<ScriptCallStack> toScriptCallStack(JavaScriptCallF
rame* callFrame) | 1181 static PassRefPtrWillBeRawPtr<ScriptCallStack> toScriptCallStack(JavaScriptCallF
rame* callFrame) |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 { | 1427 { |
1393 m_scripts.clear(); | 1428 m_scripts.clear(); |
1394 m_breakpointIdToDebugServerBreakpointIds.clear(); | 1429 m_breakpointIdToDebugServerBreakpointIds.clear(); |
1395 m_asyncCallStackTracker.clear(); | 1430 m_asyncCallStackTracker.clear(); |
1396 if (m_frontend) | 1431 if (m_frontend) |
1397 m_frontend->globalObjectCleared(); | 1432 m_frontend->globalObjectCleared(); |
1398 } | 1433 } |
1399 | 1434 |
1400 } // namespace blink | 1435 } // namespace blink |
1401 | 1436 |
OLD | NEW |