Index: base/lazy_instance.h |
diff --git a/base/lazy_instance.h b/base/lazy_instance.h |
index ededc73cbbaeba9d426c85e7d85ef4a9be7b0ed6..3d8507845fec921427183197e4d0fb6364948259 100644 |
--- a/base/lazy_instance.h |
+++ b/base/lazy_instance.h |
@@ -73,6 +73,11 @@ struct DefaultLazyInstanceTraits { |
} |
}; |
+// Use LazyInstance<T>::Leaky for a less-verbose call-site typedef; e.g.: |
+// base::LazyInstance<T>::Leaky my_leaky_lazy_instance; |
+// instead of: |
+// base::LazyInstance<T, LeakyLazyInstanceTraits<T> > my_leaky_lazy_instance; |
+// (especially when T is MyLongTypeNameImplClientHolderFactory). |
template <typename Type> |
struct LeakyLazyInstanceTraits { |
static const bool kRegisterOnExit = false; |
@@ -117,6 +122,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(); |
} |