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

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

Issue 1190863003: Oilpan: Allocation should be allowed in 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
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/ThreadState.h
diff --git a/Source/platform/heap/ThreadState.h b/Source/platform/heap/ThreadState.h
index 481455f76ba068a19a56142693ff03493579dffc..45b45bf5fe06307a0662e8690afac5d131055572 100644
--- a/Source/platform/heap/ThreadState.h
+++ b/Source/platform/heap/ThreadState.h
@@ -72,11 +72,13 @@ using TraceCallback = VisitorCallback;
using WeakCallback = VisitorCallback;
using EphemeronCallback = VisitorCallback;
-// Declare that a class has a pre-finalizer function. The function is called in
-// the object's owner thread, and can access Member<>s to other
-// garbage-collected objects allocated in the thread. However we must not
-// allocate new garbage-collected objects, nor update Member<> and Persistent<>
-// pointers.
+// Declare that a class has a pre-finalizer function. The function is called in
+// the object's owner thread. The pre-finalizer is called before any object gets
+// swept, so it is allowed to touch on-heap objects that may be collected in the
+// GC cycle. If you cannot avoid touching on-heap objects in a destructor (which
+// is not allowed), you can consider using the pre-finalizer or
+// EARGERY_FINALIZED. The only restriction is that the pre-finalizer must not
+// resurrect dead objects (e.g., store unmarked objects into Members etc).
//
// This feature is similar to the HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>>
// idiom. The difference between this and the idiom is that pre-finalizer
@@ -529,6 +531,7 @@ public:
void pushThreadLocalWeakCallback(void*, WeakCallback);
bool popAndInvokeThreadLocalWeakCallback(Visitor*);
+ void threadLocalWeakProcessing();
size_t objectPayloadSizeForTesting();
void prepareHeapForTermination();
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698