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

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

Issue 1125613002: Oilpan: handle thread-local weak tracing slightly better. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: compile fix Created 5 years, 8 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 d82dc35c5749d7f9fc6b4ccaaf6a405a80fecb27..451e17c4a2b1e68c09915be63df681d1449dd573 100644
--- a/Source/platform/heap/HeapTest.cpp
+++ b/Source/platform/heap/HeapTest.cpp
@@ -5145,7 +5145,9 @@ public:
private:
- static HeapHashSet<WeakMember<IntWrapper>>* allocateCollection()
+ using WeakCollectionType = HeapHashMap<WeakMember<IntWrapper>, Member<IntWrapper>>;
+
+ static WeakCollectionType* allocateCollection()
{
// Create a weak collection that is kept alive by a persistent
// and keep the contents alive with a persistents as
@@ -5156,13 +5158,13 @@ private:
Persistent<IntWrapper> wrapper4 = IntWrapper::create(32);
Persistent<IntWrapper> wrapper5 = IntWrapper::create(32);
Persistent<IntWrapper> wrapper6 = IntWrapper::create(32);
- Persistent<HeapHashSet<WeakMember<IntWrapper>>> weakCollection = new HeapHashSet<WeakMember<IntWrapper>>;
- weakCollection->add(wrapper1);
- weakCollection->add(wrapper2);
- weakCollection->add(wrapper3);
- weakCollection->add(wrapper4);
- weakCollection->add(wrapper5);
- weakCollection->add(wrapper6);
+ Persistent<WeakCollectionType> weakCollection = new WeakCollectionType;
+ weakCollection->add(wrapper1, wrapper1);
+ weakCollection->add(wrapper2, wrapper2);
+ weakCollection->add(wrapper3, wrapper3);
+ weakCollection->add(wrapper4, wrapper4);
+ weakCollection->add(wrapper5, wrapper5);
+ weakCollection->add(wrapper6, wrapper6);
// Signal the main thread that the worker is done with its allocation.
wakeMainThread();
@@ -5188,15 +5190,15 @@ private:
ThreadState::attach();
{
- Persistent<HeapHashSet<WeakMember<IntWrapper>>> collection = allocateCollection();
+ Persistent<WeakCollectionType> collection = allocateCollection();
{
// Prevent weak processing with an iterator and GC.
- HeapHashSet<WeakMember<IntWrapper>>::iterator it = collection->begin();
+ WeakCollectionType::iterator it = collection->begin();
Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWithSweep, Heap::ForcedGC);
// The backing should be strongified because of the iterator.
EXPECT_EQ(6u, collection->size());
- EXPECT_EQ(32, (*it)->value());
+ EXPECT_EQ(32, it->value->value());
}
// Disregarding the iterator but keeping the collection alive

Powered by Google App Engine
This is Rietveld 408576698