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

Unified Diff: crypto/nss_util.cc

Issue 1870233002: Convert crypto to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 8 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
« no previous file with comments | « crypto/nss_key_util.cc ('k') | crypto/rsa_private_key_nss.cc » ('j') | 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 5bd6436416c1aeebd461780b64987153c373d4a4..359f78fb87a89b172245fb6f127344547efb5dc0 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -11,6 +11,8 @@
#include <prinit.h>
#include <prtime.h>
#include <secmod.h>
+
+#include <memory>
#include <utility>
#include "crypto/nss_util_internal.h"
@@ -37,7 +39,6 @@
#include "base/files/file_util.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/native_library.h"
#include "base/path_service.h"
@@ -75,7 +76,7 @@ static const base::FilePath::CharType kReadOnlyCertDB[] =
std::string GetNSSErrorMessage() {
std::string result;
if (PR_GetErrorTextLength()) {
- scoped_ptr<char[]> error_text(new char[PR_GetErrorTextLength() + 1]);
+ std::unique_ptr<char[]> error_text(new char[PR_GetErrorTextLength() + 1]);
PRInt32 copied = PR_GetErrorText(error_text.get());
result = std::string(error_text.get(), copied);
} else {
@@ -167,7 +168,7 @@ void UseLocalCacheOfNSSDatabaseIfNFS(const base::FilePath& database_dir) {
#endif
if (db_on_nfs) {
- scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
static const char kUseCacheEnvVar[] = "NSS_SDB_USE_CACHE";
if (!env->HasVar(kUseCacheEnvVar))
env->SetVar(kUseCacheEnvVar, "yes");
@@ -372,7 +373,8 @@ class NSSInitSingleton {
// Note that a reference is not taken to chaps_module_. This is safe since
// NSSInitSingleton is Leaky, so the reference it holds is never released.
- scoped_ptr<TPMModuleAndSlot> tpm_args(new TPMModuleAndSlot(chaps_module_));
+ std::unique_ptr<TPMModuleAndSlot> tpm_args(
+ new TPMModuleAndSlot(chaps_module_));
TPMModuleAndSlot* tpm_args_ptr = tpm_args.get();
if (base::WorkerPool::PostTaskAndReply(
FROM_HERE,
@@ -418,7 +420,7 @@ class NSSInitSingleton {
void OnInitializedTPMTokenAndSystemSlot(
const base::Callback<void(bool)>& callback,
- scoped_ptr<TPMModuleAndSlot> tpm_args) {
+ std::unique_ptr<TPMModuleAndSlot> tpm_args) {
DCHECK(thread_checker_.CalledOnValidThread());
DVLOG(2) << "Loaded chaps: " << !!tpm_args->chaps_module
<< ", got tpm slot: " << !!tpm_args->tpm_slot;
@@ -534,7 +536,8 @@ class NSSInitSingleton {
// Note that a reference is not taken to chaps_module_. This is safe since
// NSSInitSingleton is Leaky, so the reference it holds is never released.
- scoped_ptr<TPMModuleAndSlot> tpm_args(new TPMModuleAndSlot(chaps_module_));
+ std::unique_ptr<TPMModuleAndSlot> tpm_args(
+ new TPMModuleAndSlot(chaps_module_));
TPMModuleAndSlot* tpm_args_ptr = tpm_args.get();
base::WorkerPool::PostTaskAndReply(
FROM_HERE,
@@ -549,8 +552,9 @@ class NSSInitSingleton {
);
}
- void OnInitializedTPMForChromeOSUser(const std::string& username_hash,
- scoped_ptr<TPMModuleAndSlot> tpm_args) {
+ void OnInitializedTPMForChromeOSUser(
+ const std::string& username_hash,
+ std::unique_ptr<TPMModuleAndSlot> tpm_args) {
DCHECK(thread_checker_.CalledOnValidThread());
DVLOG(2) << "Got tpm slot for " << username_hash << " "
<< !!tpm_args->tpm_slot;
« no previous file with comments | « crypto/nss_key_util.cc ('k') | crypto/rsa_private_key_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698