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 |