Index: crypto/nss_util.cc |
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc |
index a41b4d640440febadca8059ad3e9b00861c93f22..b1f3d180fa37274dec558fb5b1d5e62edb09e9f6 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); |
} |
@@ -751,9 +750,6 @@ class NSSInitSingleton { |
// prevent non-joinable threads from using NSS after it's already been shut |
// down. |
~NSSInitSingleton() { |
-#if defined(OS_CHROMEOS) |
- base::STLDeleteValues(&chromeos_user_map_); |
davidben
2016/11/03 02:13:48
rsleevi: Is there a requirement to clear chromeos_
Avi (use Gerrit)
2016/11/03 02:17:57
I can totally put
chromeos_user_map_.clear();
ba
davidben
2016/11/03 02:20:29
Yeah. I figure we may as well see if Ryan knows de
Ryan Sleevi
2016/11/03 03:06:41
We'll never hit this, and with the move to make Si
|
-#endif |
tpm_slot_.reset(); |
if (root_) { |
SECMOD_UnloadUserModule(root_); |
@@ -822,8 +818,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 |