diff options
author | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-09 16:42:15 +0000 |
---|---|---|
committer | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-09 16:42:15 +0000 |
commit | fee46a89f493080db0838e2314b4400faeec94f3 (patch) | |
tree | 6e857fcf0b6b548b526c45d24879ad6422d50856 /chrome/browser/extensions/crx_installer.cc | |
parent | f2d1f61006eac0f8a051fa485b2cffb6b6fa74e0 (diff) | |
download | chromium_src-fee46a89f493080db0838e2314b4400faeec94f3.zip chromium_src-fee46a89f493080db0838e2314b4400faeec94f3.tar.gz chromium_src-fee46a89f493080db0838e2314b4400faeec94f3.tar.bz2 |
This is a continuation of http://codereview.chromium.org/5519016/, adds a new GetInstance() method for remaining files with singleton classes under chrome/browser.
For types declared and used within the same .cc file, I changed them over to LazyInstance<T>.
BUG=65298
TEST=all existing tests should continue to pass.
Review URL: http://codereview.chromium.org/5711001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/crx_installer.cc')
-rw-r--r-- | chrome/browser/extensions/crx_installer.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index 294bdcb..6d937a6 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -9,9 +9,9 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/file_util.h" +#include "base/lazy_instance.h" #include "base/path_service.h" #include "base/scoped_temp_dir.h" -#include "base/singleton.h" #include "base/stl_util-inl.h" #include "base/stringprintf.h" #include "base/time.h" @@ -51,25 +51,28 @@ struct WhitelistedInstallData { std::set<std::string> ids; }; +static base::LazyInstance<WhitelistedInstallData> + g_whitelisted_install_data(base::LINKER_INITIALIZED); + } // namespace // static void CrxInstaller::SetWhitelistedInstallId(const std::string& id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - Singleton<WhitelistedInstallData>::get()->ids.insert(id); + g_whitelisted_install_data.Get().ids.insert(id); } // static bool CrxInstaller::IsIdWhitelisted(const std::string& id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - std::set<std::string>& ids = Singleton<WhitelistedInstallData>::get()->ids; + std::set<std::string>& ids = g_whitelisted_install_data.Get().ids; return ContainsKey(ids, id); } // static bool CrxInstaller::ClearWhitelistedInstallId(const std::string& id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - std::set<std::string>& ids = Singleton<WhitelistedInstallData>::get()->ids; + std::set<std::string>& ids = g_whitelisted_install_data.Get().ids; if (ContainsKey(ids, id)) { ids.erase(id); return true; |