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

Unified Diff: chrome/browser/cert_store.cc

Issue 5024: Avoid locking cert_lock_ again from the same thread.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 3 months 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
« no previous file with comments | « chrome/browser/cert_store.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cert_store.cc
===================================================================
--- chrome/browser/cert_store.cc (revision 2613)
+++ chrome/browser/cert_store.cc (working copy)
@@ -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() : 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 @@
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 @@
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.
« no previous file with comments | « chrome/browser/cert_store.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698