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 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 mutable std::atomic<int32_t> fRefCnt; | 127 mutable std::atomic<int32_t> fRefCnt; |
128 | 128 |
129 typedef SkNoncopyable INHERITED; | 129 typedef SkNoncopyable INHERITED; |
130 }; | 130 }; |
131 | 131 |
132 #ifdef SK_REF_CNT_MIXIN_INCLUDE | 132 #ifdef SK_REF_CNT_MIXIN_INCLUDE |
133 // It is the responsibility of the following include to define the type SkRefCnt
. | 133 // It is the responsibility of the following include to define the type SkRefCnt
. |
134 // This SkRefCnt should normally derive from SkRefCntBase. | 134 // This SkRefCnt should normally derive from SkRefCntBase. |
135 #include SK_REF_CNT_MIXIN_INCLUDE | 135 #include SK_REF_CNT_MIXIN_INCLUDE |
136 #else | 136 #else |
137 class SK_API SkRefCnt : public SkRefCntBase { }; | 137 class SK_API SkRefCnt : public SkRefCntBase { |
| 138 // "#include SK_REF_CNT_MIXIN_INCLUDE" doesn't work with this build system. |
| 139 #if defined(GOOGLE3) |
| 140 public: |
| 141 void deref() const { this->unref(); } |
| 142 #endif |
| 143 }; |
138 #endif | 144 #endif |
139 | 145 |
140 /////////////////////////////////////////////////////////////////////////////// | 146 /////////////////////////////////////////////////////////////////////////////// |
141 | 147 |
142 /** Helper macro to safely assign one SkRefCnt[TS]* to another, checking for | 148 /** Helper macro to safely assign one SkRefCnt[TS]* to another, checking for |
143 null in on each side of the assignment, and ensuring that ref() is called | 149 null in on each side of the assignment, and ensuring that ref() is called |
144 before unref(), in case the two pointers point to the same object. | 150 before unref(), in case the two pointers point to the same object. |
145 */ | 151 */ |
146 #define SkRefCnt_SafeAssign(dst, src) \ | 152 #define SkRefCnt_SafeAssign(dst, src) \ |
147 do { \ | 153 do { \ |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 * | 459 * |
454 * This function may be helpful while we convert callers from ptr-based to sk_s
p-based parameters. | 460 * This function may be helpful while we convert callers from ptr-based to sk_s
p-based parameters. |
455 */ | 461 */ |
456 template <typename T> sk_sp<T> sk_ref_sp(T* obj) { | 462 template <typename T> sk_sp<T> sk_ref_sp(T* obj) { |
457 return sk_sp<T>(SkSafeRef(obj)); | 463 return sk_sp<T>(SkSafeRef(obj)); |
458 } | 464 } |
459 | 465 |
460 #endif | 466 #endif |
461 | 467 |
462 #endif | 468 #endif |
OLD | NEW |