Index: base/memory/singleton.h |
diff --git a/base/memory/singleton.h b/base/memory/singleton.h |
index cfdff7831f9f7b5a4ad1be5aa955f33d73112641..5c58d5fe2944cd332980fb39f5dc5e815a48c0d4 100644 |
--- a/base/memory/singleton.h |
+++ b/base/memory/singleton.h |
@@ -153,14 +153,17 @@ subtle::Atomic32 StaticMemorySingletonTraits<Type>::dead_ = 0; |
// Example usage: |
// |
// In your header: |
-// template <typename T> struct DefaultSingletonTraits; |
+// namespace base { |
+// template <typename T> |
danakj
2017/03/09 21:18:22
nit: keep this as one line
Patrick Monette
2017/03/09 23:02:13
That's how "git cl format" does it. IMO this examp
danakj
2017/03/09 23:04:18
Ah, fair enough.
|
+// struct DefaultSingletonTraits; |
+// } |
// class FooClass { |
// public: |
// static FooClass* GetInstance(); <-- See comment below on this. |
// void Bar() { ... } |
// private: |
// FooClass() { ... } |
-// friend struct DefaultSingletonTraits<FooClass>; |
+// friend struct base::DefaultSingletonTraits<FooClass>; |
// |
// DISALLOW_COPY_AND_ASSIGN(FooClass); |
// }; |
@@ -168,7 +171,14 @@ subtle::Atomic32 StaticMemorySingletonTraits<Type>::dead_ = 0; |
// In your source file: |
// #include "base/memory/singleton.h" |
// FooClass* FooClass::GetInstance() { |
-// return Singleton<FooClass>::get(); |
+// return base::Singleton<FooClass>::get(); |
+// } |
+// |
+// Or for leaky singletons: |
+// #include "base/memory/singleton.h" |
+// FooClass* FooClass::GetInstance() { |
+// return base::Singleton< |
+// FooClass, base::LeakySingletonTraits<FooClass>>::get(); |
// } |
// |
// And to call methods on FooClass: |