Chromium Code Reviews| Index: base/lazy_instance.h |
| diff --git a/base/lazy_instance.h b/base/lazy_instance.h |
| index ededc73cbbaeba9d426c85e7d85ef4a9be7b0ed6..1702b41cb27c77dee202a4a9d29bf3b2c40fba0c 100644 |
| --- a/base/lazy_instance.h |
| +++ b/base/lazy_instance.h |
| @@ -73,6 +73,7 @@ struct DefaultLazyInstanceTraits { |
| } |
| }; |
| +// Use LazyInstance<T>::Leaky for a less-verbose call-site typedef. |
|
wtc
2012/01/21 00:51:01
Nit: would be nice to give an example. Before I s
Ami GONE FROM CHROMIUM
2012/01/21 01:22:30
Done.
|
| template <typename Type> |
| struct LeakyLazyInstanceTraits { |
| static const bool kRegisterOnExit = false; |
| @@ -117,6 +118,10 @@ class LazyInstance { |
| // the OnExit member function, where needed. |
| // ~LazyInstance() {} |
| + // Convenience typedef to avoid having to repeat Type for leaky lazy |
| + // instances. |
| + typedef LazyInstance<Type, LeakyLazyInstanceTraits<Type> > Leaky; |
| + |
| Type& Get() { |
| return *Pointer(); |
| } |