Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PersistentNode_h | 5 #ifndef PersistentNode_h |
| 6 #define PersistentNode_h | 6 #define PersistentNode_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/heap/ThreadState.h" | 9 #include "platform/heap/ThreadState.h" |
| 10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 ensurePersistentNodeSlots(self, trace); | 123 ensurePersistentNodeSlots(self, trace); |
| 124 ASSERT(m_freeListHead); | 124 ASSERT(m_freeListHead); |
| 125 PersistentNode* node = m_freeListHead; | 125 PersistentNode* node = m_freeListHead; |
| 126 m_freeListHead = m_freeListHead->freeListNext(); | 126 m_freeListHead = m_freeListHead->freeListNext(); |
| 127 node->initialize(self, trace); | 127 node->initialize(self, trace); |
| 128 ASSERT(!node->isUnused()); | 128 ASSERT(!node->isUnused()); |
| 129 return node; | 129 return node; |
| 130 } | 130 } |
| 131 | 131 |
| 132 void freePersistentNode(PersistentNode* persistentNode) { | 132 void freePersistentNode(PersistentNode* persistentNode) { |
| 133 ASSERT(m_persistentCount > 0); | 133 #if DCHECK_IS_ON() |
| 134 DCHECK_GT(m_persistentCount, 0); | |
|
Alexander Alekseev
2016/11/23 07:53:07
This variable exists only if DCHECK_IS_ON() evalua
| |
| 135 #endif | |
| 134 persistentNode->setFreeListNext(m_freeListHead); | 136 persistentNode->setFreeListNext(m_freeListHead); |
| 135 m_freeListHead = persistentNode; | 137 m_freeListHead = persistentNode; |
| 136 #if DCHECK_IS_ON() | 138 #if DCHECK_IS_ON() |
| 137 --m_persistentCount; | 139 --m_persistentCount; |
| 138 #endif | 140 #endif |
| 139 } | 141 } |
| 140 | 142 |
| 141 static bool shouldTracePersistentNode(Visitor*, PersistentNode*) { | 143 static bool shouldTracePersistentNode(Visitor*, PersistentNode*) { |
| 142 return true; | 144 return true; |
| 143 } | 145 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 // Recursive as prepareForThreadStateTermination() clears a PersistentNode's | 245 // Recursive as prepareForThreadStateTermination() clears a PersistentNode's |
| 244 // associated Persistent<> -- it in turn freeing the PersistentNode. And both | 246 // associated Persistent<> -- it in turn freeing the PersistentNode. And both |
| 245 // CrossThreadPersistentRegion operations need a lock on the region before | 247 // CrossThreadPersistentRegion operations need a lock on the region before |
| 246 // mutating. | 248 // mutating. |
| 247 RecursiveMutex m_mutex; | 249 RecursiveMutex m_mutex; |
| 248 }; | 250 }; |
| 249 | 251 |
| 250 } // namespace blink | 252 } // namespace blink |
| 251 | 253 |
| 252 #endif | 254 #endif |
| OLD | NEW |