Chromium Code Reviews| Index: Source/core/inspector/InspectorDebuggerAgent.cpp |
| diff --git a/Source/core/inspector/InspectorDebuggerAgent.cpp b/Source/core/inspector/InspectorDebuggerAgent.cpp |
| index df2226a25f1bb75766ae04149c800130e49f42c3..9f03de7e0aa70fe7f13f54a88d1ad11a64c75606 100644 |
| --- a/Source/core/inspector/InspectorDebuggerAgent.cpp |
| +++ b/Source/core/inspector/InspectorDebuggerAgent.cpp |
| @@ -130,6 +130,7 @@ InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager* injectedSc |
| , m_skipContentScripts(false) |
| , m_cachedSkipStackGeneration(0) |
| , m_promiseTracker(PromiseTracker::create()) |
| + , m_nextAsyncOperationId(1) |
| , m_maxAsyncCallStackDepth(0) |
| , m_currentAsyncCallChain(nullptr) |
| , m_nestedAsyncCallCount(0) |
| @@ -1083,19 +1084,26 @@ const AsyncCallChain* InspectorDebuggerAgent::currentAsyncCallChain() const |
| return m_currentAsyncCallChain.get(); |
| } |
| -PassRefPtrWillBeRawPtr<AsyncCallChain> InspectorDebuggerAgent::traceAsyncOperationStarting(const String& description) |
| +int InspectorDebuggerAgent::traceAsyncOperationStarting(const String& description) |
| { |
| ScriptValue callFrames = scriptDebugServer().currentCallFramesForAsyncStack(); |
| if (callFrames.isEmpty()) { |
| if (!m_currentAsyncCallChain) |
| - return nullptr; |
| - RefPtrWillBeRawPtr<AsyncCallChain> chain = AsyncCallChain::create(nullptr, m_currentAsyncCallChain.get(), m_maxAsyncCallStackDepth); |
| - didCreateAsyncCallChain(chain.get()); |
| - return chain.release(); // Propagate async call stack chain. |
| + return 0; |
| + return createAsyncCallChain(nullptr); |
| } |
| - RefPtrWillBeRawPtr<AsyncCallChain> chain = AsyncCallChain::create(adoptRefWillBeNoop(new AsyncCallStack(description, callFrames)), m_currentAsyncCallChain.get(), m_maxAsyncCallStackDepth); |
| + return createAsyncCallChain(adoptRefWillBeNoop(new AsyncCallStack(description, callFrames))); |
| +} |
| + |
| +int InspectorDebuggerAgent::createAsyncCallChain(PassRefPtrWillBeRawPtr<AsyncCallStack> callStack) |
|
aandrey
2015/01/20 14:33:36
inline this method?
yurys
2015/01/20 17:15:38
Done.
|
| +{ |
| + RefPtrWillBeRawPtr<AsyncCallChain> chain = AsyncCallChain::create(callStack, m_currentAsyncCallChain.get(), m_maxAsyncCallStackDepth); |
| + while (!m_nextAsyncOperationId || m_asyncOperations.contains(m_nextAsyncOperationId)) |
| + ++m_nextAsyncOperationId; |
| + int id = m_nextAsyncOperationId++; |
|
aandrey
2015/01/20 14:33:36
should be circular, never negative
yurys
2015/01/20 17:15:38
Done.
|
| + m_asyncOperations.set(id, chain); |
| didCreateAsyncCallChain(chain.get()); |
| - return chain.release(); |
| + return id; |
| } |
| 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.
|
| @@ -1126,8 +1134,9 @@ void InspectorDebuggerAgent::traceAsyncCallbackCompleted() |
| } |
| } |
| -void InspectorDebuggerAgent::traceAsyncCallbackStarting(v8::Isolate* isolate, PassRefPtrWillBeRawPtr<AsyncCallChain> chain) |
| +void InspectorDebuggerAgent::traceAsyncCallbackStarting(v8::Isolate* isolate, int operationId) |
| { |
| + AsyncCallChain* chain = m_asyncOperations.get(operationId); |
|
aandrey
2015/01/20 14:33:36
ASSERT(operationId > 0);
yurys
2015/01/20 17:15:38
Done.
|
| int recursionLevel = V8RecursionScope::recursionLevel(isolate); |
| if (chain && (!recursionLevel || (recursionLevel == 1 && Microtask::performingCheckpoint(isolate)))) { |
| // Current AsyncCallChain corresponds to the bottommost JS call frame. |
| @@ -1148,8 +1157,9 @@ void InspectorDebuggerAgent::traceAsyncCallbackStarting(v8::Isolate* isolate, Pa |
| } |
| } |
| -void InspectorDebuggerAgent::traceAsyncOperationCompleted(AsyncCallChain* chain) |
| +void InspectorDebuggerAgent::traceAsyncOperationCompleted(int operationId) |
| { |
| + RefPtrWillBeRawPtr<AsyncCallChain> chain = m_asyncOperations.take(operationId); |
|
aandrey
2015/01/20 14:33:36
ditto
yurys
2015/01/20 17:15:38
Done.
|
| if (!m_performingAsyncStepIn) |
| return; |
| 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.
|