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

Unified Diff: third_party/WebKit/Source/platform/heap/ThreadState.cpp

Issue 1363243003: Manage WebGLRenderingContextBase's weak refs manually without Oilpan. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reinstate WebGLContextObject dtor (non-Oilpan) Created 5 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/ThreadState.cpp
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
index 7fd1f2da8c5114246a8af2e3eb8e58da66686f43..3b0190b9f3e26c5ff22e869c5f3a9a3433b553fc 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -99,6 +99,7 @@ ThreadState::ThreadState()
, m_gcForbiddenCount(0)
, m_persistentAllocated(0)
, m_persistentFreed(0)
+ , m_pageNavigationCount(0)
, m_vectorBackingHeapIndex(Vector1HeapIndex)
, m_currentHeapAges(0)
, m_isTerminating(false)
@@ -703,6 +704,17 @@ void ThreadState::schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio)
ASSERT(!isSweepingInProgress());
ASSERT(!sweepForbidden());
+ m_pageNavigationCount++;
+ if (m_pageNavigationCount >= 5) {
+ // A frame retains a lot of memory in the V8 side. V8's GC cannot
+ // collect the memory until Oilpan's GC collects the frame. So we
+ // for a conservative GC if no Oilpan's GC has been observed in
+ // the past 5 frame navigations.
+ //
+ Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::ConservativeGC);
+ return;
+ }
+
if (shouldSchedulePageNavigationGC(estimatedRemovalRatio))
schedulePageNavigationGC();
}
@@ -986,6 +998,7 @@ void ThreadState::preGC()
flushHeapDoesNotContainCacheIfNeeded();
clearHeapAges();
updatePersistentCounters();
+ m_pageNavigationCount = 0;
}
void ThreadState::postGC(GCType gcType)
« no previous file with comments | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698