OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 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 | 5 |
6 #ifndef LIBRARIES_SDK_UTIL_REF_OBJECT | 6 #ifndef LIBRARIES_SDK_UTIL_REF_OBJECT |
7 #define LIBRARIES_SDK_UTIL_REF_OBJECT | 7 #define LIBRARIES_SDK_UTIL_REF_OBJECT |
8 | 8 |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include "pthread.h" | 10 #include "pthread.h" |
11 | 11 |
12 #include "sdk_util/atomicops.h" | 12 #include "sdk_util/atomicops.h" |
13 | 13 |
| 14 namespace sdk_util { |
| 15 |
14 class ScopedRefBase; | 16 class ScopedRefBase; |
15 | 17 |
16 /* | 18 /* |
17 * RefObject | 19 * RefObject |
18 * | 20 * |
19 * A reference counted object. RefObjects should only be handled by ScopedRef | 21 * A reference counted object. RefObjects should only be handled by ScopedRef |
20 * objects. | 22 * objects. |
21 * | 23 * |
22 * When the object is first created, it has a reference count of zero. It's | 24 * When the object is first created, it has a reference count of zero. It's |
23 * first incremented when it gets assigned to a ScopedRef. When the last | 25 * first incremented when it gets assigned to a ScopedRef. When the last |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 62 } |
61 return true; | 63 return true; |
62 } | 64 } |
63 | 65 |
64 private: | 66 private: |
65 Atomic32 ref_count_; | 67 Atomic32 ref_count_; |
66 | 68 |
67 friend class ScopedRefBase; | 69 friend class ScopedRefBase; |
68 }; | 70 }; |
69 | 71 |
| 72 } // namespace sdk_util |
| 73 |
70 #endif // LIBRARIES_SDK_UTIL_REF_OBJECT | 74 #endif // LIBRARIES_SDK_UTIL_REF_OBJECT |
71 | 75 |
OLD | NEW |