OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkRefCnt_DEFINED | 10 #ifndef SkRefCnt_DEFINED |
(...skipping 19 matching lines...) Expand all Loading... |
30 SK_DECLARE_INST_COUNT_ROOT(SkRefCntBase) | 30 SK_DECLARE_INST_COUNT_ROOT(SkRefCntBase) |
31 | 31 |
32 /** Default construct, initializing the reference count to 1. | 32 /** Default construct, initializing the reference count to 1. |
33 */ | 33 */ |
34 SkRefCntBase() : fRefCnt(1) {} | 34 SkRefCntBase() : fRefCnt(1) {} |
35 | 35 |
36 /** Destruct, asserting that the reference count is 1. | 36 /** Destruct, asserting that the reference count is 1. |
37 */ | 37 */ |
38 virtual ~SkRefCntBase() { | 38 virtual ~SkRefCntBase() { |
39 #ifdef SK_DEBUG | 39 #ifdef SK_DEBUG |
40 SkASSERT(fRefCnt == 1); | 40 SkASSERTF(fRefCnt == 1, "fRefCnt was %d", fRefCnt); |
41 fRefCnt = 0; // illegal value, to catch us if we reuse after delete | 41 fRefCnt = 0; // illegal value, to catch us if we reuse after delete |
42 #endif | 42 #endif |
43 } | 43 } |
44 | 44 |
45 /** Return the reference count. Use only for debugging. */ | 45 /** Return the reference count. Use only for debugging. */ |
46 int32_t getRefCnt() const { return fRefCnt; } | 46 int32_t getRefCnt() const { return fRefCnt; } |
47 | 47 |
48 /** May return true if the caller is the only owner. | 48 /** May return true if the caller is the only owner. |
49 * Ensures that all previous owner's actions are complete. | 49 * Ensures that all previous owner's actions are complete. |
50 */ | 50 */ |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 typedef T* SkRefPtr::*unspecified_bool_type; | 283 typedef T* SkRefPtr::*unspecified_bool_type; |
284 operator unspecified_bool_type() const { | 284 operator unspecified_bool_type() const { |
285 return fObj ? &SkRefPtr::fObj : NULL; | 285 return fObj ? &SkRefPtr::fObj : NULL; |
286 } | 286 } |
287 | 287 |
288 private: | 288 private: |
289 T* fObj; | 289 T* fObj; |
290 }; | 290 }; |
291 | 291 |
292 #endif | 292 #endif |
OLD | NEW |