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

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

Issue 2602263002: Lend LSan a hand and clear out singleton static persistents first. (Closed)
Patch Set: Created 3 years, 12 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 | « third_party/WebKit/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: 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 53497e71765aa20f04d9c4cb0688c20de2592bc1..2627bc0dee768a66fdfb450e14ef396ffadc59fd 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -334,7 +334,10 @@ void ThreadState::cleanupMainThread() {
#if defined(LEAK_SANITIZER)
// See comment below, clear out most garbage before releasing static
// persistents should some of the finalizers depend on touching
- // these persistents.
+ // these persistents. The clearing done includes the static persistents,
+ // so as to make objects retained by these singletons also be eligible
+ // for garbage collection right away.
+ clearStaticPersistentNodes();
haraken 2017/01/02 09:26:44 Hmm, I'm not quite sure if this helps. In my unde
sof 2017/01/02 09:37:16 Hmm, that doesn't make a lot of sense, given the t
collectAllGarbage();
#endif
@@ -1500,6 +1503,18 @@ void ThreadState::registerStaticPersistentNode(
m_staticPersistents.add(node, callback);
}
+#if defined(LEAK_SANITIZER)
+void ThreadState::clearStaticPersistentNodes() {
+ HashMap<PersistentNode*, ThreadState::PersistentClearCallback>
+ staticPersistents;
+ staticPersistents.swap(m_staticPersistents);
+
+ PersistentRegion* persistentRegion = getPersistentRegion();
+ for (const auto& it : staticPersistents)
+ persistentRegion->clearPersistentNode(it.key, it.value);
+}
+#endif
+
void ThreadState::releaseStaticPersistentNodes() {
HashMap<PersistentNode*, ThreadState::PersistentClearCallback>
staticPersistents;
« no previous file with comments | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698