| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 /** | 106 /** |
| 107 * Called when the ref count goes to 0. | 107 * Called when the ref count goes to 0. |
| 108 */ | 108 */ |
| 109 virtual void internal_dispose() const { | 109 virtual void internal_dispose() const { |
| 110 this->internal_dispose_restore_refcnt_to_1(); | 110 this->internal_dispose_restore_refcnt_to_1(); |
| 111 SkDELETE(this); | 111 SkDELETE(this); |
| 112 } | 112 } |
| 113 | 113 |
| 114 // The following friends are those which override internal_dispose() | 114 // The following friends are those which override internal_dispose() |
| 115 // and conditionally call SkRefCnt::internal_dispose(). | 115 // and conditionally call SkRefCnt::internal_dispose(). |
| 116 friend class GrTexture; | |
| 117 friend class SkWeakRefCnt; | 116 friend class SkWeakRefCnt; |
| 118 | 117 |
| 119 mutable int32_t fRefCnt; | 118 mutable int32_t fRefCnt; |
| 120 | 119 |
| 121 typedef SkNoncopyable INHERITED; | 120 typedef SkNoncopyable INHERITED; |
| 122 }; | 121 }; |
| 123 | 122 |
| 124 #ifdef SK_REF_CNT_MIXIN_INCLUDE | 123 #ifdef SK_REF_CNT_MIXIN_INCLUDE |
| 125 // It is the responsibility of the following include to define the type SkRefCnt
. | 124 // It is the responsibility of the following include to define the type SkRefCnt
. |
| 126 // This SkRefCnt should normally derive from SkRefCntBase. | 125 // This SkRefCnt should normally derive from SkRefCntBase. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 }; | 241 }; |
| 243 // Can't use the #define trick below to guard a bare SkAutoTUnref(...) because i
t's templated. :( | 242 // Can't use the #define trick below to guard a bare SkAutoTUnref(...) because i
t's templated. :( |
| 244 | 243 |
| 245 class SkAutoUnref : public SkAutoTUnref<SkRefCnt> { | 244 class SkAutoUnref : public SkAutoTUnref<SkRefCnt> { |
| 246 public: | 245 public: |
| 247 SkAutoUnref(SkRefCnt* obj) : SkAutoTUnref<SkRefCnt>(obj) {} | 246 SkAutoUnref(SkRefCnt* obj) : SkAutoTUnref<SkRefCnt>(obj) {} |
| 248 }; | 247 }; |
| 249 #define SkAutoUnref(...) SK_REQUIRE_LOCAL_VAR(SkAutoUnref) | 248 #define SkAutoUnref(...) SK_REQUIRE_LOCAL_VAR(SkAutoUnref) |
| 250 | 249 |
| 251 #endif | 250 #endif |
| OLD | NEW |