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

Side by Side Diff: include/core/SkTemplates.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/SkTLazy.h ('k') | include/core/SkTypes.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 SkTemplates_DEFINED 10 #ifndef SkTemplates_DEFINED
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 private: 164 private:
165 T* fObj; 165 T* fObj;
166 }; 166 };
167 167
168 // Calls ~T() in the destructor. 168 // Calls ~T() in the destructor.
169 template <typename T> class SkAutoTDestroy : SkNoncopyable { 169 template <typename T> class SkAutoTDestroy : SkNoncopyable {
170 public: 170 public:
171 SkAutoTDestroy(T* obj = NULL) : fObj(obj) {} 171 SkAutoTDestroy(T* obj = NULL) : fObj(obj) {}
172 ~SkAutoTDestroy() { 172 ~SkAutoTDestroy() {
173 if (NULL != fObj) { 173 if (fObj) {
174 fObj->~T(); 174 fObj->~T();
175 } 175 }
176 } 176 }
177 177
178 T* get() const { return fObj; } 178 T* get() const { return fObj; }
179 T& operator*() const { SkASSERT(fObj); return *fObj; } 179 T& operator*() const { SkASSERT(fObj); return *fObj; }
180 T* operator->() const { SkASSERT(fObj); return fObj; } 180 T* operator->() const { SkASSERT(fObj); return fObj; }
181 181
182 private: 182 private:
183 T* fObj; 183 T* fObj;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 /** 483 /**
484 * Returns void* because this object does not initialize the 484 * Returns void* because this object does not initialize the
485 * memory. Use placement new for types that require a cons. 485 * memory. Use placement new for types that require a cons.
486 */ 486 */
487 void* get() { return fStorage.get(); } 487 void* get() { return fStorage.get(); }
488 private: 488 private:
489 SkAlignedSStorage<sizeof(T)*N> fStorage; 489 SkAlignedSStorage<sizeof(T)*N> fStorage;
490 }; 490 };
491 491
492 #endif 492 #endif
OLDNEW
« no previous file with comments | « include/core/SkTLazy.h ('k') | include/core/SkTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698