| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 */ | 100 */ |
| 101 void internal_dispose_restore_refcnt_to_1() const { | 101 void internal_dispose_restore_refcnt_to_1() const { |
| 102 #ifdef SK_DEBUG | 102 #ifdef SK_DEBUG |
| 103 SkASSERT(0 == fRefCnt); | 103 SkASSERT(0 == fRefCnt); |
| 104 fRefCnt = 1; | 104 fRefCnt = 1; |
| 105 #endif | 105 #endif |
| 106 } | 106 } |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 // OK for use in asserts, but not much else. | 109 // OK for use in asserts, but not much else. |
| 110 int32_t unsafeGetRefCnt() const { return SK_ANNOTATE_UNPROTECTED_READ(fRefCn
t); } | 110 int32_t unsafeGetRefCnt() { return SK_ANNOTATE_UNPROTECTED_READ(fRefCnt); } |
| 111 | 111 |
| 112 /** | 112 /** |
| 113 * Called when the ref count goes to 0. | 113 * Called when the ref count goes to 0. |
| 114 */ | 114 */ |
| 115 virtual void internal_dispose() const { | 115 virtual void internal_dispose() const { |
| 116 this->internal_dispose_restore_refcnt_to_1(); | 116 this->internal_dispose_restore_refcnt_to_1(); |
| 117 SkDELETE(this); | 117 SkDELETE(this); |
| 118 } | 118 } |
| 119 | 119 |
| 120 // The following friends are those which override internal_dispose() | 120 // The following friends are those which override internal_dispose() |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 typedef T* SkRefPtr::*unspecified_bool_type; | 289 typedef T* SkRefPtr::*unspecified_bool_type; |
| 290 operator unspecified_bool_type() const { | 290 operator unspecified_bool_type() const { |
| 291 return fObj ? &SkRefPtr::fObj : NULL; | 291 return fObj ? &SkRefPtr::fObj : NULL; |
| 292 } | 292 } |
| 293 | 293 |
| 294 private: | 294 private: |
| 295 T* fObj; | 295 T* fObj; |
| 296 }; | 296 }; |
| 297 | 297 |
| 298 #endif | 298 #endif |
| OLD | NEW |