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 4ea6db5c7d45051815566d7a6cc21cd07fb41cf1..25401b83b88330b8f04e0b4511ae2eff404793ea 100644 |
--- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp |
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp |
@@ -1440,6 +1440,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. |