diff options
author | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-03 20:32:38 +0000 |
---|---|---|
committer | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-03 20:32:38 +0000 |
commit | 60d7ac9547b08ce7f9b8bcc48bd4fc420c8b07a9 (patch) | |
tree | 8811a2b1c8287accebedb12e6383abf937b7afb4 /base | |
parent | 24a14e8415f49c0aa2d7f1d0debc6faf2e3d7d20 (diff) | |
download | chromium_src-60d7ac9547b08ce7f9b8bcc48bd4fc420c8b07a9.zip chromium_src-60d7ac9547b08ce7f9b8bcc48bd4fc420c8b07a9.tar.gz chromium_src-60d7ac9547b08ce7f9b8bcc48bd4fc420c8b07a9.tar.bz2 |
Add Singleton traits for a "leaky singleton" - one that does
not clean up at exit.
Review URL: http://codereview.chromium.org/13069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6303 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/singleton.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/base/singleton.h b/base/singleton.h index c6a1685..00cd448 100644 --- a/base/singleton.h +++ b/base/singleton.h @@ -31,6 +31,16 @@ struct DefaultSingletonTraits { static const bool kRegisterAtExit = true; }; + +// Alternate traits for use with the Singleton<Type>. Identical to +// DefaultSingletonTraits except that the Singleton will not be cleaned up +// at exit. +template<typename Type> +struct LeakySingletonTraits : public DefaultSingletonTraits<Type> { + static const bool kRegisterAtExit = false; +}; + + // 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 |