Index: base/singleton.h |
diff --git a/base/singleton.h b/base/singleton.h |
index 8435c430c49941d079cd4db649d3ec16e921edcc..8ef265d7ec267f31ccfde0b801cf1c6423869fb8 100644 |
--- a/base/singleton.h |
+++ b/base/singleton.h |
@@ -114,7 +114,6 @@ template <typename Type> intptr_t |
template <typename Type> base::subtle::Atomic32 |
StaticMemorySingletonTraits<Type>::dead_ = 0; |
- |
// The Singleton<Type, Traits, DifferentiatingType> class manages a single |
// instance of Type which will be created on first use and will be destroyed at |
// normal process exit). The Trait::Delete function will not be called on |
@@ -179,7 +178,11 @@ template <typename Type, |
typename Traits = DefaultSingletonTraits<Type>, |
typename DifferentiatingType = Type> |
class Singleton { |
- public: |
+ private: |
+ // Classes using the Singleton<T> pattern should declare a GetInstance() |
+ // method and call Singleton::get() from within that. |
+ friend Type* Type::GetInstance(); |
+ |
// This class is safe to be constructed and copy-constructed since it has no |
// member. |