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

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

Issue 263883006: add release-mode checks for null, at least for a while (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« 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
69 if (this->isValid()) { 74 if (this->isValid()) {
70 *fPtr = src; 75 *fPtr = src;
71 } else { 76 } else {
72 fPtr = new (SkTCast<T*>(fStorage)) T(src); 77 fPtr = new (SkTCast<T*>(fStorage)) T(src);
73 } 78 }
74 return fPtr; 79 return fPtr;
75 } 80 }
76 81
77 /** 82 /**
78 * Destroy the lazy object (if it was created via init() or set()) 83 * Destroy the lazy object (if it was created via init() or set())
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 operator const T*() const { return fObj; } 188 operator const T*() const { return fObj; }
184 189
185 const T& operator *() const { return *fObj; } 190 const T& operator *() const { return *fObj; }
186 191
187 private: 192 private:
188 const T* fObj; 193 const T* fObj;
189 SkTLazy<T> fLazy; 194 SkTLazy<T> fLazy;
190 }; 195 };
191 196
192 #endif 197 #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