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

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

Issue 623033002: Oilpan: Add support of pre-finalization callback to Oilpan infrastructure. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: apply review comments Created 6 years, 2 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
« Source/platform/heap/ThreadState.h ('K') | « 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: Source/platform/heap/ThreadState.cpp
diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp
index d3bc5cf73f62b1ae1a609758caa3d729b47f007e..3bbda6d783a25f32e49b2d8ab12e5066e9477b1c 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -1114,6 +1114,10 @@ void ThreadState::performPendingSweep()
// Perform thread-specific weak processing.
while (popAndInvokeWeakPointerCallback(Heap::s_markingVisitor)) { }
}
+ {
+ TRACE_EVENT0("blink_gc", "ThreadState::invokePreFinalizers");
+ invokePreFinalizers(*Heap::s_markingVisitor);
haraken 2014/10/06 01:55:27 Just to confirm: The main difference between weak
+ }
leaveNoAllocationScope();
// Perform sweeping and finalization.
@@ -1247,6 +1251,25 @@ ThreadState::AttachedThreadStateSet& ThreadState::attachedThreads()
return threads;
}
+void ThreadState::unregisterPreFinalizerInternal(void* target)
+{
+ if (isSweepInProgress())
+ return;
+ auto it = m_preFinalizers.find(target);
+ ASSERT(it != m_preFinalizers.end());
+ m_preFinalizers.remove(it);
+}
+
+void ThreadState::invokePreFinalizers(Visitor& visitor)
+{
+ Vector<void*> deadObjects;
+ for (auto& entry : m_preFinalizers) {
+ if (entry.value(entry.key, visitor))
+ deadObjects.append(entry.key);
+ }
+ m_preFinalizers.removeAll(deadObjects);
+}
+
#if ENABLE(GC_PROFILE_MARKING)
const GCInfo* ThreadState::findGCInfoFromAllThreads(Address address)
{
« Source/platform/heap/ThreadState.h ('K') | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698