| Index: third_party/WebKit/Source/platform/heap/ThreadState.cpp
|
| diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
|
| index 0dfd5f425bfd10307ffb79cc5400a05ef90ca7a1..9b8d80983accd0a8337e0385f4868bad1b82df09 100644
|
| --- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp
|
| +++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
|
| @@ -131,9 +131,7 @@ ThreadState::ThreadState()
|
| ASSERT(!**s_threadSpecific);
|
| **s_threadSpecific = this;
|
|
|
| - m_heap = new ThreadHeap();
|
| - ASSERT(m_heap);
|
| - m_heap->attach(this);
|
| + m_heap = WTF::wrapUnique(new ThreadHeap(this));
|
|
|
| for (int arenaIndex = 0; arenaIndex < BlinkGC::LargeObjectArenaIndex;
|
| arenaIndex++)
|
| @@ -148,6 +146,10 @@ ThreadState::ThreadState()
|
|
|
| ThreadState::~ThreadState() {
|
| ASSERT(checkThread());
|
| + if (isMainThread())
|
| + DCHECK_EQ(heap().heapStats().allocatedSpace(), 0u);
|
| + CHECK(gcState() == ThreadState::NoGCScheduled);
|
| +
|
| for (int i = 0; i < BlinkGC::NumberOfArenas; ++i)
|
| delete m_arenas[i];
|
|
|
| @@ -163,6 +165,12 @@ void ThreadState::attachCurrentThread() {
|
| new ThreadState();
|
| }
|
|
|
| +void ThreadState::detachCurrentThread() {
|
| + ThreadState* state = current();
|
| + state->runTerminationGC();
|
| + delete state;
|
| +}
|
| +
|
| void ThreadState::removeAllPages() {
|
| ASSERT(checkThread());
|
| for (int i = 0; i < BlinkGC::NumberOfArenas; ++i)
|
| @@ -208,13 +216,6 @@ void ThreadState::runTerminationGC() {
|
| removeAllPages();
|
| }
|
|
|
| -void ThreadState::detachCurrentThread() {
|
| - ThreadState* state = current();
|
| - state->heap().detach(state);
|
| - RELEASE_ASSERT(state->gcState() == ThreadState::NoGCScheduled);
|
| - delete state;
|
| -}
|
| -
|
| NO_SANITIZE_ADDRESS
|
| void ThreadState::visitAsanFakeStackForPointer(Visitor* visitor, Address ptr) {
|
| #if defined(ADDRESS_SANITIZER)
|
| @@ -1256,14 +1257,6 @@ void ThreadState::leaveStaticReferenceRegistrationDisabledScope() {
|
| }
|
| #endif
|
|
|
| -void ThreadState::lockThreadAttachMutex() {
|
| - m_heap->threadAttachMutex().lock();
|
| -}
|
| -
|
| -void ThreadState::unlockThreadAttachMutex() {
|
| - m_heap->threadAttachMutex().unlock();
|
| -}
|
| -
|
| void ThreadState::invokePreFinalizers() {
|
| ASSERT(checkThread());
|
| ASSERT(!sweepForbidden());
|
|
|