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

Unified Diff: base/singleton.h

Issue 5685007: Rename all methods accessing Singleton<T> as GetInstance(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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
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.

Powered by Google App Engine
This is Rietveld 408576698