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

Unified Diff: third_party/WebKit/Source/platform/heap/ThreadState.cpp

Issue 1783673002: Revert of Simplify the shutdown sequence of Oilpan's heap Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698