Commit 079c01be authored by kylechar's avatar kylechar Committed by Commit Bot

Fix scoped_refptr construction from NULL

This is a precursor to adding a new scoped_refptr(std::nullptr_t)
constructor. The implicit conversion from NULL to scoped_refptr<T>
causes a compilation error with the new constructor. Replace NULL with
nullptr in any files where this is a problem.

This CL was uploaded by git cl split.

R=garykac@chromium.org

Bug: 1018887
Change-Id: I4b920ec60b5a24237396d7cf14a47c8fcac7d786
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1884954
Auto-Submit: kylechar <kylechar@chromium.org>
Reviewed-by: default avatarGary Kacmarcik <garykac@chromium.org>
Commit-Queue: Gary Kacmarcik <garykac@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710054}
parent cafe822d
...@@ -101,25 +101,25 @@ scoped_refptr<AutoThreadTaskRunner> AutoThread::CreateWithLoopAndComInitTypes( ...@@ -101,25 +101,25 @@ scoped_refptr<AutoThreadTaskRunner> AutoThread::CreateWithLoopAndComInitTypes(
#endif #endif
AutoThread::AutoThread(const char* name) AutoThread::AutoThread(const char* name)
: startup_data_(NULL), : startup_data_(nullptr),
#if defined(OS_WIN) #if defined(OS_WIN)
com_init_type_(COM_INIT_NONE), com_init_type_(COM_INIT_NONE),
#endif #endif
thread_(), thread_(),
name_(name), name_(name),
was_quit_properly_(false) { was_quit_properly_(false) {
thread_checker_.DetachFromThread(); thread_checker_.DetachFromThread();
} }
AutoThread::AutoThread(const char* name, AutoThreadTaskRunner* joiner) AutoThread::AutoThread(const char* name, AutoThreadTaskRunner* joiner)
: startup_data_(NULL), : startup_data_(nullptr),
#if defined(OS_WIN) #if defined(OS_WIN)
com_init_type_(COM_INIT_NONE), com_init_type_(COM_INIT_NONE),
#endif #endif
thread_(), thread_(),
name_(name), name_(name),
was_quit_properly_(false), was_quit_properly_(false),
joiner_(joiner) { joiner_(joiner) {
thread_checker_.DetachFromThread(); thread_checker_.DetachFromThread();
} }
...@@ -146,8 +146,8 @@ scoped_refptr<AutoThreadTaskRunner> AutoThread::StartWithType( ...@@ -146,8 +146,8 @@ scoped_refptr<AutoThreadTaskRunner> AutoThread::StartWithType(
if (!base::PlatformThread::Create(0, this, &thread_)) { if (!base::PlatformThread::Create(0, this, &thread_)) {
DLOG(ERROR) << "failed to create thread"; DLOG(ERROR) << "failed to create thread";
startup_data_ = NULL; startup_data_ = nullptr;
return NULL; return nullptr;
} }
// Wait for the thread to start and initialize single_thread_task_executor // Wait for the thread to start and initialize single_thread_task_executor
...@@ -159,8 +159,8 @@ scoped_refptr<AutoThreadTaskRunner> AutoThread::StartWithType( ...@@ -159,8 +159,8 @@ scoped_refptr<AutoThreadTaskRunner> AutoThread::StartWithType(
base::ScopedAllowBaseSyncPrimitivesOutsideBlockingScope allow_wait; base::ScopedAllowBaseSyncPrimitivesOutsideBlockingScope allow_wait;
startup_data.event.Wait(); startup_data.event.Wait();
// set it to NULL so we don't keep a pointer to some object on the stack. // set it to null so we don't keep a pointer to some object on the stack.
startup_data_ = NULL; startup_data_ = nullptr;
DCHECK(startup_data.task_runner.get()); DCHECK(startup_data.task_runner.get());
return startup_data.task_runner; return startup_data.task_runner;
......
...@@ -34,7 +34,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::Generate() { ...@@ -34,7 +34,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::Generate() {
crypto::RSAPrivateKey::Create(2048)); crypto::RSAPrivateKey::Create(2048));
if (!key) { if (!key) {
LOG(ERROR) << "Cannot generate private key."; LOG(ERROR) << "Cannot generate private key.";
return NULL; return nullptr;
} }
return new RsaKeyPair(std::move(key)); return new RsaKeyPair(std::move(key));
} }
...@@ -45,7 +45,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::FromString( ...@@ -45,7 +45,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::FromString(
std::string key_str; std::string key_str;
if (!base::Base64Decode(key_base64, &key_str)) { if (!base::Base64Decode(key_base64, &key_str)) {
LOG(ERROR) << "Failed to decode private key."; LOG(ERROR) << "Failed to decode private key.";
return NULL; return nullptr;
} }
std::vector<uint8_t> key_buf(key_str.begin(), key_str.end()); std::vector<uint8_t> key_buf(key_str.begin(), key_str.end());
...@@ -53,7 +53,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::FromString( ...@@ -53,7 +53,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::FromString(
crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_buf)); crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_buf));
if (!key) { if (!key) {
LOG(ERROR) << "Invalid private key."; LOG(ERROR) << "Invalid private key.";
return NULL; return nullptr;
} }
return new RsaKeyPair(std::move(key)); return new RsaKeyPair(std::move(key));
...@@ -61,7 +61,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::FromString( ...@@ -61,7 +61,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::FromString(
std::string RsaKeyPair::ToString() const { std::string RsaKeyPair::ToString() const {
// Check that the key initialized. // Check that the key initialized.
DCHECK(key_.get() != NULL); DCHECK(key_.get() != nullptr);
std::vector<uint8_t> key_buf; std::vector<uint8_t> key_buf;
CHECK(key_->ExportPrivateKey(&key_buf)); CHECK(key_->ExportPrivateKey(&key_buf));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment