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

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

Issue 2602263002: Lend LSan a hand and clear out singleton static persistents first. (Closed)
Patch Set: experiment: disable LSan-GCing during shutdown.. 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
Index: third_party/WebKit/Source/platform/heap/PersistentNode.cpp
diff --git a/third_party/WebKit/Source/platform/heap/PersistentNode.cpp b/third_party/WebKit/Source/platform/heap/PersistentNode.cpp
index 3cb1821980c5530b49d00f6458b7c736b5d57df1..0e89f56e24e7c7bcc73932ac421f9630894827c4 100644
--- a/third_party/WebKit/Source/platform/heap/PersistentNode.cpp
+++ b/third_party/WebKit/Source/platform/heap/PersistentNode.cpp
@@ -57,20 +57,26 @@ void PersistentRegion::ensurePersistentNodeSlots(void* self,
void PersistentRegion::releasePersistentNode(
PersistentNode* persistentNode,
ThreadState::PersistentClearCallback callback) {
- ASSERT(!persistentNode->isUnused());
+ DCHECK(callback);
+ DCHECK(!persistentNode->isUnused());
// 'self' is in use, containing the persistent wrapper object.
- void* self = persistentNode->self();
- if (callback) {
- (*callback)(self);
- ASSERT(persistentNode->isUnused());
- return;
- }
- Persistent<DummyGCBase>* persistent =
- reinterpret_cast<Persistent<DummyGCBase>*>(self);
- persistent->clear();
- ASSERT(persistentNode->isUnused());
+ (*callback)(persistentNode->self(), ThreadState::ReleasePersistent);
+ DCHECK(persistentNode->isUnused());
}
+#if defined(LEAK_SANITIZER)
+void PersistentRegion::clearPersistentNode(
+ PersistentNode* persistentNode,
+ ThreadState::PersistentClearCallback callback) {
+ DCHECK(callback);
+ DCHECK(!persistentNode->isUnused());
+ // 'self' is in use, containing the persistent wrapper object.
+ (*callback)(persistentNode->self(), ThreadState::ClearPersistent);
+ // Cleared, not freed, so still usable.
+ DCHECK(!persistentNode->isUnused());
+}
+#endif
+
// This function traces all PersistentNodes. If we encounter
// a PersistentNodeSlot that contains only freed PersistentNodes,
// we delete the PersistentNodeSlot. This function rebuilds the free
« no previous file with comments | « third_party/WebKit/Source/platform/heap/PersistentNode.h ('k') | third_party/WebKit/Source/platform/heap/ThreadState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698