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

Unified Diff: net/ssl/ssl_config_service.cc

Issue 547603002: Certificate Transparency: Code for unpacking EV cert hashes whitelist (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing unnecessary const Created 6 years, 2 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 | « net/ssl/ssl_config_service.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/ssl_config_service.cc
diff --git a/net/ssl/ssl_config_service.cc b/net/ssl/ssl_config_service.cc
index 1cc6def7f44df29d8a5964b18773e29301771781..4661930dc51a66b6bd73e9955b1323ead940f709 100644
--- a/net/ssl/ssl_config_service.cc
+++ b/net/ssl/ssl_config_service.cc
@@ -14,27 +14,34 @@ SSLConfigService::SSLConfigService()
: observer_list_(ObserverList<Observer>::NOTIFY_EXISTING_ONLY) {
}
-// GlobalCRLSet holds a reference to the global CRLSet. It simply wraps a lock
-// around a scoped_refptr so that getting a reference doesn't race with
-// updating the CRLSet.
-class GlobalCRLSet {
+// GlobalSSLObject holds a reference to a global SSL object, such as the
+// CRLSet or the EVCertsWhitelist. It simply wraps a lock around a
+// scoped_refptr so that getting a reference doesn't race with
+// updating the global object.
+template <class T>
+class GlobalSSLObject {
public:
- void Set(const scoped_refptr<CRLSet>& new_crl_set) {
+ void Set(const scoped_refptr<T>& new_ssl_object) {
base::AutoLock locked(lock_);
- crl_set_ = new_crl_set;
+ ssl_object_ = new_ssl_object;
}
- scoped_refptr<CRLSet> Get() const {
+ scoped_refptr<T> Get() const {
base::AutoLock locked(lock_);
- return crl_set_;
+ return ssl_object_;
}
private:
- scoped_refptr<CRLSet> crl_set_;
+ scoped_refptr<T> ssl_object_;
mutable base::Lock lock_;
};
+typedef GlobalSSLObject<CRLSet> GlobalCRLSet;
+typedef GlobalSSLObject<ct::EVCertsWhitelist> GlobalEVCertsWhitelist;
+
base::LazyInstance<GlobalCRLSet>::Leaky g_crl_set = LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<GlobalEVCertsWhitelist>::Leaky g_ev_whitelist =
+ LAZY_INSTANCE_INITIALIZER;
// static
void SSLConfigService::SetCRLSet(scoped_refptr<CRLSet> crl_set) {
@@ -47,6 +54,17 @@ scoped_refptr<CRLSet> SSLConfigService::GetCRLSet() {
return g_crl_set.Get().Get();
}
+// static
+void SSLConfigService::SetEVCertsWhitelist(
+ scoped_refptr<ct::EVCertsWhitelist> ev_whitelist) {
+ g_ev_whitelist.Get().Set(ev_whitelist);
+}
+
+// static
+scoped_refptr<ct::EVCertsWhitelist> SSLConfigService::GetEVCertsWhitelist() {
+ return g_ev_whitelist.Get().Get();
+}
+
void SSLConfigService::AddObserver(Observer* observer) {
observer_list_.AddObserver(observer);
}
« no previous file with comments | « net/ssl/ssl_config_service.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698