| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 BASE_REF_COUNTED_H_ | 5 #ifndef BASE_REF_COUNTED_H_ |
| 6 #define BASE_REF_COUNTED_H_ | 6 #define BASE_REF_COUNTED_H_ |
| 7 | 7 |
| 8 #include "base/atomic_ref_count.h" | 8 #include "base/atomic_ref_count.h" |
| 9 #include "base/thread_collision_warner.h" | 9 #include "base/thread_collision_warner.h" |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 AtomicRefCount ref_count_; | 57 AtomicRefCount ref_count_; |
| 58 #ifndef NDEBUG | 58 #ifndef NDEBUG |
| 59 bool in_dtor_; | 59 bool in_dtor_; |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase); | 62 DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 | |
| 66 | |
| 67 } // namespace subtle | 65 } // namespace subtle |
| 68 | 66 |
| 69 // | 67 // |
| 70 // A base class for reference counted classes. Otherwise, known as a cheap | 68 // A base class for reference counted classes. Otherwise, known as a cheap |
| 71 // knock-off of WebKit's RefCounted<T> class. To use this guy just extend your | 69 // knock-off of WebKit's RefCounted<T> class. To use this guy just extend your |
| 72 // class from it like so: | 70 // class from it like so: |
| 73 // | 71 // |
| 74 // class MyFoo : public base::RefCounted<MyFoo> { | 72 // class MyFoo : public base::RefCounted<MyFoo> { |
| 75 // ... | 73 // ... |
| 76 // }; | 74 // }; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 241 |
| 244 void swap(scoped_refptr<T>& r) { | 242 void swap(scoped_refptr<T>& r) { |
| 245 swap(&r.ptr_); | 243 swap(&r.ptr_); |
| 246 } | 244 } |
| 247 | 245 |
| 248 protected: | 246 protected: |
| 249 T* ptr_; | 247 T* ptr_; |
| 250 }; | 248 }; |
| 251 | 249 |
| 252 #endif // BASE_REF_COUNTED_H_ | 250 #endif // BASE_REF_COUNTED_H_ |
| OLD | NEW |