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

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

Issue 1200333006: Oilpan: Support nested pre-finalizers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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/HeapTest.cpp ('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 73afe55fb9d405a2dd345e901dbcd85afe6609e6..6b2da6a97f7cf524908d74de251f1014b6ff054c 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -1296,16 +1296,6 @@ void ThreadState::unlockThreadAttachMutex()
threadAttachMutex().unlock();
}
-void ThreadState::unregisterPreFinalizerInternal(void* target)
-{
- checkThread();
- if (sweepForbidden())
- return;
- auto it = m_preFinalizers.find(target);
- ASSERT(it != m_preFinalizers.end());
- m_preFinalizers.remove(it);
-}
-
void ThreadState::invokePreFinalizers()
{
checkThread();
@@ -1317,9 +1307,14 @@ void ThreadState::invokePreFinalizers()
SweepForbiddenScope forbiddenScope(this);
Vector<void*> deadObjects;
- for (auto& entry : m_preFinalizers) {
- if (entry.value(entry.key))
- deadObjects.append(entry.key);
+ for (auto& it : m_preFinalizers) {
+ void* object = it.key;
+ Vector<PreFinalizerCallback>* callbackVector = it.value.get();
+ for (size_t i = 0; i < callbackVector->size(); i++) {
+ if (!(callbackVector->at(i))(object))
+ break;
+ deadObjects.append(object);
+ }
}
// FIXME: removeAll is inefficient. It can shrink repeatedly.
m_preFinalizers.removeAll(deadObjects);
« Source/platform/heap/HeapTest.cpp ('K') | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698