Index: base/lazy_instance.h |
diff --git a/base/lazy_instance.h b/base/lazy_instance.h |
index ededc73cbbaeba9d426c85e7d85ef4a9be7b0ed6..4672c3f0519440ae6cfc694beff58ebdd52a9c32 100644 |
--- a/base/lazy_instance.h |
+++ b/base/lazy_instance.h |
@@ -73,6 +73,8 @@ struct DefaultLazyInstanceTraits { |
} |
}; |
+// Use LazyInstance<T>::Leaky for a less-verbose call-site typedef; e.g.: |
+// LazyInstance<MyType>::Leaky my_leaky_lazy_instance; |
wtc
2012/01/21 01:47:36
I suggest also showing the verbose form it replace
Ami GONE FROM CHROMIUM
2012/01/21 04:49:20
Done.
|
template <typename Type> |
struct LeakyLazyInstanceTraits { |
static const bool kRegisterOnExit = false; |
@@ -117,6 +119,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(); |
} |