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 58dc75b9c006da15a9ecd07cde9ade0483e4069e..e1aa938312f7f4cd1a2581bc19b384941ed123c7 100644 |
--- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp |
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp |
@@ -1451,6 +1451,12 @@ void ThreadState::CollectGarbage(BlinkGC::StackState stack_state, |
GCForbiddenScope gc_forbidden_scope(this); |
{ |
+ // No access to GCing arenas is allowed by other threads while |
+ // a GC runs; grab a lock to indicate that GC is underway. Should |
+ // any other thread need to access object on the heap, it will have |
+ // to be while in a GCLockScope also. |
+ GCLockScope gc_lock(this); |
+ |
// Access to the CrossThreadPersistentRegion has to be prevented while in |
// the marking phase because otherwise other threads may allocate or free |
// PersistentNodes and we can't handle that. |