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

Unified Diff: net/cert/nss_cert_database.cc

Issue 405973003: Remove the deprecated NSSCertDatabase::GetInstance() . (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
Index: net/cert/nss_cert_database.cc
diff --git a/net/cert/nss_cert_database.cc b/net/cert/nss_cert_database.cc
index 38e60c6cb4510ff9b71d6fbf8c833323acf380c4..67f0571883f4d6e038791562b95c71dd2dc0a6f2 100644
--- a/net/cert/nss_cert_database.cc
+++ b/net/cert/nss_cert_database.cc
@@ -12,15 +12,12 @@
#include "base/bind.h"
#include "base/callback.h"
-#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list_threadsafe.h"
#include "base/task_runner.h"
#include "base/task_runner_util.h"
#include "base/threading/worker_pool.h"
-#include "crypto/nss_util.h"
-#include "crypto/nss_util_internal.h"
#include "crypto/scoped_nss_types.h"
#include "net/base/crypto_module.h"
#include "net/base/net_errors.h"
@@ -42,6 +39,7 @@ namespace net {
namespace {
+// TODO(pneubeck): Move this class to chrome/browser/net/nss_context .
Ryan Sleevi 2014/07/22 08:31:58 TODO with a bug #? Feels gross mentioning //chrom
pneubeck (no reviews) 2014/07/22 09:51:50 Done.
// Helper that observes events from the NSSCertDatabase and forwards them to
// the given CertDatabase.
class CertNotificationForwarder : public NSSCertDatabase::Observer {
@@ -70,9 +68,6 @@ class CertNotificationForwarder : public NSSCertDatabase::Observer {
DISALLOW_COPY_AND_ASSIGN(CertNotificationForwarder);
};
-base::LazyInstance<NSSCertDatabase>::Leaky
- g_nss_cert_database = LAZY_INSTANCE_INITIALIZER;
-
} // namespace
NSSCertDatabase::ImportCertFailure::ImportCertFailure(
@@ -82,19 +77,9 @@ NSSCertDatabase::ImportCertFailure::ImportCertFailure(
NSSCertDatabase::ImportCertFailure::~ImportCertFailure() {}
-// static
-NSSCertDatabase* NSSCertDatabase::GetInstance() {
- // 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>),
+NSSCertDatabase::NSSCertDatabase(crypto::ScopedPK11Slot persistent_slot)
+ : persistent_slot_(persistent_slot.Pass()),
+ observer_list_(new ObserverListThreadSafe<Observer>),
weak_factory_(this) {
// This also makes sure that NSS has been initialized.
CertDatabase* cert_db = CertDatabase::GetInstance();
@@ -140,11 +125,13 @@ void NSSCertDatabase::ListCertsInSlot(const ListCertsCallback& callback,
}
crypto::ScopedPK11Slot NSSCertDatabase::GetPublicSlot() const {
- return crypto::ScopedPK11Slot(crypto::GetPersistentNSSKeySlot());
+ DCHECK(persistent_slot_);
+ return crypto::ScopedPK11Slot(PK11_ReferenceSlot(persistent_slot_.get()));
}
crypto::ScopedPK11Slot NSSCertDatabase::GetPrivateSlot() const {
- return crypto::ScopedPK11Slot(crypto::GetPersistentNSSKeySlot());
+ DCHECK(persistent_slot_);
+ return crypto::ScopedPK11Slot(PK11_ReferenceSlot(persistent_slot_.get()));
}
CryptoModule* NSSCertDatabase::GetPublicModule() const {

Powered by Google App Engine
This is Rietveld 408576698