Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1254)

Unified Diff: Source/core/inspector/InspectorDebuggerAgent.cpp

Issue 404953003: DevTools: Async call stacks for window.postMessage() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InspectorDebuggerAgent.h ('k') | Source/core/inspector/InspectorInstrumentation.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorDebuggerAgent.cpp
diff --git a/Source/core/inspector/InspectorDebuggerAgent.cpp b/Source/core/inspector/InspectorDebuggerAgent.cpp
index 4932370d8bbd1e19199d2cf9d7575621c6a53734..1fa75ee4727694f4fbea9d6407a380e4f047ec6a 100644
--- a/Source/core/inspector/InspectorDebuggerAgent.cpp
+++ b/Source/core/inspector/InspectorDebuggerAgent.cpp
@@ -838,6 +838,39 @@ void InspectorDebuggerAgent::didPerformExecutionContextTask()
m_asyncCallStackTracker.didFireAsyncCall();
}
+int InspectorDebuggerAgent::traceAsyncOperationStarting(ExecutionContext* context, const String& operationName)
+{
+ if (m_asyncCallStackTracker.isEnabled())
+ return m_asyncCallStackTracker.traceAsyncOperationStarting(context, operationName, scriptDebugServer().currentCallFramesForAsyncStack());
+ return 0;
+}
+
+void InspectorDebuggerAgent::traceAsyncOperationCompleted(ExecutionContext* context, int operationId)
+{
+ if (m_asyncCallStackTracker.isEnabled())
+ m_asyncCallStackTracker.traceAsyncOperationCompleted(context, operationId);
+}
+
+void InspectorDebuggerAgent::traceAsyncOperationCompletedCallbackStarting(ExecutionContext* context, int operationId)
+{
+ if (!m_asyncCallStackTracker.isEnabled())
+ return;
+ m_asyncCallStackTracker.traceAsyncCallbackStarting(context, operationId);
+ m_asyncCallStackTracker.traceAsyncOperationCompleted(context, operationId);
+}
+
+void InspectorDebuggerAgent::traceAsyncCallbackStarting(ExecutionContext* context, int operationId)
+{
+ if (m_asyncCallStackTracker.isEnabled())
+ m_asyncCallStackTracker.traceAsyncCallbackStarting(context, operationId);
+}
+
+void InspectorDebuggerAgent::traceAsyncCallbackCompleted()
+{
+ if (m_asyncCallStackTracker.isEnabled())
+ m_asyncCallStackTracker.didFireAsyncCall();
+}
+
void InspectorDebuggerAgent::didReceiveV8AsyncTaskEvent(ExecutionContext* context, const String& eventType, const String& eventName, int id)
{
if (!m_asyncCallStackTracker.isEnabled())
@@ -1118,11 +1151,6 @@ PassRefPtr<StackTrace> InspectorDebuggerAgent::currentAsyncStackTrace()
{
if (!m_pausedScriptState || !m_asyncCallStackTracker.isEnabled())
return nullptr;
- InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m_pausedScriptState.get());
- if (injectedScript.isEmpty()) {
- ASSERT_NOT_REACHED();
- return nullptr;
- }
const AsyncCallStackTracker::AsyncCallChain* chain = m_asyncCallStackTracker.currentAsyncCallChain();
if (!chain)
return nullptr;
@@ -1131,9 +1159,16 @@ PassRefPtr<StackTrace> InspectorDebuggerAgent::currentAsyncStackTrace()
return nullptr;
RefPtr<StackTrace> result;
int asyncOrdinal = callStacks.size();
- for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it = callStacks.rbegin(); it != callStacks.rend(); ++it) {
+ for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it = callStacks.rbegin(); it != callStacks.rend(); ++it, --asyncOrdinal) {
+ ScriptValue callFrames = (*it)->callFrames();
+ ScriptState* scriptState = callFrames.scriptState();
+ InjectedScript injectedScript = scriptState ? m_injectedScriptManager->injectedScriptFor(scriptState) : InjectedScript();
+ if (injectedScript.isEmpty()) {
+ result.clear();
+ continue;
+ }
RefPtr<StackTrace> next = StackTrace::create()
- .setCallFrames(injectedScript.wrapCallFrames((*it)->callFrames(), asyncOrdinal--))
+ .setCallFrames(injectedScript.wrapCallFrames(callFrames, asyncOrdinal))
.release();
next->setDescription((*it)->description());
if (result)
« no previous file with comments | « Source/core/inspector/InspectorDebuggerAgent.h ('k') | Source/core/inspector/InspectorInstrumentation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698