| 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 29 matching lines...) Expand all Loading... |
| 40 // a reference to the certificate need to use X509Certificate::DupOSCertHandle | 40 // a reference to the certificate need to use X509Certificate::DupOSCertHandle |
| 41 // inside |cb|. | 41 // inside |cb|. |
| 42 void Get(const std::string& key, const GetCallback& cb); | 42 void Get(const std::string& key, const GetCallback& cb); |
| 43 | 43 |
| 44 // Stores |cert_handle| in the cache. If |cert_handle| is successfully stored, | 44 // Stores |cert_handle| in the cache. If |cert_handle| is successfully stored, |
| 45 // |cb| will be called with the key. If |cb| is called with an empty | 45 // |cb| will be called with the key. If |cb| is called with an empty |
| 46 // string, then |cert_handle| was not stored. | 46 // string, then |cert_handle| was not stored. |
| 47 void Set(const X509Certificate::OSCertHandle cert_handle, | 47 void Set(const X509Certificate::OSCertHandle cert_handle, |
| 48 const SetCallback& cb); | 48 const SetCallback& cb); |
| 49 | 49 |
| 50 // Returns the number of in-memory MRU cache hits that have occured | 50 // Returns the number of in-memory MRU cache hits that have occurred |
| 51 // on Set and Get operations. Intended for test purposes only. | 51 // on Set and Get operations. Intended for test purposes only. |
| 52 size_t mem_cache_hits_for_testing() const { return mem_cache_hits_; } | 52 size_t mem_cache_hits_for_testing() const { return mem_cache_hits_; } |
| 53 | 53 |
| 54 // Returns the number of in-memory MRU cache misses that have occured | 54 // Returns the number of in-memory MRU cache misses that have occurred |
| 55 // on Set and Get operations. Intended for test purposes only. | 55 // on Set and Get operations. Intended for test purposes only. |
| 56 size_t mem_cache_misses_for_testing() const { return mem_cache_misses_; } | 56 size_t mem_cache_misses_for_testing() const { return mem_cache_misses_; } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 class ReadWorker; | 59 class ReadWorker; |
| 60 class WriteWorker; | 60 class WriteWorker; |
| 61 | 61 |
| 62 // A functor used to free an OSCertHandle. Used by the MRUCertCache. | 62 // A functor used to free an OSCertHandle. Used by the MRUCertCache. |
| 63 struct CertFree { | 63 struct CertFree { |
| 64 void operator()(X509Certificate::OSCertHandle cert_handle); | 64 void operator()(X509Certificate::OSCertHandle cert_handle); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 92 int mem_cache_hits_; | 92 int mem_cache_hits_; |
| 93 int mem_cache_misses_; | 93 int mem_cache_misses_; |
| 94 | 94 |
| 95 base::WeakPtrFactory<DiskBasedCertCache> weak_factory_; | 95 base::WeakPtrFactory<DiskBasedCertCache> weak_factory_; |
| 96 DISALLOW_COPY_AND_ASSIGN(DiskBasedCertCache); | 96 DISALLOW_COPY_AND_ASSIGN(DiskBasedCertCache); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 } // namespace net | 99 } // namespace net |
| 100 | 100 |
| 101 #endif // NET_HTTP_DISK_BASED_CERT_CACHE_H | 101 #endif // NET_HTTP_DISK_BASED_CERT_CACHE_H |
| OLD | NEW |