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

Unified Diff: Source/core/loader/FrameLoader.cpp

Issue 1252683003: Oilpan: Schedule a precise GC when a page navigates (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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/loader/FrameLoader.cpp
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index ffb912ae0aadef4c4e3f2f76f2054050709cb0d2..1c25e85bcf1ab3e984a49ed49ba5491a75fd4441 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -1027,6 +1027,18 @@ bool FrameLoader::prepareForCommit()
PluginScriptForbiddenScope forbidPluginDestructorScripting;
RefPtrWillBeRawPtr<DocumentLoader> pdl = m_provisionalDocumentLoader;
+ if (m_frame->document()) {
+ unsigned totalNodeCount = InstanceCounters::counterValue(InstanceCounters::NodeCounter);
+ int nodeCount = static_cast<int>(totalNodeCount);
+ for (Document* document : Document::liveDocumentSet()) {
+ if (document != m_frame->document())
+ nodeCount -= document->nodeCount();
+ }
+ ASSERT(nodeCount >= 0);
+ float ratio = static_cast<float>(nodeCount) / totalNodeCount;
+ ThreadState::current()->schedulePageNavigationGCIfNeeded(ratio);
+ }
+
if (m_documentLoader) {
client()->dispatchWillClose();
dispatchUnloadEvent();

Powered by Google App Engine
This is Rietveld 408576698