summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cert_store.cc
diff options
context:
space:
mode:
authorwtc@google.com <wtc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-29 17:42:29 +0000
committerwtc@google.com <wtc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-29 17:42:29 +0000
commitefb8bc81fd2d43607bf50cfa4cc12317d1a4c986 (patch)
treebae56fd6be197315f7335f06c24973e5ee9635a3 /chrome/browser/cert_store.cc
parent4d2b21a7f31a3eb41d5d5d6292ca2c7bc75f8ace (diff)
downloadchromium_src-efb8bc81fd2d43607bf50cfa4cc12317d1a4c986.zip
chromium_src-efb8bc81fd2d43607bf50cfa4cc12317d1a4c986.tar.gz
chromium_src-efb8bc81fd2d43607bf50cfa4cc12317d1a4c986.tar.bz2
Don't use cert_lock_ as a reentrant lock. RemoveCert is
renamed RemoveCertInternal to stress the fact that it should be called with the lock held. Fix miscellaneous nits complained by cpplint. R=jcampan Review URL: http://codereview.chromium.org/5024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2677 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cert_store.cc')
-rw-r--r--chrome/browser/cert_store.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/chrome/browser/cert_store.cc b/chrome/browser/cert_store.cc
index 53d71fb..542b3d8 100644
--- a/chrome/browser/cert_store.cc
+++ b/chrome/browser/cert_store.cc
@@ -13,7 +13,7 @@
template <typename T>
struct MatchSecond {
- MatchSecond(const T& t) : value(t) {}
+ explicit MatchSecond(const T& t) : value(t) {}
template<typename Pair>
bool operator()(const Pair& p) const {
@@ -40,9 +40,9 @@ CertStore* CertStore::GetSharedInstance() {
CertStore::CertStore() : next_cert_id_(1) {
// We watch for RenderProcess termination, as this is how we clear
// certificates for now.
- // TODO (jcampan): we should be listening to events such as resource cached/
- // removed from cache, and remove the cert when we know it
- // is not used anymore.
+ // TODO(jcampan): we should be listening to events such as resource cached/
+ // removed from cache, and remove the cert when we know it
+ // is not used anymore.
// TODO(tc): This notification observer never gets removed because the
// CertStore is never deleted.
@@ -93,18 +93,16 @@ int CertStore::StoreCert(net::X509Certificate* cert, int process_id) {
bool CertStore::RetrieveCert(int cert_id,
scoped_refptr<net::X509Certificate>* cert) {
- AutoLock autoLock(cert_lock_);
+ AutoLock autoLock(cert_lock_);
- CertMap::iterator iter = id_to_cert_.find(cert_id);
- if (iter == id_to_cert_.end())
- return false;
- *cert = iter->second;
- return true;
+ CertMap::iterator iter = id_to_cert_.find(cert_id);
+ if (iter == id_to_cert_.end())
+ return false;
+ *cert = iter->second;
+ return true;
}
-void CertStore::RemoveCert(int cert_id) {
- AutoLock autoLock(cert_lock_);
-
+void CertStore::RemoveCertInternal(int cert_id) {
CertMap::iterator cert_iter = id_to_cert_.find(cert_id);
DCHECK(cert_iter != id_to_cert_.end());
@@ -135,7 +133,7 @@ void CertStore::RemoveCertsForRenderProcesHost(int process_id) {
if (cert_id_to_process_id_.count(cert_id) == 0) {
// This cert is not referenced by any process, remove it from id_to_cert_
// and cert_to_id_.
- RemoveCert(cert_id);
+ RemoveCertInternal(cert_id);
}
// Erase the current item but keep the iterator valid.