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

Side by Side Diff: net/base/x509_certificate.cc

Issue 9192024: Add a convenience typedef LazyInstance<T>::Leaky to avoid repeating T. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/test_root_certs.cc ('k') | net/ocsp/nss_ocsp.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/base/test_root_certs.cc ('k') | net/ocsp/nss_ocsp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698