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_UTILS_REF_OBJECT | 6 #ifndef LIBRARIES_SDK_UTIL_REF_OBJECT |
7 #define LIBRARIES_UTILS_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 class RefObject { | 12 class RefObject { |
13 public: | 13 public: |
14 RefObject() { | 14 RefObject() { |
15 ref_count_ = 1; | 15 ref_count_ = 1; |
16 pthread_mutex_init(&lock_, NULL); | 16 pthread_mutex_init(&lock_, NULL); |
17 } | 17 } |
(...skipping 20 matching lines...) Expand all Loading... |
38 | 38 |
39 // Override to clean up object when last reference is released. | 39 // Override to clean up object when last reference is released. |
40 virtual void Destroy() {} | 40 virtual void Destroy() {} |
41 | 41 |
42 pthread_mutex_t lock_; | 42 pthread_mutex_t lock_; |
43 | 43 |
44 private: | 44 private: |
45 int ref_count_; | 45 int ref_count_; |
46 }; | 46 }; |
47 | 47 |
48 #endif // LIBRARIES_UTILS_REF_OBJECT | 48 #endif // LIBRARIES_SDK_UTIL_REF_OBJECT |
| 49 |
OLD | NEW |