OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/histogram.h" | 7 #include "base/histogram.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // Check if we already have this certificate in memory. | 132 // Check if we already have this certificate in memory. |
133 X509Certificate::Cache* cache = X509Certificate::Cache::GetInstance(); | 133 X509Certificate::Cache* cache = X509Certificate::Cache::GetInstance(); |
134 X509Certificate* cached_cert = | 134 X509Certificate* cached_cert = |
135 cache->Find(CalculateFingerprint(cert_handle)); | 135 cache->Find(CalculateFingerprint(cert_handle)); |
136 if (cached_cert) { | 136 if (cached_cert) { |
137 DCHECK(cached_cert->source_ != SOURCE_UNUSED); | 137 DCHECK(cached_cert->source_ != SOURCE_UNUSED); |
138 if (cached_cert->source_ >= source) { | 138 if (cached_cert->source_ >= source) { |
139 // We've found a certificate with the same fingerprint in our cache. We | 139 // We've found a certificate with the same fingerprint in our cache. We |
140 // own the |cert_handle|, which makes it our job to free it. | 140 // own the |cert_handle|, which makes it our job to free it. |
141 FreeOSCertHandle(cert_handle); | 141 FreeOSCertHandle(cert_handle); |
142 DHISTOGRAM_COUNTS(L"X509CertificateReuseCount", 1); | 142 DHISTOGRAM_COUNTS("X509CertificateReuseCount", 1); |
143 return cached_cert; | 143 return cached_cert; |
144 } | 144 } |
145 // Kick out the old certificate from our cache. The new one is better. | 145 // Kick out the old certificate from our cache. The new one is better. |
146 cache->Remove(cached_cert); | 146 cache->Remove(cached_cert); |
147 } | 147 } |
148 // Otherwise, allocate a new object. | 148 // Otherwise, allocate a new object. |
149 return new X509Certificate(cert_handle, source); | 149 return new X509Certificate(cert_handle, source); |
150 } | 150 } |
151 | 151 |
152 // static | 152 // static |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 #if defined(OS_LINUX) | 187 #if defined(OS_LINUX) |
188 // TODO(port): Implement properly on Linux. | 188 // TODO(port): Implement properly on Linux. |
189 bool X509Certificate::IsEV(int status) const { | 189 bool X509Certificate::IsEV(int status) const { |
190 NOTIMPLEMENTED(); | 190 NOTIMPLEMENTED(); |
191 return true; | 191 return true; |
192 } | 192 } |
193 #endif | 193 #endif |
194 | 194 |
195 } // namespace net | 195 } // namespace net |
196 | |
OLD | NEW |