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

Unified Diff: src/inspector/v8-debugger.cc

Issue 2825903002: [inspector] deduplicate stack frames (Closed)
Patch Set: cleanup cache after stack trace collected Created 3 years, 8 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: src/inspector/v8-debugger.cc
diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc
index fd8c93ca9026e94bc0953d4713d10c893d69694f..d093f28d287b6198a358f0319dba77e19d615fe2 100644
--- a/src/inspector/v8-debugger.cc
+++ b/src/inspector/v8-debugger.cc
@@ -1031,6 +1031,11 @@ void V8Debugger::collectOldAsyncStacksIfNeeded() {
parentLeft.insert(it);
}
m_parentTask.swap(parentLeft);
+ std::map<int, std::weak_ptr<StackFrame>> framesCache;
+ for (auto it : m_framesCache) {
+ if (!it.second.expired()) framesCache.insert(it);
+ }
+ m_framesCache.swap(framesCache);
}
void V8Debugger::removeOldAsyncTasks(AsyncTaskToStackTrace& map) {
@@ -1041,6 +1046,16 @@ void V8Debugger::removeOldAsyncTasks(AsyncTaskToStackTrace& map) {
map.swap(cleanCopy);
}
+std::shared_ptr<StackFrame> V8Debugger::lookupFrame(int frameId) {
+ auto it = m_framesCache.find(frameId);
+ if (it != m_framesCache.end()) return it->second.lock();
+ return nullptr;
+}
+
+void V8Debugger::storeFrame(int frameId, std::shared_ptr<StackFrame> frame) {
+ m_framesCache[frameId] = frame;
+}
+
void V8Debugger::setMaxAsyncTaskStacksForTest(int limit) {
m_maxAsyncCallStacks = 0;
collectOldAsyncStacksIfNeeded();

Powered by Google App Engine
This is Rietveld 408576698