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

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

Issue 2697703005: Remove ThreadHeap::m_threads (Closed)
Patch Set: temp Created 3 years, 10 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 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());
« 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