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

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: rename some methods Created 5 years, 7 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/platform/heap/Heap.cpp ('k') | Source/platform/heap/StackFrameDepth.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/HeapTest.cpp
diff --git a/Source/platform/heap/HeapTest.cpp b/Source/platform/heap/HeapTest.cpp
index d82dc35c5749d7f9fc6b4ccaaf6a405a80fecb27..49f9a96055358a4fa4335f0c1884d7bc7e4ea629 100644
--- a/Source/platform/heap/HeapTest.cpp
+++ b/Source/platform/heap/HeapTest.cpp
@@ -244,7 +244,6 @@ public:
: Visitor(Visitor::ThreadLocalMarking)
, m_count(0)
{
- StackFrameDepth::configureStackLimit();
}
virtual void mark(const void* object, TraceCallback) override
@@ -282,6 +281,7 @@ public:
void reset() { m_count = 0; }
private:
+ StackFrameDepthScope m_scope;
size_t m_count;
};
@@ -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
« no previous file with comments | « Source/platform/heap/Heap.cpp ('k') | Source/platform/heap/StackFrameDepth.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698