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

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

Issue 1477023003: Refactor the Heap into ThreadHeap to prepare for per thread heaps Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/SafePoint.cpp
diff --git a/third_party/WebKit/Source/platform/heap/SafePoint.cpp b/third_party/WebKit/Source/platform/heap/SafePoint.cpp
index 692cc7f00f3434eecfd46f4aa8ab9fcde19f3b12..8b749ea414b415e97ae93e61513edf7099e8f7e3 100644
--- a/third_party/WebKit/Source/platform/heap/SafePoint.cpp
+++ b/third_party/WebKit/Source/platform/heap/SafePoint.cpp
@@ -4,6 +4,7 @@
#include "platform/heap/SafePoint.h"
+#include "platform/heap/Heap.h"
#include "wtf/Atomics.h"
#include "wtf/CurrentTime.h"
@@ -18,9 +19,10 @@ static double lockingTimeout()
return 0.100;
}
-SafePointBarrier::SafePointBarrier()
+SafePointBarrier::SafePointBarrier(Heap* heap)
: m_canResume(1)
, m_unparkedThreadCount(0)
+ , m_heap(heap)
{
}
@@ -34,8 +36,8 @@ bool SafePointBarrier::parkOthers()
ThreadState* current = ThreadState::current();
// Lock threadAttachMutex() to prevent threads from attaching.
- ThreadState::lockThreadAttachMutex();
- ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads();
+ m_heap->lockThreadAttachMutex();
+ const ThreadStateSet& threads = m_heap->threads();
haraken 2016/02/29 11:17:45 It would be better to move lockThreadAttachMutex()
keishi 2016/03/02 06:01:03 Done.
MutexLocker locker(m_mutex);
atomicAdd(&m_unparkedThreadCount, threads.size());
@@ -64,7 +66,7 @@ bool SafePointBarrier::parkOthers()
void SafePointBarrier::resumeOthers(bool barrierLocked)
{
- ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads();
+ const ThreadStateSet& threads = m_heap->threads();
atomicSubtract(&m_unparkedThreadCount, threads.size());
releaseStore(&m_canResume, 1);
@@ -77,7 +79,7 @@ void SafePointBarrier::resumeOthers(bool barrierLocked)
m_resume.broadcast();
}
- ThreadState::unlockThreadAttachMutex();
+ m_heap->unlockThreadAttachMutex();
ASSERT(ThreadState::current()->isAtSafePoint());
}

Powered by Google App Engine
This is Rietveld 408576698