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

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

Issue 325603002: Clean up Skia for Clang's -Wtautological-undefined-compare (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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 | src/core/SkPaint.cpp » ('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 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 return fPtr; 59 return fPtr;
60 } 60 }
61 61
62 /** 62 /**
63 * Copy src into this, and return a pointer to a copy of it. Note this 63 * Copy src into this, and return a pointer to a copy of it. Note this
64 * will always return the same pointer, so if it is called on a lazy that 64 * will always return the same pointer, so if it is called on a lazy that
65 * has already been initialized, then this will copy over the previous 65 * has already been initialized, then this will copy over the previous
66 * contents. 66 * contents.
67 */ 67 */
68 T* set(const T& src) { 68 T* set(const T& src) {
69 // Diagnoistic. May remove later. See crbug.com/364224
70 if (NULL == &src) {
71 sk_throw();
72 }
73
74 if (this->isValid()) { 69 if (this->isValid()) {
75 *fPtr = src; 70 *fPtr = src;
76 } else { 71 } else {
77 fPtr = new (SkTCast<T*>(fStorage)) T(src); 72 fPtr = new (SkTCast<T*>(fStorage)) T(src);
78 } 73 }
79 return fPtr; 74 return fPtr;
80 } 75 }
81 76
82 /** 77 /**
83 * Destroy the lazy object (if it was created via init() or set()) 78 * Destroy the lazy object (if it was created via init() or set())
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 operator const T*() const { return fObj; } 183 operator const T*() const { return fObj; }
189 184
190 const T& operator *() const { return *fObj; } 185 const T& operator *() const { return *fObj; }
191 186
192 private: 187 private:
193 const T* fObj; 188 const T* fObj;
194 SkTLazy<T> fLazy; 189 SkTLazy<T> fLazy;
195 }; 190 };
196 191
197 #endif 192 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698