OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 IOS_WEB_NET_CERT_STORE_IMPL_H_ | 5 #ifndef IOS_WEB_NET_CERT_STORE_IMPL_H_ |
6 #define IOS_WEB_NET_CERT_STORE_IMPL_H_ | 6 #define IOS_WEB_NET_CERT_STORE_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "ios/web/net/request_tracker_data_memoizing_store.h" | 10 #include "ios/web/net/request_tracker_data_memoizing_store.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 scoped_refptr<net::X509Certificate>* cert) override; | 24 scoped_refptr<net::X509Certificate>* cert) override; |
25 void RemoveCertsForGroup(int group_id) override; | 25 void RemoveCertsForGroup(int group_id) override; |
26 | 26 |
27 protected: | 27 protected: |
28 CertStoreImpl(); | 28 CertStoreImpl(); |
29 ~CertStoreImpl() override; | 29 ~CertStoreImpl() override; |
30 | 30 |
31 private: | 31 private: |
32 friend struct base::DefaultSingletonTraits<CertStoreImpl>; | 32 friend struct base::DefaultSingletonTraits<CertStoreImpl>; |
33 | 33 |
34 RequestTrackerDataMemoizingStore<net::X509Certificate> store_; | 34 // Utility structure that allows memoization to be based on the |
| 35 // hash of |cert|'s certificate chain, to avoid needing to compare |
| 36 // every certificate individually. This is purely an optimization. |
| 37 class HashAndCert : public base::RefCountedThreadSafe<HashAndCert> { |
| 38 public: |
| 39 HashAndCert(); |
| 40 |
| 41 // Comparator for RendererDataMemoizingStore. |
| 42 struct LessThan { |
| 43 bool operator()(const scoped_refptr<HashAndCert>& lhs, |
| 44 const scoped_refptr<HashAndCert>& rhs) const; |
| 45 }; |
| 46 |
| 47 net::SHA256HashValue chain_hash; |
| 48 scoped_refptr<net::X509Certificate> cert; |
| 49 |
| 50 private: |
| 51 friend class base::RefCountedThreadSafe<HashAndCert>; |
| 52 |
| 53 ~HashAndCert(); |
| 54 }; |
| 55 RequestTrackerDataMemoizingStore<HashAndCert> store_; |
35 | 56 |
36 DISALLOW_COPY_AND_ASSIGN(CertStoreImpl); | 57 DISALLOW_COPY_AND_ASSIGN(CertStoreImpl); |
37 }; | 58 }; |
38 | 59 |
39 } // namespace web | 60 } // namespace web |
40 | 61 |
41 #endif // IOS_WEB_NET_CERT_STORE_IMPL_H_ | 62 #endif // IOS_WEB_NET_CERT_STORE_IMPL_H_ |
OLD | NEW |