| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2009, 2010, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009, 2010, 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 void deref() | 70 void deref() |
| 71 { | 71 { |
| 72 ASSERT(isMainThread()); | 72 ASSERT(isMainThread()); |
| 73 ASSERT(m_refCount > 0); | 73 ASSERT(m_refCount > 0); |
| 74 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); | 74 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); |
| 75 ASSERT(!m_inRemovedLastRefFunction); | 75 ASSERT(!m_inRemovedLastRefFunction); |
| 76 ASSERT(!m_adoptionIsRequired); | 76 ASSERT(!m_adoptionIsRequired); |
| 77 NodeType* thisNode = static_cast<NodeType*>(this); | 77 NodeType* thisNode = static_cast<NodeType*>(this); |
| 78 if (!--m_refCount && !thisNode->hasTreeSharedParent()) { | 78 if (!--m_refCount && !thisNode->hasTreeSharedParent()) { |
| 79 #if !ASSERT_DISABLED | 79 #if ASSERT_ENABLED |
| 80 m_inRemovedLastRefFunction = true; | 80 m_inRemovedLastRefFunction = true; |
| 81 #endif | 81 #endif |
| 82 thisNode->removedLastRef(); | 82 thisNode->removedLastRef(); |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 int refCount() const { return m_refCount; } | 86 int refCount() const { return m_refCount; } |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 int m_refCount; | 89 int m_refCount; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 101 #endif | 101 #endif |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 #if SECURITY_ASSERT_ENABLED | 104 #if SECURITY_ASSERT_ENABLED |
| 105 template<typename NodeType> inline void adopted(TreeShared<NodeType>* object) | 105 template<typename NodeType> inline void adopted(TreeShared<NodeType>* object) |
| 106 { | 106 { |
| 107 if (!object) | 107 if (!object) |
| 108 return; | 108 return; |
| 109 | 109 |
| 110 ASSERT_WITH_SECURITY_IMPLICATION(!object->m_deletionHasBegun); | 110 ASSERT_WITH_SECURITY_IMPLICATION(!object->m_deletionHasBegun); |
| 111 #if !ASSERT_DISABLED | 111 #if ASSERT_ENABLED |
| 112 ASSERT(!object->m_inRemovedLastRefFunction); | 112 ASSERT(!object->m_inRemovedLastRefFunction); |
| 113 object->m_adoptionIsRequired = false; | 113 object->m_adoptionIsRequired = false; |
| 114 #endif | 114 #endif |
| 115 } | 115 } |
| 116 #endif | 116 #endif |
| 117 | 117 |
| 118 } | 118 } |
| 119 | 119 |
| 120 #endif // TreeShared.h | 120 #endif // TreeShared.h |
| OLD | NEW |