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

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

Issue 224113002: Oilpan: move Range object to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use STACK_ALLOCATED() + incorporate ager's overview of macros in this area. Created 6 years, 9 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/platform/heap/Heap.h
diff --git a/Source/platform/heap/Heap.h b/Source/platform/heap/Heap.h
index 175a982576bbbebe1328c16074263cfea5a76014..c310e5fde489e9fce68da8b9f31a22ac3a4b9621 100644
--- a/Source/platform/heap/Heap.h
+++ b/Source/platform/heap/Heap.h
@@ -1024,6 +1024,27 @@ T* adoptRefCountedGarbageCollected(T* ptr)
return ptr;
}
+// Classes that contain heap references but aren't themselves heap
+// allocated, have some extra macros available which allows their use
+// to be restricted to cases where the garbage collector is able
+// to discover their heap references.
+//
+// STACK_ALLOCATED(): Use if the object is only stack allocated. Heap objects
+// should be in Members but you do not need the trace method as they are on
+// the stack. (Down the line these might turn in to raw pointers, but for
+// now Members indicates that we have thought about them and explicitly
+// taken care of them.)
+//
+// DISALLOW_ALLOCATION(): Cannot be allocated with new operators but can
+// be a part object. If it has Members you need a trace method and the
+// containing object needs to call that trace method.
+//
+// ALLOW_ONLY_INLINE_ALLOCATION(): Allows only placement new operator.
+// This disallows general allocation of this object but allows to put
+// the object as a value object in collections. If these have Members you
+// need to have a trace method. That trace method will be called
+// automatically by the Heap collections.
+//
#if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS)
#define DISALLOW_ALLOCATION() \
private: \

Powered by Google App Engine
This is Rietveld 408576698