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

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

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 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 | « include/core/SkPathRef.h ('k') | include/core/SkTArray.h » ('j') | 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 /* 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 /** Check if the argument is non-null, and if so, call obj->unref() 162 /** Check if the argument is non-null, and if so, call obj->unref()
163 */ 163 */
164 template <typename T> static inline void SkSafeUnref(T* obj) { 164 template <typename T> static inline void SkSafeUnref(T* obj) {
165 if (obj) { 165 if (obj) {
166 obj->unref(); 166 obj->unref();
167 } 167 }
168 } 168 }
169 169
170 template<typename T> static inline void SkSafeSetNull(T*& obj) { 170 template<typename T> static inline void SkSafeSetNull(T*& obj) {
171 if (NULL != obj) { 171 if (obj) {
172 obj->unref(); 172 obj->unref();
173 obj = NULL; 173 obj = NULL;
174 } 174 }
175 } 175 }
176 176
177 /////////////////////////////////////////////////////////////////////////////// 177 ///////////////////////////////////////////////////////////////////////////////
178 178
179 /** 179 /**
180 * Utility class that simply unref's its argument in the destructor. 180 * Utility class that simply unref's its argument in the destructor.
181 */ 181 */
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 }; 241 };
242 // 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. :(
243 243
244 class SkAutoUnref : public SkAutoTUnref<SkRefCnt> { 244 class SkAutoUnref : public SkAutoTUnref<SkRefCnt> {
245 public: 245 public:
246 SkAutoUnref(SkRefCnt* obj) : SkAutoTUnref<SkRefCnt>(obj) {} 246 SkAutoUnref(SkRefCnt* obj) : SkAutoTUnref<SkRefCnt>(obj) {}
247 }; 247 };
248 #define SkAutoUnref(...) SK_REQUIRE_LOCAL_VAR(SkAutoUnref) 248 #define SkAutoUnref(...) SK_REQUIRE_LOCAL_VAR(SkAutoUnref)
249 249
250 #endif 250 #endif
OLDNEW
« no previous file with comments | « include/core/SkPathRef.h ('k') | include/core/SkTArray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698