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

Unified Diff: net/cert/nss_cert_database.cc

Issue 111273002: NSSCertDatabaseChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review changes Created 7 years 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/cert/nss_cert_database.h ('k') | net/cert/nss_cert_database_chromeos.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/nss_cert_database.cc
diff --git a/net/cert/nss_cert_database.cc b/net/cert/nss_cert_database.cc
index d4ece1057454ff70ddb6c27896b9dda6e5513a02..935b271bd47b479aa46338de540737efe2ba33af 100644
--- a/net/cert/nss_cert_database.cc
+++ b/net/cert/nss_cert_database.cc
@@ -10,9 +10,9 @@
#include <pk11pub.h>
#include <secmod.h>
+#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
-#include "base/memory/singleton.h"
#include "base/observer_list_threadsafe.h"
#include "crypto/nss_util.h"
#include "crypto/nss_util_internal.h"
@@ -35,6 +35,14 @@ namespace psm = mozilla_security_manager;
namespace net {
+namespace {
+
+base::LazyInstance<NSSCertDatabase>::Leaky
+ g_nss_cert_database = LAZY_INSTANCE_INITIALIZER;
+
+} // namespace
+
+
NSSCertDatabase::ImportCertFailure::ImportCertFailure(
const scoped_refptr<X509Certificate>& cert,
int err)
@@ -44,13 +52,20 @@ NSSCertDatabase::ImportCertFailure::~ImportCertFailure() {}
// static
NSSCertDatabase* NSSCertDatabase::GetInstance() {
- return Singleton<NSSCertDatabase,
- LeakySingletonTraits<NSSCertDatabase> >::get();
+ // TODO(mattm): Remove this ifdef guard once the linux impl of
+ // GetNSSCertDatabaseForResourceContext does not call GetInstance.
+#if defined(OS_CHROMEOS)
+ LOG(ERROR) << "NSSCertDatabase::GetInstance() is deprecated."
+ << "See http://crbug.com/329735.";
+#endif
+ return &g_nss_cert_database.Get();
}
NSSCertDatabase::NSSCertDatabase()
: observer_list_(new ObserverListThreadSafe<Observer>) {
- crypto::EnsureNSSInit();
+ // This also makes sure that NSS has been initialized.
+ CertDatabase::GetInstance()->ObserveNSSCertDatabase(this);
+
psm::EnsurePKCS12Init();
}
@@ -117,6 +132,9 @@ int NSSCertDatabase::ImportFromPKCS12(
const base::string16& password,
bool is_extractable,
net::CertificateList* imported_certs) {
+ DVLOG(1) << __func__ << " "
+ << PK11_GetModuleID(module->os_module_handle()) << ":"
+ << PK11_GetSlotID(module->os_module_handle());
int result = psm::nsPKCS12Blob_Import(module->os_module_handle(),
data.data(), data.size(),
password,
@@ -154,7 +172,7 @@ X509Certificate* NSSCertDatabase::FindRootInList(
&certn_1->os_cert_handle()->subject) == SECEqual)
return certn_1;
- VLOG(1) << "certificate list is not a hierarchy";
+ LOG(WARNING) << "certificate list is not a hierarchy";
return cert0;
}
« no previous file with comments | « net/cert/nss_cert_database.h ('k') | net/cert/nss_cert_database_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698