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

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

Issue 2913303002: Avoid unsafe heap access from audio thread. (Closed)
Patch Set: bring back comment Created 3 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
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.

Powered by Google App Engine
This is Rietveld 408576698