| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/cert/x509_certificate.h" | 5 #include "net/cert/x509_certificate.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // to Remove(). When it equals 0, all references created by | 95 // to Remove(). When it equals 0, all references created by |
| 96 // InsertOrUpdate() have been released, so the cache entry will be removed | 96 // InsertOrUpdate() have been released, so the cache entry will be removed |
| 97 // the cached OS certificate handle will be freed. | 97 // the cached OS certificate handle will be freed. |
| 98 int ref_count; | 98 int ref_count; |
| 99 }; | 99 }; |
| 100 typedef std::map<SHA256HashValue, Entry, SHA256HashValueLessThan> CertMap; | 100 typedef std::map<SHA256HashValue, Entry, SHA256HashValueLessThan> CertMap; |
| 101 | 101 |
| 102 // Obtain an instance of X509CertificateCache via a LazyInstance. | 102 // Obtain an instance of X509CertificateCache via a LazyInstance. |
| 103 X509CertificateCache() {} | 103 X509CertificateCache() {} |
| 104 ~X509CertificateCache() {} | 104 ~X509CertificateCache() {} |
| 105 friend struct base::DefaultLazyInstanceTraits<X509CertificateCache>; | 105 friend struct base::LazyInstanceTraitsBase<X509CertificateCache>; |
| 106 | 106 |
| 107 // You must acquire this lock before using any private data of this object | 107 // You must acquire this lock before using any private data of this object |
| 108 // You must not block while holding this lock. | 108 // You must not block while holding this lock. |
| 109 base::Lock lock_; | 109 base::Lock lock_; |
| 110 | 110 |
| 111 // The certificate cache. You must acquire |lock_| before using |cache_|. | 111 // The certificate cache. You must acquire |lock_| before using |cache_|. |
| 112 CertMap cache_; | 112 CertMap cache_; |
| 113 | 113 |
| 114 DISALLOW_COPY_AND_ASSIGN(X509CertificateCache); | 114 DISALLOW_COPY_AND_ASSIGN(X509CertificateCache); |
| 115 }; | 115 }; |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 RemoveFromCache(cert_handle_); | 719 RemoveFromCache(cert_handle_); |
| 720 FreeOSCertHandle(cert_handle_); | 720 FreeOSCertHandle(cert_handle_); |
| 721 } | 721 } |
| 722 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { | 722 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { |
| 723 RemoveFromCache(intermediate_ca_certs_[i]); | 723 RemoveFromCache(intermediate_ca_certs_[i]); |
| 724 FreeOSCertHandle(intermediate_ca_certs_[i]); | 724 FreeOSCertHandle(intermediate_ca_certs_[i]); |
| 725 } | 725 } |
| 726 } | 726 } |
| 727 | 727 |
| 728 } // namespace net | 728 } // namespace net |
| OLD | NEW |