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

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

Issue 311263008: Make |Heap::findGCInfo()| threadsafe. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: move iteration to ThreadState 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 | « 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: Source/platform/heap/ThreadState.cpp
diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp
index 87d0c40e847b614df6ebce10370292c8826cf9dc..75a6c81ed865246377001d1202159aba14d2abff 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -891,4 +891,24 @@ ThreadState::AttachedThreadStateSet& ThreadState::attachedThreads()
return threads;
}
+#if ENABLE(GC_TRACING)
+const GCInfo* ThreadState::findGCInfoFromAllThreads(Address address)
+{
+ bool needLockForIteration = !isAnyThreadInGC();
+ if (needLockForIteration)
+ threadAttachMutex().lock();
+
+ ThreadState::AttachedThreadStateSet& threads = attachedThreads();
+ for (ThreadState::AttachedThreadStateSet::iterator it = threads.begin(), end = threads.end(); it != end; ++it) {
+ if (const GCInfo* gcInfo = (*it)->findGCInfo(address)) {
+ if (needLockForIteration)
+ threadAttachMutex().unlock();
+ return gcInfo;
+ }
+ }
+ if (needLockForIteration)
+ threadAttachMutex().unlock();
+ return 0;
+}
+#endif
}
« no previous file with comments | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698