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

Unified Diff: third_party/WebKit/Source/web/WebLeakDetector.cpp

Issue 1472943004: Split up leak detector into two stages for better leak reporting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restore enable_oilpan=0 default Created 5 years, 1 month 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: third_party/WebKit/Source/web/WebLeakDetector.cpp
diff --git a/third_party/WebKit/Source/web/WebLeakDetector.cpp b/third_party/WebKit/Source/web/WebLeakDetector.cpp
index e1ddecbab86bf329b6cd9c60d7956be2f3b50bd0..17cc3978090aaaa3311b0b7995ce6bf1e2a49141 100644
--- a/third_party/WebKit/Source/web/WebLeakDetector.cpp
+++ b/third_party/WebKit/Source/web/WebLeakDetector.cpp
@@ -59,6 +59,7 @@ public:
, m_delayedGCAndReportTimer(this, &WebLeakDetectorImpl::delayedGCAndReport)
, m_delayedReportTimer(this, &WebLeakDetectorImpl::delayedReport)
, m_numberOfGCNeeded(0)
+ , m_delayFinalGarbageCollection(false)
{
ASSERT(m_client);
}
@@ -67,6 +68,9 @@ public:
void collectGarbageAndGetDOMCounts(WebLocalFrame*) override;
+ void delayFinalGarbageCollection() override { m_delayFinalGarbageCollection = true; }
+ void collectFinalGarbage() override;
+
private:
void delayedGCAndReport(Timer<WebLeakDetectorImpl>*);
void delayedReport(Timer<WebLeakDetectorImpl>*);
@@ -75,8 +79,21 @@ private:
Timer<WebLeakDetectorImpl> m_delayedGCAndReportTimer;
Timer<WebLeakDetectorImpl> m_delayedReportTimer;
int m_numberOfGCNeeded;
+ bool m_delayFinalGarbageCollection;
};
+void WebLeakDetectorImpl::collectFinalGarbage()
+{
+ ASSERT(m_delayFinalGarbageCollection);
+
+ // Task queue may contain delayed object destruction tasks.
+ // This method is called from navigation hook inside FrameLoader,
+ // so previous document is still held by the loader until the next event loop.
+ // Complete all pending tasks before proceeding to gc.
+ m_numberOfGCNeeded = 2;
+ m_delayedGCAndReportTimer.startOneShot(0, BLINK_FROM_HERE);
+}
+
void WebLeakDetectorImpl::collectGarbageAndGetDOMCounts(WebLocalFrame* frame)
haraken 2015/11/24 23:54:51 Instead of introducing a notion of "delayed", I'd
{
v8::Isolate* isolate = v8::Isolate::GetCurrent();
@@ -105,12 +122,10 @@ void WebLeakDetectorImpl::collectGarbageAndGetDOMCounts(WebLocalFrame* frame)
V8PerIsolateData::from(isolate)->clearScriptRegexpContext();
- // Task queue may contain delayed object destruction tasks.
- // This method is called from navigation hook inside FrameLoader,
- // so previous document is still held by the loader until the next event loop.
- // Complete all pending tasks before proceeding to gc.
- m_numberOfGCNeeded = 2;
- m_delayedGCAndReportTimer.startOneShot(0, BLINK_FROM_HERE);
+ if (m_delayFinalGarbageCollection)
+ return;
+
+ collectFinalGarbage();
}
void WebLeakDetectorImpl::delayedGCAndReport(Timer<WebLeakDetectorImpl>*)

Powered by Google App Engine
This is Rietveld 408576698