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

Unified Diff: Source/heap/Heap.h

Issue 130493003: Alternative approach to supporting ref counting and garbage collection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix copyright. Created 6 years, 11 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/heap/Handle.h ('k') | Source/heap/HeapTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/heap/Heap.h
diff --git a/Source/heap/Heap.h b/Source/heap/Heap.h
index 945206ca0d4ad4a18707943d813f2d2de77299a5..5af32ee36c489de1516592c4d824447e34534e3f 100644
--- a/Source/heap/Heap.h
+++ b/Source/heap/Heap.h
@@ -37,6 +37,7 @@
#include "wtf/Assertions.h"
#include "wtf/OwnPtr.h"
+#include "wtf/RefCounted.h"
#include <stdint.h>
@@ -884,6 +885,15 @@ private:
bool m_active;
};
+#if !ENABLE(OILPAN)
+template<typename T>
+class Dummy {
+public:
+ Dummy() { }
+ ~Dummy() { }
+};
+#endif
+
// Base class for objects allocated in the Blink garbage-collected
// heap.
//
@@ -907,6 +917,12 @@ class GarbageCollected {
void* operator new[](size_t size);
void operator delete[](void* p);
public:
+#if ENABLE(OILPAN)
+ typedef GarbageCollected<T> FromRefCounted;
+#else
+ typedef RefCounted<T> FromRefCounted;
+#endif
+
void* operator new(size_t size)
{
return Heap::allocate<T>(size);
@@ -939,6 +955,15 @@ template<typename T>
class GarbageCollectedFinalized : public GarbageCollected<T> {
WTF_MAKE_NONCOPYABLE(GarbageCollectedFinalized);
+public:
+#if ENABLE(OILPAN)
+ typedef GarbageCollectedFinalized<T> FromRefCounted;
+ typedef GarbageCollectedFinalized<T> FromNoBase;
+#else
+ typedef RefCounted<T> FromRefCounted;
+ typedef Dummy<T> FromNoBase;
+#endif
+
protected:
// Finalize is called when the object is freed from the heap. By
// default finalization means calling the destructor on the
« no previous file with comments | « Source/heap/Handle.h ('k') | Source/heap/HeapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698