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

Unified Diff: base/lazy_instance.h

Issue 9117038: Convert all remaining explicit LeakyLazyInstanceTraits users to ::Leaky (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/mac/scoped_nsexception_enabler.mm » ('j') | content/browser/browsing_instance.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/lazy_instance.h
diff --git a/base/lazy_instance.h b/base/lazy_instance.h
index 4ed471a09bf925ce0598ec78521bb5e8f3bcfce0..5a8faa8b8c759c03c45d7dc584911d7069fe7c83 100644
--- a/base/lazy_instance.h
+++ b/base/lazy_instance.h
@@ -73,11 +73,17 @@ struct DefaultLazyInstanceTraits {
}
};
+// We pull out some of the functionality into non-templated functions, so we
+// can implement the more complicated pieces out of line in the .cc file.
+namespace internal {
+
// 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;
wtc 2012/01/24 19:39:53 Nit: In this sample code, LeakyLazyInstanceTraits
Ami GONE FROM CHROMIUM 2012/01/24 20:27:30 Right; done.
// (especially when T is MyLongTypeNameImplClientHolderFactory).
+// Only use this internal::-qualified verbose form to extend this traits class
+// (depending on its implementation details).
template <typename Type>
struct LeakyLazyInstanceTraits {
static const bool kRegisterOnExit = false;
@@ -90,10 +96,6 @@ struct LeakyLazyInstanceTraits {
}
};
-// We pull out some of the functionality into non-templated functions, so we
-// can implement the more complicated pieces out of line in the .cc file.
-namespace internal {
-
// Our AtomicWord doubles as a spinlock, where a value of
// kBeingCreatedMarker means the spinlock is being held for creation.
static const subtle::AtomicWord kLazyInstanceStateCreating = 1;
@@ -124,7 +126,7 @@ class LazyInstance {
// Convenience typedef to avoid having to repeat Type for leaky lazy
// instances.
- typedef LazyInstance<Type, LeakyLazyInstanceTraits<Type> > Leaky;
+ typedef LazyInstance<Type, internal::LeakyLazyInstanceTraits<Type> > Leaky;
Type& Get() {
return *Pointer();
« no previous file with comments | « no previous file | base/mac/scoped_nsexception_enabler.mm » ('j') | content/browser/browsing_instance.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698