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 c5a818ae5da8932d3c6153666239ae29fb22d030..95f2fdfa178dedd8df7b6362b9a4e30e8b8b2dbf 100644 |
--- a/third_party/WebKit/Source/web/WebLeakDetector.cpp |
+++ b/third_party/WebKit/Source/web/WebLeakDetector.cpp |
@@ -34,6 +34,7 @@ |
#include "core/editing/spellcheck/SpellChecker.h" |
#include "core/fetch/MemoryCache.h" |
#include "core/inspector/InstanceCounters.h" |
+#include "core/workers/InProcessWorkerMessagingProxy.h" |
#include "core/workers/WorkerThread.h" |
#include "platform/Timer.h" |
#include "public/web/WebFrame.h" |
@@ -124,10 +125,19 @@ void WebLeakDetectorImpl::delayedGCAndReport(Timer<WebLeakDetectorImpl>*) |
// Note: Oilpan precise GC is scheduled at the end of the event loop. |
// Inspect counters on the next event loop. |
- if (--m_numberOfGCNeeded) |
+ if (--m_numberOfGCNeeded > 0) { |
m_delayedGCAndReportTimer.startOneShot(0, BLINK_FROM_HERE); |
- else |
+ } else if (m_numberOfGCNeeded > -1 && InProcessWorkerMessagingProxy::proxyCount()) { |
+ // It is possible that all posted tasks for finalizing in-process proxy objects |
+ // will not have run before the final round of GCs started. If so, do yet |
+ // another pass, letting these tasks run and then afterwards perform a GC to tidy up. |
+ // |
+ // TODO(sof): use proxyCount() to always decide if another GC needs to be scheduled. |
+ // Some debug bots running browser unit tests disagree (crbug.com/616714) |
+ m_delayedGCAndReportTimer.startOneShot(0, BLINK_FROM_HERE); |
+ } else { |
m_delayedReportTimer.startOneShot(0, BLINK_FROM_HERE); |
+ } |
} |
void WebLeakDetectorImpl::delayedReport(Timer<WebLeakDetectorImpl>*) |