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

Unified Diff: third_party/WebKit/Source/platform/heap/SafePoint.h

Issue 1411643006: Avoid data races on initializing GCScope. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tidy up parkAllThreads() logic Created 5 years, 1 month 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/SafePoint.h
diff --git a/third_party/WebKit/Source/platform/heap/SafePoint.h b/third_party/WebKit/Source/platform/heap/SafePoint.h
index 0b96633b51b4b40dcd08a8fa33228eb410f5901a..f312ea612b8c719bd1960a3546091ff7021b07a7 100644
--- a/third_party/WebKit/Source/platform/heap/SafePoint.h
+++ b/third_party/WebKit/Source/platform/heap/SafePoint.h
@@ -13,13 +13,12 @@ namespace blink {
class SafePointScope final {
WTF_MAKE_NONCOPYABLE(SafePointScope);
public:
- explicit SafePointScope(BlinkGC::StackState stackState, ThreadState* state = ThreadState::current())
+ explicit SafePointScope(BlinkGC::StackState stackState, ThreadState* state = ThreadState::current(), bool delayEnter = false)
: m_state(state)
{
- if (m_state) {
- RELEASE_ASSERT(!m_state->isAtSafePoint());
- m_state->enterSafePoint(stackState, this);
- }
+ if (delayEnter)
+ return;
+ enter(stackState);
}
~SafePointScope()
@@ -28,6 +27,15 @@ public:
m_state->leaveSafePoint();
}
+ void enter(BlinkGC::StackState stackState)
+ {
+ if (!m_state)
+ return;
+
+ RELEASE_ASSERT(!m_state->isAtSafePoint());
+ m_state->enterSafePoint(stackState, this);
+ }
+
private:
ThreadState* m_state;
};

Powered by Google App Engine
This is Rietveld 408576698