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

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

Issue 2355193002: Use enum for per thread heap enabled flag (Closed)
Patch Set: fix Created 4 years, 3 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 60939a77881ebddff143d09cb22abb5f1fae9553..a0c4f3e32b93d60c76af36f5571d5d04ab38d6a4 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -145,7 +145,7 @@ private:
bool m_shouldResumeThreads;
};
-ThreadState::ThreadState(bool perThreadHeapEnabled)
+ThreadState::ThreadState(BlinkGC::ThreadHeapMode threadHeapMode)
: m_thread(currentThread())
, m_persistentRegion(wrapUnique(new PersistentRegion()))
#if OS(WIN) && COMPILER(MSVC)
@@ -162,7 +162,7 @@ ThreadState::ThreadState(bool perThreadHeapEnabled)
, m_accumulatedSweepingTime(0)
, m_vectorBackingArenaIndex(BlinkGC::Vector1ArenaIndex)
, m_currentArenaAges(0)
- , m_perThreadHeapEnabled(perThreadHeapEnabled)
+ , m_threadHeapMode(threadHeapMode)
, m_isTerminating(false)
, m_gcMixinMarker(nullptr)
, m_shouldFlushHeapDoesNotContainCache(false)
@@ -185,16 +185,21 @@ ThreadState::ThreadState(bool perThreadHeapEnabled)
ASSERT(!**s_threadSpecific);
**s_threadSpecific = this;
- if (m_perThreadHeapEnabled) {
- m_heap = new ThreadHeap();
- } else if (isMainThread()) {
- s_mainThreadStackStart = reinterpret_cast<uintptr_t>(m_startOfStack) - sizeof(void*);
- size_t underestimatedStackSize = StackFrameDepth::getUnderestimatedStackSize();
- if (underestimatedStackSize > sizeof(void*))
- s_mainThreadUnderestimatedStackSize = underestimatedStackSize - sizeof(void*);
+ switch (m_threadHeapMode) {
+ case BlinkGC::MainThreadHeapMode:
+ if (isMainThread()) {
+ s_mainThreadStackStart = reinterpret_cast<uintptr_t>(m_startOfStack) - sizeof(void*);
+ size_t underestimatedStackSize = StackFrameDepth::getUnderestimatedStackSize();
+ if (underestimatedStackSize > sizeof(void*))
+ s_mainThreadUnderestimatedStackSize = underestimatedStackSize - sizeof(void*);
+ m_heap = new ThreadHeap();
+ } else {
+ m_heap = &ThreadState::mainThreadState()->heap();
+ }
+ break;
+ case BlinkGC::PerThreadHeapMode:
m_heap = new ThreadHeap();
- } else {
- m_heap = &ThreadState::mainThreadState()->heap();
+ break;
}
ASSERT(m_heap);
m_heap->attach(this);
@@ -259,13 +264,13 @@ void ThreadState::attachMainThread()
{
RELEASE_ASSERT(!ProcessHeap::s_shutdownComplete);
s_threadSpecific = new WTF::ThreadSpecific<ThreadState*>();
- new (s_mainThreadStateStorage) ThreadState(false);
+ new (s_mainThreadStateStorage) ThreadState(BlinkGC::MainThreadHeapMode);
}
-void ThreadState::attachCurrentThread(bool perThreadHeapEnabled)
+void ThreadState::attachCurrentThread(BlinkGC::ThreadHeapMode threadHeapMode)
{
RELEASE_ASSERT(!ProcessHeap::s_shutdownComplete);
- new ThreadState(perThreadHeapEnabled);
+ new ThreadState(threadHeapMode);
}
void ThreadState::cleanupPages()
« 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