OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 SkTLazy_DEFINED | 8 #ifndef SkTLazy_DEFINED |
9 #define SkTLazy_DEFINED | 9 #define SkTLazy_DEFINED |
10 | 10 |
11 #include "SkTemplates.h" | 11 #include "../private/SkTemplates.h" |
12 #include "SkTypes.h" | 12 #include "SkTypes.h" |
13 #include <new> | 13 #include <new> |
14 | 14 |
15 /** | 15 /** |
16 * Efficient way to defer allocating/initializing a class until it is needed | 16 * Efficient way to defer allocating/initializing a class until it is needed |
17 * (if ever). | 17 * (if ever). |
18 */ | 18 */ |
19 template <typename T> class SkTLazy { | 19 template <typename T> class SkTLazy { |
20 public: | 20 public: |
21 SkTLazy() : fPtr(NULL) {} | 21 SkTLazy() : fPtr(NULL) {} |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 operator const T*() const { return fObj; } | 161 operator const T*() const { return fObj; } |
162 | 162 |
163 const T& operator *() const { return *fObj; } | 163 const T& operator *() const { return *fObj; } |
164 | 164 |
165 private: | 165 private: |
166 const T* fObj; | 166 const T* fObj; |
167 SkTLazy<T> fLazy; | 167 SkTLazy<T> fLazy; |
168 }; | 168 }; |
169 | 169 |
170 #endif | 170 #endif |
OLD | NEW |