Index: Source/core/inspector/InspectorDebuggerAgent.cpp |
diff --git a/Source/core/inspector/InspectorDebuggerAgent.cpp b/Source/core/inspector/InspectorDebuggerAgent.cpp |
index 55d9b7266e099f20f6df6f782f8995a0ed9fd9bd..c827a833c78cc2ed68e2d5df70b8ea1109d3f7e2 100644 |
--- a/Source/core/inspector/InspectorDebuggerAgent.cpp |
+++ b/Source/core/inspector/InspectorDebuggerAgent.cpp |
@@ -657,11 +657,62 @@ void InspectorDebuggerAgent::cancelPauseOnNextStatement() |
scriptDebugServer().setPauseOnNextStatement(false); |
} |
+void InspectorDebuggerAgent::requestAsyncCallFramesIfNeeded() |
+{ |
+ if (m_asyncCallStackTracker.isEnabled()) |
+ scriptDebugServer().requestAsyncCallFrames(); |
yurys
2013/11/28 09:18:16
Why do we need this roundtrip into the debug serve
|
+} |
+ |
+void InspectorDebuggerAgent::didRequestAsyncCallFrames(ScriptValue callFrames) |
+{ |
+ m_asyncCallStackTracker.didRequestAsyncCallFrames(callFrames); |
+} |
+ |
+void InspectorDebuggerAgent::didInstallTimer(ExecutionContext*, int timerId, int timeout, bool singleShot) |
+{ |
+ m_asyncCallStackTracker.didInstallTimer(timerId, singleShot); |
+ requestAsyncCallFramesIfNeeded(); |
+} |
+ |
+void InspectorDebuggerAgent::didRemoveTimer(ExecutionContext*, int timerId) |
+{ |
+ m_asyncCallStackTracker.didRemoveTimer(timerId); |
+} |
+ |
+bool InspectorDebuggerAgent::willFireTimer(ExecutionContext*, int timerId) |
+{ |
+ m_asyncCallStackTracker.willFireTimer(timerId); |
+ return true; |
+} |
+ |
void InspectorDebuggerAgent::didFireTimer() |
{ |
+ m_asyncCallStackTracker.didAsyncCall(); |
cancelPauseOnNextStatement(); |
} |
+void InspectorDebuggerAgent::didRequestAnimationFrame(Document*, int callbackId) |
+{ |
+ m_asyncCallStackTracker.didRequestAnimationFrame(callbackId); |
+ requestAsyncCallFramesIfNeeded(); |
+} |
+ |
+void InspectorDebuggerAgent::didCancelAnimationFrame(Document*, int callbackId) |
+{ |
+ m_asyncCallStackTracker.didCancelAnimationFrame(callbackId); |
+} |
+ |
+bool InspectorDebuggerAgent::willFireAnimationFrame(Document*, int callbackId) |
+{ |
+ m_asyncCallStackTracker.willFireAnimationFrame(callbackId); |
+ return true; |
+} |
+ |
+void InspectorDebuggerAgent::didFireAnimationFrame() |
+{ |
+ m_asyncCallStackTracker.didAsyncCall(); |
+} |
+ |
void InspectorDebuggerAgent::didHandleEvent() |
{ |
cancelPauseOnNextStatement(); |
@@ -886,6 +937,11 @@ void InspectorDebuggerAgent::skipStackFrames(ErrorString* errorString, const Str |
m_cachedSkipStackRegExp = compiled.release(); |
} |
+void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString*, int depth) |
+{ |
+ m_asyncCallStackTracker.setAsyncCallStackDepth(depth); |
+} |
+ |
void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directiveText) |
{ |
if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontPauseOnExceptions) { |
@@ -904,7 +960,19 @@ PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() |
ASSERT_NOT_REACHED(); |
return Array<CallFrame>::create(); |
} |
- return injectedScript.wrapCallFrames(m_currentCallStack); |
+ RefPtr<Array<CallFrame> > result = injectedScript.wrapCallFrames(m_currentCallStack); |
+ if (!result->length()) |
+ return result.release(); |
+ RefPtr<Array<CallFrame> > lastCallFrames = result; |
+ AsyncCallStackTracker::AsyncCallStackIterator asyncCallStacks = m_asyncCallStackTracker.currentAsyncCallStack(); |
+ while (asyncCallStacks.hasNext()) { |
+ RefPtr<CallFrame> last = CallFrame::runtimeCast(lastCallFrames->asArray()->get(lastCallFrames->length() - 1)); |
+ lastCallFrames = injectedScript.wrapCallFrames(asyncCallStacks.next()); |
+ if (!lastCallFrames->length()) |
+ break; |
+ last->setAsyncCallFrames(lastCallFrames); |
+ } |
+ return result.release(); |
} |
String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script) |
@@ -989,7 +1057,7 @@ void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValu |
InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); |
if (!injectedScript.hasNoValue()) { |
m_breakReason = InspectorFrontend::Debugger::Reason::Exception; |
- m_breakAuxData = injectedScript.wrapObject(exception, "backtrace")->openAccessors(); |
+ m_breakAuxData = injectedScript.wrapObject(exception, InspectorDebuggerAgent::backtraceObjectGroup)->openAccessors(); |
// m_breakAuxData might be null after this. |
} |
} |
@@ -1047,6 +1115,7 @@ void InspectorDebuggerAgent::clear() |
m_currentCallStack = ScriptValue(); |
m_scripts.clear(); |
m_breakpointIdToDebugServerBreakpointIds.clear(); |
+ m_asyncCallStackTracker.clear(); |
m_continueToLocationBreakpointId = String(); |
clearBreakDetails(); |
m_javaScriptPauseScheduled = false; |
@@ -1085,6 +1154,7 @@ void InspectorDebuggerAgent::reset() |
{ |
m_scripts.clear(); |
m_breakpointIdToDebugServerBreakpointIds.clear(); |
+ m_asyncCallStackTracker.clear(); |
if (m_frontend) |
m_frontend->globalObjectCleared(); |
} |