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

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
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 2860b2c855581756d1d5312a3f0eee4e27b07b5c..5e50d62c9c20e1406a752ba225a051c6fe8215ac 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -133,9 +133,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++)
@@ -165,6 +163,15 @@ void ThreadState::attachCurrentThread() {
new ThreadState();
}
+void ThreadState::detachCurrentThread() {
+ ThreadState* state = current();
+ state->runTerminationGC();
+ if (state->isMainThread())
+ DCHECK_EQ(state->heap().heapStats().allocatedSpace(), 0u);
+ CHECK(state->gcState() == ThreadState::NoGCScheduled);
+ delete state;
+}
+
void ThreadState::removeAllPages() {
ASSERT(checkThread());
for (int i = 0; i < BlinkGC::NumberOfArenas; ++i)
@@ -210,13 +217,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)
@@ -1218,10 +1218,7 @@ void ThreadState::addInterruptor(
std::unique_ptr<BlinkGCInterruptor> interruptor) {
ASSERT(checkThread());
SafePointScope scope(BlinkGC::HeapPointersOnStack);
- {
- MutexLocker locker(m_heap->threadAttachMutex());
- m_interruptors.push_back(std::move(interruptor));
- }
+ m_interruptors.push_back(std::move(interruptor));
}
void ThreadState::registerStaticPersistentNode(
@@ -1268,14 +1265,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());

Powered by Google App Engine
This is Rietveld 408576698