| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 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 SkWeakRefCnt_DEFINED | 8 #ifndef SkWeakRefCnt_DEFINED |
| 9 #define SkWeakRefCnt_DEFINED | 9 #define SkWeakRefCnt_DEFINED |
| 10 | 10 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 by the object's class. | 140 by the object's class. |
| 141 */ | 141 */ |
| 142 virtual void weak_dispose() const { | 142 virtual void weak_dispose() const { |
| 143 } | 143 } |
| 144 | 144 |
| 145 private: | 145 private: |
| 146 /** Called when the strong reference count goes to zero. Calls weak_dispose | 146 /** Called when the strong reference count goes to zero. Calls weak_dispose |
| 147 on the object and releases the implicit weak reference held | 147 on the object and releases the implicit weak reference held |
| 148 collectively by the strong references. | 148 collectively by the strong references. |
| 149 */ | 149 */ |
| 150 virtual void internal_dispose() const SK_OVERRIDE { | 150 void internal_dispose() const SK_OVERRIDE { |
| 151 weak_dispose(); | 151 weak_dispose(); |
| 152 weak_unref(); | 152 weak_unref(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 /* Invariant: fWeakCnt = #weak + (fRefCnt > 0 ? 1 : 0) */ | 155 /* Invariant: fWeakCnt = #weak + (fRefCnt > 0 ? 1 : 0) */ |
| 156 mutable int32_t fWeakCnt; | 156 mutable int32_t fWeakCnt; |
| 157 | 157 |
| 158 typedef SkRefCnt INHERITED; | 158 typedef SkRefCnt INHERITED; |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 #endif | 161 #endif |
| OLD | NEW |