| 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 46272814d0ae337f41e2e2cd977347a4f4c0d74f..01ed8598dd0c01cf5df0c254f59d357df35af818 100644
|
| --- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp
|
| +++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
|
| @@ -235,6 +235,19 @@
|
| attachedThreads().remove(state);
|
| state->~ThreadState();
|
| }
|
| + shutdownHeapIfNecessary();
|
| +}
|
| +
|
| +void ThreadState::shutdownHeapIfNecessary()
|
| +{
|
| + // We don't need to enter a safe point before acquiring threadAttachMutex
|
| + // because this thread is already detached.
|
| +
|
| + MutexLocker locker(threadAttachMutex());
|
| + // We start shutting down the heap if there is no running thread
|
| + // and Heap::shutdown() is already called.
|
| + if (!attachedThreads().size() && Heap::s_shutdownCalled)
|
| + Heap::doShutdown();
|
| }
|
|
|
| void ThreadState::attach()
|
| @@ -310,6 +323,7 @@
|
| state->cleanup();
|
| RELEASE_ASSERT(state->gcState() == ThreadState::NoGCScheduled);
|
| delete state;
|
| + shutdownHeapIfNecessary();
|
| }
|
|
|
| void ThreadState::visitPersistentRoots(Visitor* visitor)
|
|
|