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 |