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

Unified Diff: Source/platform/heap/Heap.cpp

Issue 311263008: Make |Heap::findGCInfo()| threadsafe. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | « no previous file | Source/platform/heap/ThreadState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Heap.cpp
diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp
index f055df916d27a153d4ccc00a1fa90cbafe0dbb5b..b7c72bfaf0ec1c37d67f278b500a0809b3e3d194 100644
--- a/Source/platform/heap/Heap.cpp
+++ b/Source/platform/heap/Heap.cpp
@@ -1600,12 +1600,20 @@ Address Heap::checkAndMarkPointer(Visitor* visitor, Address address)
#if ENABLE(GC_TRACING)
const GCInfo* Heap::findGCInfo(Address address)
{
+ bool needLockForIteration = !ThreadState::current()->isAtSafePoint();
haraken 2014/06/05 09:11:23 I guess what matters is not whether we're at a saf
kouhei (in TOK) 2014/06/05 09:26:22 Done.
+ if (needLockForIteration)
+ ThreadState::threadAttachMutex().lock();
+
ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads();
for (ThreadState::AttachedThreadStateSet::iterator it = threads.begin(), end = threads.end(); it != end; ++it) {
if (const GCInfo* gcInfo = (*it)->findGCInfo(address)) {
+ if (needLockForIteration)
+ ThreadState::threadAttachMutex().unlock();
return gcInfo;
}
}
+ if (needLockForIteration)
+ ThreadState::threadAttachMutex().unlock();
return 0;
}
« no previous file with comments | « no previous file | Source/platform/heap/ThreadState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698