| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 #ifndef NET_HTTP_DISK_BASED_CERT_CACHE_H | 5 #ifndef NET_HTTP_DISK_BASED_CERT_CACHE_H |
| 6 #define NET_HTTP_DISK_BASED_CERT_CACHE_H | 6 #define NET_HTTP_DISK_BASED_CERT_CACHE_H |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // on SetCertificate and GetCertificate operations. Intended for test purposes | 56 // on SetCertificate and GetCertificate operations. Intended for test purposes |
| 57 // only. | 57 // only. |
| 58 size_t mem_cache_misses_for_testing() const { return mem_cache_misses_; } | 58 size_t mem_cache_misses_for_testing() const { return mem_cache_misses_; } |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 class ReadWorker; | 61 class ReadWorker; |
| 62 class WriteWorker; | 62 class WriteWorker; |
| 63 | 63 |
| 64 // A functor used to free an OSCertHandle. Used by the MRUCertCache. | 64 // A functor used to free an OSCertHandle. Used by the MRUCertCache. |
| 65 struct CertFree { | 65 struct CertFree { |
| 66 void operator()(X509Certificate::OSCertHandle cert_handle); | 66 void operator()(X509Certificate::OSCertHandle* cert_handle); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 // An in-memory cache that is used to prevent redundantly reading | 69 // An in-memory cache that is used to prevent redundantly reading |
| 70 // from disk. | 70 // from disk. |
| 71 typedef base::MRUCacheBase<std::string, | 71 typedef base::MRUCacheBase<std::string, |
| 72 X509Certificate::OSCertHandle, | 72 X509Certificate::OSCertHandle, |
| 73 CertFree> MRUCertCache; | 73 CertFree> MRUCertCache; |
| 74 | 74 |
| 75 // ReadWorkerMap and WriteWorkerMap map cache keys to their | 75 // ReadWorkerMap and WriteWorkerMap map cache keys to their |
| 76 // corresponding Workers. | 76 // corresponding Workers. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 94 int mem_cache_hits_; | 94 int mem_cache_hits_; |
| 95 int mem_cache_misses_; | 95 int mem_cache_misses_; |
| 96 | 96 |
| 97 base::WeakPtrFactory<DiskBasedCertCache> weak_factory_; | 97 base::WeakPtrFactory<DiskBasedCertCache> weak_factory_; |
| 98 DISALLOW_COPY_AND_ASSIGN(DiskBasedCertCache); | 98 DISALLOW_COPY_AND_ASSIGN(DiskBasedCertCache); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 } // namespace net | 101 } // namespace net |
| 102 | 102 |
| 103 #endif // NET_HTTP_DISK_BASED_CERT_CACHE_H | 103 #endif // NET_HTTP_DISK_BASED_CERT_CACHE_H |
| OLD | NEW |