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

Unified Diff: Source/platform/heap/HeapTest.cpp

Issue 318023002: Oilpan: Prepare to make ExecutionContext GarbageCollectedMixin. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
Index: Source/platform/heap/HeapTest.cpp
diff --git a/Source/platform/heap/HeapTest.cpp b/Source/platform/heap/HeapTest.cpp
index 5c93ea68e5a3d0207641dd5d8846a9288692f6cd..e55cff455ca81dbc9461f34b64b5eb7a8721f54a 100644
--- a/Source/platform/heap/HeapTest.cpp
+++ b/Source/platform/heap/HeapTest.cpp
@@ -3978,4 +3978,25 @@ TEST(HeapTest, NeedsAdjustAndMark)
EXPECT_FALSE(NeedsAdjustAndMark<const UseMixin>::value);
}
+TEST(HeapTest, Bind)
+{
+ Closure closure = bind(&Bar::trace, Bar::create(), static_cast<Visitor*>(0));
+ Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
+ // The closure should have a persistent handle to the Bar.
+ EXPECT_EQ(1u, Bar::s_live);
+
+ Closure closure2 = bind(&Bar::trace, RawPtr<Bar>(Bar::create()), static_cast<Visitor*>(0));
+ Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
+ // The closure should have a persistent handle to the Bar.
+ EXPECT_EQ(2u, Bar::s_live);
+
+ UseMixin::s_traceCount = 0;
+ Mixin* mixin = UseMixin::create();
+ Closure mixinClosure = bind(&Mixin::trace, mixin, static_cast<Visitor*>(0));
+ Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
+ // The closure should have a persistent handle to the mixin.
+ EXPECT_EQ(1, UseMixin::s_traceCount);
+}
+
+
} // WebCore namespace

Powered by Google App Engine
This is Rietveld 408576698