Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(852)

Unified Diff: net/base/x509_certificate.h

Issue 4040: Refactoring out common code in the X.509 cert handling (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/x509_certificate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/x509_certificate.h
===================================================================
--- net/base/x509_certificate.h (revision 2483)
+++ net/base/x509_certificate.h (working copy)
@@ -5,10 +5,12 @@
#ifndef NET_BASE_X509_CERTIFICATE_H_
#define NET_BASE_X509_CERTIFICATE_H_
+#include <map>
#include <set>
#include <string>
#include <vector>
+#include "base/singleton.h"
wtc 2008/09/23 21:39:55 Nit: list "base/singleton.h" in alphabetical order
#include "base/ref_counted.h"
#include "base/time.h"
@@ -166,7 +168,30 @@
private:
// A cache of X509Certificate objects.
- class Cache;
+ class Cache {
+ public:
+ static Cache* GetInstance();
+ void Insert(X509Certificate* cert);
+ void Remove(X509Certificate* cert);
+ X509Certificate* Find(const Fingerprint& fingerprint);
+
+ private:
+ typedef std::map<Fingerprint, X509Certificate*, FingerprintLessThan>
+ CertMap;
+
+ // Obtain an instance of X509Certificate::Cache via GetInstance().
+ Cache() { }
+ friend struct DefaultSingletonTraits<Cache>;
+
+ // You must acquire this lock before using any private data of this object.
+ // You must not block while holding this lock.
+ Lock lock_;
+
+ // The certificate cache. You must acquire |lock_| before using |cache_|.
+ CertMap cache_;
+
+ DISALLOW_COPY_AND_ASSIGN(Cache);
+ };
// Construct an X509Certificate from a handle to the certificate object
// in the underlying crypto library.
@@ -178,13 +203,6 @@
// Common object initialization code. Called by the constructors only.
void Initialize();
-#if defined(OS_WIN)
- // Helper function to parse a principal from a WinInet description of that
- // principal.
- static void ParsePrincipal(const std::string& description,
- Principal* principal);
-#endif
-
// The subject of the certificate.
Principal subject_;
« no previous file with comments | « no previous file | net/base/x509_certificate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698