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

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

Issue 855383002: DevTools: use async operation id instead of AsyncCallChain (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 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
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.

Powered by Google App Engine
This is Rietveld 408576698