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

Unified Diff: Source/heap/HeapTest.cpp

Issue 222653003: Oilpan: Fix isAlive dispatching for GarbageCollectedMixins. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix * placement 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
« no previous file with comments | « no previous file | Source/heap/Visitor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/heap/HeapTest.cpp
diff --git a/Source/heap/HeapTest.cpp b/Source/heap/HeapTest.cpp
index 5b9d450b0cd2ca77736bf2debacb03f96b544d09..d862b8a43ee47d93f2c39b3c3f9d0159dc163023 100644
--- a/Source/heap/HeapTest.cpp
+++ b/Source/heap/HeapTest.cpp
@@ -175,6 +175,7 @@ public:
static SimpleObject* create() { return new SimpleObject(); }
void trace(Visitor*) { }
char getPayload(int i) { return payload[i]; }
+ virtual void virtualMethod() { }
Mads Ager (chromium) 2014/04/02 18:13:56 I'll add a comment that this make sure that the ob
protected:
SimpleObject() { }
char payload[64];
@@ -1137,10 +1138,9 @@ class Mixin : public GarbageCollectedMixin {
public:
virtual void trace(Visitor* visitor) { }
- char getPayload(int i) { return m_padding[i]; }
+ virtual char getPayload(int i) { return m_padding[i]; }
protected:
- // This is to force ptr diff for SimpleObject, Mixin, and UseMixin.
int m_padding[8];
};
@@ -2983,20 +2983,25 @@ TEST(HeapTest, CollectionNesting)
EXPECT_EQ(1, IntWrapper::s_destructorCalls);
}
-TEST(heap, GarbageCollectedMixin)
+TEST(HeapTest, GarbageCollectedMixin)
{
HeapStats initialHeapStats;
clearOutOldGarbage(&initialHeapStats);
Persistent<UseMixin> usemixin = UseMixin::create();
- ASSERT_EQ(0, UseMixin::s_traceCount);
+ EXPECT_EQ(0, UseMixin::s_traceCount);
Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
- ASSERT_EQ(1, UseMixin::s_traceCount);
+ EXPECT_EQ(1, UseMixin::s_traceCount);
Persistent<Mixin> mixin = usemixin;
usemixin = nullptr;
Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
- ASSERT_EQ(2, UseMixin::s_traceCount);
+ EXPECT_EQ(2, UseMixin::s_traceCount);
+
+ PersistentHeapHashSet<WeakMember<Mixin> > weakMap;
+ weakMap.add(UseMixin::create());
+ Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
+ EXPECT_EQ(0u, weakMap.size());
}
TEST(HeapTest, CollectionNesting2)
« no previous file with comments | « no previous file | Source/heap/Visitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698