Commit fe664551 authored by ager@chromium.org's avatar ager@chromium.org

Use OwnPtrs for heap contains cache and persistent anchor. We were leaking the HeapContainsCache.

R=haraken@chromium.org, vegorov@chromium.org
BUG=348629
NOTRY=true

Review URL: https://codereview.chromium.org/183683017

git-svn-id: svn://svn.chromium.org/blink/trunk@168384 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 354dddd6
......@@ -193,7 +193,6 @@ public:
current->trace(visitor);
}
private:
virtual ~PersistentAnchor()
{
// FIXME: oilpan: Ideally we should have no left-over persistents at this point. However currently there is a
......@@ -201,6 +200,8 @@ private:
// persistent or e.g. be RefCountedGarbageCollected we cannot guarantee there are no remaining Persistents at
// this point.
}
private:
PersistentAnchor() : PersistentNode(TraceMethodDelegate<PersistentAnchor, &PersistentAnchor::trace>::trampoline)
{
m_next = this;
......
......@@ -229,6 +229,7 @@ private:
ThreadState::ThreadState()
: m_thread(currentThread())
, m_persistents(adoptPtr(new PersistentAnchor()))
, m_startOfStack(reinterpret_cast<intptr_t*>(getStackStart()))
, m_endOfStack(reinterpret_cast<intptr_t*>(getStackStart()))
, m_safePointScopeMarker(0)
......@@ -239,13 +240,12 @@ ThreadState::ThreadState()
, m_sweepInProgress(false)
, m_noAllocationCount(0)
, m_inGC(false)
, m_heapContainsCache(new HeapContainsCache())
, m_heapContainsCache(adoptPtr(new HeapContainsCache()))
, m_isCleaningUp(false)
{
ASSERT(!**s_threadSpecific);
**s_threadSpecific = this;
m_persistents = new PersistentAnchor();
m_stats.clear();
m_statsAfterLastGC.clear();
// First allocate the general heap, second iterate through to
......@@ -260,8 +260,6 @@ ThreadState::~ThreadState()
checkThread();
for (int i = GeneralHeap; i < NumberOfHeaps; i++)
delete m_heaps[i];
delete m_persistents;
m_persistents = 0;
deleteAllValues(m_interruptors);
**s_threadSpecific = 0;
}
......
......@@ -455,7 +455,7 @@ public:
// Infrastructure to determine if an address is within one of the
// address ranges for the Blink heap.
HeapContainsCache* heapContainsCache() { return m_heapContainsCache; }
HeapContainsCache* heapContainsCache() { return m_heapContainsCache.get(); }
bool contains(Address);
bool contains(void* pointer) { return contains(reinterpret_cast<Address>(pointer)); }
bool contains(const void* pointer) { return contains(const_cast<void*>(pointer)); }
......@@ -466,7 +466,7 @@ public:
BaseHeapPage* heapPageFromAddress(Address);
// List of persistent roots allocated on the given thread.
PersistentNode* roots() const { return m_persistents; }
PersistentNode* roots() const { return m_persistents.get(); }
// List of global persistent roots not owned by any particular thread.
// globalRootsMutex must be acquired before any modifications.
......@@ -520,7 +520,7 @@ private:
void trace(Visitor*);
ThreadIdentifier m_thread;
PersistentNode* m_persistents;
OwnPtr<PersistentNode> m_persistents;
StackState m_stackState;
intptr_t* m_startOfStack;
intptr_t* m_endOfStack;
......@@ -534,7 +534,7 @@ private:
size_t m_noAllocationCount;
bool m_inGC;
BaseHeap* m_heaps[NumberOfHeaps];
HeapContainsCache* m_heapContainsCache;
OwnPtr<HeapContainsCache> m_heapContainsCache;
HeapStats m_stats;
HeapStats m_statsAfterLastGC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment