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/base/x509_certificate.h" | 5 #include "net/base/x509_certificate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // You must acquire this lock before using any private data of this object | 103 // You must acquire this lock before using any private data of this object |
104 // You must not block while holding this lock. | 104 // You must not block while holding this lock. |
105 base::Lock lock_; | 105 base::Lock lock_; |
106 | 106 |
107 // The certificate cache. You must acquire |lock_| before using |cache_|. | 107 // The certificate cache. You must acquire |lock_| before using |cache_|. |
108 CertMap cache_; | 108 CertMap cache_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(X509CertificateCache); | 110 DISALLOW_COPY_AND_ASSIGN(X509CertificateCache); |
111 }; | 111 }; |
112 | 112 |
113 base::LazyInstance<X509CertificateCache, | 113 base::LazyInstance<X509CertificateCache>::Leaky |
114 base::LeakyLazyInstanceTraits<X509CertificateCache> > | |
115 g_x509_certificate_cache = LAZY_INSTANCE_INITIALIZER; | 114 g_x509_certificate_cache = LAZY_INSTANCE_INITIALIZER; |
116 | 115 |
117 void X509CertificateCache::InsertOrUpdate( | 116 void X509CertificateCache::InsertOrUpdate( |
118 X509Certificate::OSCertHandle* cert_handle) { | 117 X509Certificate::OSCertHandle* cert_handle) { |
119 DCHECK(cert_handle); | 118 DCHECK(cert_handle); |
120 SHA1Fingerprint fingerprint = | 119 SHA1Fingerprint fingerprint = |
121 X509Certificate::CalculateFingerprint(*cert_handle); | 120 X509Certificate::CalculateFingerprint(*cert_handle); |
122 | 121 |
123 X509Certificate::OSCertHandle old_handle = NULL; | 122 X509Certificate::OSCertHandle old_handle = NULL; |
124 { | 123 { |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 bool X509Certificate::IsSHA1HashInSortedArray(const SHA1Fingerprint& hash, | 856 bool X509Certificate::IsSHA1HashInSortedArray(const SHA1Fingerprint& hash, |
858 const uint8* array, | 857 const uint8* array, |
859 size_t array_byte_len) { | 858 size_t array_byte_len) { |
860 DCHECK_EQ(0u, array_byte_len % base::kSHA1Length); | 859 DCHECK_EQ(0u, array_byte_len % base::kSHA1Length); |
861 const size_t arraylen = array_byte_len / base::kSHA1Length; | 860 const size_t arraylen = array_byte_len / base::kSHA1Length; |
862 return NULL != bsearch(hash.data, array, arraylen, base::kSHA1Length, | 861 return NULL != bsearch(hash.data, array, arraylen, base::kSHA1Length, |
863 CompareSHA1Hashes); | 862 CompareSHA1Hashes); |
864 } | 863 } |
865 | 864 |
866 } // namespace net | 865 } // namespace net |
OLD | NEW |