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

Unified Diff: crypto/nss_util.cc

Issue 2477463002: Remove stl_util's deletion function use from crypto/. (Closed)
Patch Set: fix Created 4 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/nss_util.cc
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
index a41b4d640440febadca8059ad3e9b00861c93f22..f26bf0979a6ad2181d216fb2049a3255315fc419 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -42,9 +42,9 @@
#include "base/files/file_util.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/native_library.h"
#include "base/path_service.h"
-#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
@@ -493,7 +493,7 @@ class NSSInitSingleton {
"%s %s", kUserNSSDatabaseName, username_hash.c_str());
ScopedPK11Slot public_slot(OpenPersistentNSSDBForPath(db_name, path));
chromeos_user_map_[username_hash] =
- new ChromeOSUserData(std::move(public_slot));
+ base::MakeUnique<ChromeOSUserData>(std::move(public_slot));
return true;
}
@@ -600,9 +600,8 @@ class NSSInitSingleton {
void CloseChromeOSUserForTesting(const std::string& username_hash) {
DCHECK(thread_checker_.CalledOnValidThread());
- ChromeOSUserMap::iterator i = chromeos_user_map_.find(username_hash);
+ auto i = chromeos_user_map_.find(username_hash);
DCHECK(i != chromeos_user_map_.end());
- delete i->second;
chromeos_user_map_.erase(i);
}
@@ -752,7 +751,7 @@ class NSSInitSingleton {
// down.
~NSSInitSingleton() {
#if defined(OS_CHROMEOS)
- base::STLDeleteValues(&chromeos_user_map_);
+ chromeos_user_map_.clear();
#endif
tpm_slot_.reset();
if (root_) {
@@ -822,8 +821,7 @@ class NSSInitSingleton {
crypto::ScopedPK11Slot tpm_slot_;
SECMODModule* root_;
#if defined(OS_CHROMEOS)
- typedef std::map<std::string, ChromeOSUserData*> ChromeOSUserMap;
- ChromeOSUserMap chromeos_user_map_;
+ std::map<std::string, std::unique_ptr<ChromeOSUserData>> chromeos_user_map_;
ScopedPK11Slot test_system_slot_;
#endif
// TODO(davidben): When https://bugzilla.mozilla.org/show_bug.cgi?id=564011
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698