OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkRefCnt_DEFINED | 8 #ifndef SkRefCnt_DEFINED |
9 #define SkRefCnt_DEFINED | 9 #define SkRefCnt_DEFINED |
10 | 10 |
11 #include "SkAtomics.h" | 11 #include "../private/SkAtomics.h" |
12 #include "SkTypes.h" | 12 #include "SkTypes.h" |
13 | 13 |
14 /** \class SkRefCntBase | 14 /** \class SkRefCntBase |
15 | 15 |
16 SkRefCntBase is the base class for objects that may be shared by multiple | 16 SkRefCntBase is the base class for objects that may be shared by multiple |
17 objects. When an existing owner wants to share a reference, it calls ref(). | 17 objects. When an existing owner wants to share a reference, it calls ref(). |
18 When an owner wants to release its reference, it calls unref(). When the | 18 When an owner wants to release its reference, it calls unref(). When the |
19 shared object's reference count goes to zero as the result of an unref() | 19 shared object's reference count goes to zero as the result of an unref() |
20 call, its (virtual) destructor is called. It is an error for the | 20 call, its (virtual) destructor is called. It is an error for the |
21 destructor to be called explicitly (or via the object going out of scope on | 21 destructor to be called explicitly (or via the object going out of scope on |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 delete (const Derived*)this; | 246 delete (const Derived*)this; |
247 } | 247 } |
248 } | 248 } |
249 void deref() const { this->unref(); } | 249 void deref() const { this->unref(); } |
250 | 250 |
251 private: | 251 private: |
252 mutable int32_t fRefCnt; | 252 mutable int32_t fRefCnt; |
253 }; | 253 }; |
254 | 254 |
255 #endif | 255 #endif |
OLD | NEW |