Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: include/core/SkRefCnt.h

Issue 1890573003: For GOOGLE3, add deref method to SkRefCnt. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698