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 #ifndef CHROME_BROWSER_CERT_STORE_H_ | 5 #ifndef CHROME_BROWSER_CERT_STORE_H_ |
6 #define CHROME_BROWSER_CERT_STORE_H_ | 6 #define CHROME_BROWSER_CERT_STORE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // NotificationObserver implementation. | 45 // NotificationObserver implementation. |
46 virtual void Observe(NotificationType type, | 46 virtual void Observe(NotificationType type, |
47 const NotificationSource& source, | 47 const NotificationSource& source, |
48 const NotificationDetails& details); | 48 const NotificationDetails& details); |
49 | 49 |
50 private: | 50 private: |
51 CertStore(); | 51 CertStore(); |
52 ~CertStore(); | 52 ~CertStore(); |
53 | 53 |
54 // Remove the specified cert from id_to_cert_ and cert_to_id_. | 54 // Remove the specified cert from id_to_cert_ and cert_to_id_. |
55 void RemoveCert(int cert_id); | 55 // NOTE: the caller (RemoveCertsForRenderProcesHost) must hold cert_lock_. |
| 56 void RemoveCertInternal(int cert_id); |
56 | 57 |
57 // Removes all the certs associated with the specified process from the store. | 58 // Removes all the certs associated with the specified process from the store. |
58 void RemoveCertsForRenderProcesHost(int render_process_host_id); | 59 void RemoveCertsForRenderProcesHost(int render_process_host_id); |
59 | 60 |
60 static CertStore* instance_; | 61 static CertStore* instance_; |
61 | 62 |
62 typedef std::multimap<int, int> IDMap; | 63 typedef std::multimap<int, int> IDMap; |
63 typedef std::map<int, scoped_refptr<net::X509Certificate>> CertMap; | 64 typedef std::map<int, scoped_refptr<net::X509Certificate>> CertMap; |
64 typedef std::map<net::X509Certificate*, int, net::X509Certificate::LessThan> | 65 typedef std::map<net::X509Certificate*, int, net::X509Certificate::LessThan> |
65 ReverseCertMap; | 66 ReverseCertMap; |
66 | 67 |
67 IDMap process_id_to_cert_id_; | 68 IDMap process_id_to_cert_id_; |
68 IDMap cert_id_to_process_id_; | 69 IDMap cert_id_to_process_id_; |
69 | 70 |
70 CertMap id_to_cert_; | 71 CertMap id_to_cert_; |
71 ReverseCertMap cert_to_id_; | 72 ReverseCertMap cert_to_id_; |
72 | 73 |
73 int next_cert_id_; | 74 int next_cert_id_; |
74 | 75 |
75 // This lock protects: process_to_ids_, id_to_processes_, id_to_cert_ and | 76 // This lock protects: process_to_ids_, id_to_processes_, id_to_cert_ and |
76 // cert_to_id_. | 77 // cert_to_id_. |
77 Lock cert_lock_; | 78 Lock cert_lock_; |
78 | 79 |
79 DISALLOW_EVIL_CONSTRUCTORS(CertStore); | 80 DISALLOW_EVIL_CONSTRUCTORS(CertStore); |
80 }; | 81 }; |
81 | 82 |
82 #endif // CHROME_BROWSER_CERT_STORE_H_ | 83 #endif // CHROME_BROWSER_CERT_STORE_H_ |
83 | 84 |
OLD | NEW |