| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/threading/thread_collision_warner.h" | 8 #include "base/threading/thread_collision_warner.h" |
| 9 | 9 |
| 10 namespace base { | 10 namespace base { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #endif | 44 #endif |
| 45 if (--ref_count_ == 0) { | 45 if (--ref_count_ == 0) { |
| 46 #ifndef NDEBUG | 46 #ifndef NDEBUG |
| 47 in_dtor_ = true; | 47 in_dtor_ = true; |
| 48 #endif | 48 #endif |
| 49 return true; | 49 return true; |
| 50 } | 50 } |
| 51 return false; | 51 return false; |
| 52 } | 52 } |
| 53 | 53 |
| 54 void RefCountedBase::ClearInDtor() const { |
| 55 #ifndef NDEBUG |
| 56 in_dtor_ = false; |
| 57 #endif |
| 58 } |
| 59 |
| 54 bool RefCountedThreadSafeBase::HasOneRef() const { | 60 bool RefCountedThreadSafeBase::HasOneRef() const { |
| 55 return AtomicRefCountIsOne( | 61 return AtomicRefCountIsOne( |
| 56 &const_cast<RefCountedThreadSafeBase*>(this)->ref_count_); | 62 &const_cast<RefCountedThreadSafeBase*>(this)->ref_count_); |
| 57 } | 63 } |
| 58 | 64 |
| 59 RefCountedThreadSafeBase::RefCountedThreadSafeBase() : ref_count_(0) { | 65 RefCountedThreadSafeBase::RefCountedThreadSafeBase() : ref_count_(0) { |
| 60 #ifndef NDEBUG | 66 #ifndef NDEBUG |
| 61 in_dtor_ = false; | 67 in_dtor_ = false; |
| 62 #endif | 68 #endif |
| 63 } | 69 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 86 in_dtor_ = true; | 92 in_dtor_ = true; |
| 87 #endif | 93 #endif |
| 88 return true; | 94 return true; |
| 89 } | 95 } |
| 90 return false; | 96 return false; |
| 91 } | 97 } |
| 92 | 98 |
| 93 } // namespace subtle | 99 } // namespace subtle |
| 94 | 100 |
| 95 } // namespace base | 101 } // namespace base |
| OLD | NEW |