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

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/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 73afe55fb9d405a2dd345e901dbcd85afe6609e6..574ea1ab75abf6a34cd65bcd5bad02e9e3d88142 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,17 @@ 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();
+ ASSERT(callbackVector->size() >= 1);
+ if (!(callbackVector->at(0))(object))
sof 2015/06/24 11:21:56 I wonder if it would be tidier to just check if 'o
haraken 2015/06/24 12:54:01 Unfortunately we can't do this because isHeapObjec
sof 2015/06/24 13:40:31 ..and we have to support mixin prefinalizers.
+ continue;
+ deadObjects.append(object);
+ for (size_t i = 1; i < callbackVector->size(); i++) {
sof 2015/06/24 11:21:56 Don't you want to do this the other way around? th
haraken 2015/06/24 12:54:01 Nice catch! Done. However, we cannot guarantee th
sof 2015/06/24 13:40:31 It would have been preferable to avoid that non-de
haraken 2015/06/24 13:47:50 Maybe can we use a LinkedListHashSet instead of a
+ bool ret = (callbackVector->at(i))(object);
+ ASSERT_UNUSED(ret, ret);
+ }
}
// FIXME: removeAll is inefficient. It can shrink repeatedly.
m_preFinalizers.removeAll(deadObjects);
« 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