Commit ed961176 authored by ckehoe's avatar ckehoe Committed by Commit bot

Replacing NULL with nullptr

Review URL: https://codereview.chromium.org/691223002

Cr-Commit-Position: refs/heads/master@{#302206}
parent 18739e39
...@@ -72,7 +72,7 @@ scoped_ptr<AudioDirective> AudioDirectiveList::GetActiveDirective() { ...@@ -72,7 +72,7 @@ scoped_ptr<AudioDirective> AudioDirectiveList::GetActiveDirective() {
} }
if (active_directives_.empty()) if (active_directives_.empty())
return make_scoped_ptr<AudioDirective>(NULL); return scoped_ptr<AudioDirective>().Pass();
return make_scoped_ptr(new AudioDirective(active_directives_.front())); return make_scoped_ptr(new AudioDirective(active_directives_.front()));
} }
......
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gmock/include/gmock/gmock.h"
using testing::IsNull;
namespace copresence { namespace copresence {
...@@ -25,7 +27,7 @@ class AudioDirectiveListTest : public testing::Test { ...@@ -25,7 +27,7 @@ class AudioDirectiveListTest : public testing::Test {
TEST_F(AudioDirectiveListTest, Basic) { TEST_F(AudioDirectiveListTest, Basic) {
const base::TimeDelta kTtl = base::TimeDelta::FromSeconds(9999); const base::TimeDelta kTtl = base::TimeDelta::FromSeconds(9999);
EXPECT_EQ(NULL, directive_list_->GetActiveDirective().get()); EXPECT_THAT(directive_list_->GetActiveDirective(), IsNull());
directive_list_->AddDirective("op_id1", kTtl); directive_list_->AddDirective("op_id1", kTtl);
directive_list_->AddDirective("op_id2", kTtl * 3); directive_list_->AddDirective("op_id2", kTtl * 3);
...@@ -53,7 +55,7 @@ TEST_F(AudioDirectiveListTest, AddDirectiveMultiple) { ...@@ -53,7 +55,7 @@ TEST_F(AudioDirectiveListTest, AddDirectiveMultiple) {
directive_list_->RemoveDirective("op_id2"); directive_list_->RemoveDirective("op_id2");
EXPECT_EQ("op_id1", directive_list_->GetActiveDirective()->op_id); EXPECT_EQ("op_id1", directive_list_->GetActiveDirective()->op_id);
directive_list_->RemoveDirective("op_id1"); directive_list_->RemoveDirective("op_id1");
EXPECT_EQ(NULL, directive_list_->GetActiveDirective().get()); EXPECT_THAT(directive_list_->GetActiveDirective(), IsNull());
} }
TEST_F(AudioDirectiveListTest, RemoveDirectiveMultiple) { TEST_F(AudioDirectiveListTest, RemoveDirectiveMultiple) {
...@@ -74,7 +76,7 @@ TEST_F(AudioDirectiveListTest, RemoveDirectiveMultiple) { ...@@ -74,7 +76,7 @@ TEST_F(AudioDirectiveListTest, RemoveDirectiveMultiple) {
directive_list_->RemoveDirective("op_id2"); directive_list_->RemoveDirective("op_id2");
EXPECT_EQ("op_id1", directive_list_->GetActiveDirective()->op_id); EXPECT_EQ("op_id1", directive_list_->GetActiveDirective()->op_id);
directive_list_->RemoveDirective("op_id1"); directive_list_->RemoveDirective("op_id1");
EXPECT_EQ(NULL, directive_list_->GetActiveDirective().get()); EXPECT_THAT(directive_list_->GetActiveDirective(), IsNull());
} }
} // namespace copresence } // namespace copresence
...@@ -40,15 +40,15 @@ const int kMaxSamples = 10000; ...@@ -40,15 +40,15 @@ const int kMaxSamples = 10000;
// Public methods. // Public methods.
AudioManagerImpl::AudioManagerImpl() : recorder_(NULL) { AudioManagerImpl::AudioManagerImpl() : recorder_(nullptr) {
// TODO(rkc): Move all of these into initializer lists once it is allowed. // TODO(rkc): Move all of these into initializer lists once it is allowed.
playing_[AUDIBLE] = false; playing_[AUDIBLE] = false;
playing_[INAUDIBLE] = false; playing_[INAUDIBLE] = false;
recording_[AUDIBLE] = false; recording_[AUDIBLE] = false;
recording_[INAUDIBLE] = false; recording_[INAUDIBLE] = false;
player_[AUDIBLE] = NULL; player_[AUDIBLE] = nullptr;
player_[INAUDIBLE] = NULL; player_[INAUDIBLE] = nullptr;
} }
void AudioManagerImpl::Initialize(const DecodeSamplesCallback& decode_cb, void AudioManagerImpl::Initialize(const DecodeSamplesCallback& decode_cb,
......
...@@ -29,7 +29,7 @@ namespace copresence { ...@@ -29,7 +29,7 @@ namespace copresence {
// Public methods. // Public methods.
AudioPlayerImpl::AudioPlayerImpl() AudioPlayerImpl::AudioPlayerImpl()
: is_playing_(false), stream_(NULL), frame_index_(0) { : is_playing_(false), stream_(nullptr), frame_index_(0) {
} }
AudioPlayerImpl::~AudioPlayerImpl() { AudioPlayerImpl::~AudioPlayerImpl() {
...@@ -87,7 +87,7 @@ void AudioPlayerImpl::InitializeOnAudioThread() { ...@@ -87,7 +87,7 @@ void AudioPlayerImpl::InitializeOnAudioThread() {
LOG(ERROR) << "Failed to open an output stream."; LOG(ERROR) << "Failed to open an output stream.";
if (stream_) { if (stream_) {
stream_->Close(); stream_->Close();
stream_ = NULL; stream_ = nullptr;
} }
return; return;
} }
...@@ -131,7 +131,7 @@ void AudioPlayerImpl::StopAndCloseOnAudioThread() { ...@@ -131,7 +131,7 @@ void AudioPlayerImpl::StopAndCloseOnAudioThread() {
if (is_playing_) if (is_playing_)
stream_->Stop(); stream_->Stop();
stream_->Close(); stream_->Close();
stream_ = NULL; stream_ = nullptr;
is_playing_ = false; is_playing_ = false;
} }
......
...@@ -26,7 +26,7 @@ class TestAudioOutputStream : public media::AudioOutputStream { ...@@ -26,7 +26,7 @@ class TestAudioOutputStream : public media::AudioOutputStream {
: default_frame_count_(default_frame_count), : default_frame_count_(default_frame_count),
max_frame_count_(max_frame_count), max_frame_count_(max_frame_count),
gather_callback_(gather_callback), gather_callback_(gather_callback),
callback_(NULL) { callback_(nullptr) {
caller_loop_ = base::MessageLoop::current(); caller_loop_ = base::MessageLoop::current();
} }
...@@ -73,7 +73,7 @@ namespace copresence { ...@@ -73,7 +73,7 @@ namespace copresence {
class AudioPlayerTest : public testing::Test, class AudioPlayerTest : public testing::Test,
public base::SupportsWeakPtr<AudioPlayerTest> { public base::SupportsWeakPtr<AudioPlayerTest> {
public: public:
AudioPlayerTest() : buffer_index_(0), player_(NULL) { AudioPlayerTest() : buffer_index_(0), player_(nullptr) {
if (!media::AudioManager::Get()) if (!media::AudioManager::Get())
media::AudioManager::CreateForTesting(); media::AudioManager::CreateForTesting();
} }
...@@ -94,7 +94,7 @@ class AudioPlayerTest : public testing::Test, ...@@ -94,7 +94,7 @@ class AudioPlayerTest : public testing::Test,
if (!player_) if (!player_)
return; return;
player_->Finalize(); player_->Finalize();
player_ = NULL; player_ = nullptr;
} }
void PlayAndVerifySamples( void PlayAndVerifySamples(
......
...@@ -53,8 +53,8 @@ void ProcessSamples( ...@@ -53,8 +53,8 @@ void ProcessSamples(
AudioRecorderImpl::AudioRecorderImpl() AudioRecorderImpl::AudioRecorderImpl()
: is_recording_(false), : is_recording_(false),
stream_(NULL), stream_(nullptr),
temp_conversion_buffer_(NULL), temp_conversion_buffer_(nullptr),
total_buffer_frames_(0), total_buffer_frames_(0),
buffer_frame_index_(0) { buffer_frame_index_(0) {
} }
...@@ -132,7 +132,7 @@ void AudioRecorderImpl::InitializeOnAudioThread() { ...@@ -132,7 +132,7 @@ void AudioRecorderImpl::InitializeOnAudioThread() {
LOG(ERROR) << "Failed to open an input stream."; LOG(ERROR) << "Failed to open an input stream.";
if (stream_) { if (stream_) {
stream_->Close(); stream_->Close();
stream_ = NULL; stream_ = nullptr;
} }
return; return;
} }
...@@ -165,7 +165,7 @@ void AudioRecorderImpl::StopAndCloseOnAudioThread() { ...@@ -165,7 +165,7 @@ void AudioRecorderImpl::StopAndCloseOnAudioThread() {
StopOnAudioThread(); StopOnAudioThread();
stream_->Close(); stream_->Close();
stream_ = NULL; stream_ = nullptr;
} }
void AudioRecorderImpl::FinalizeOnAudioThread() { void AudioRecorderImpl::FinalizeOnAudioThread() {
...@@ -234,7 +234,7 @@ double AudioRecorderImpl::ProvideInput(media::AudioBus* dest, ...@@ -234,7 +234,7 @@ double AudioRecorderImpl::ProvideInput(media::AudioBus* dest,
DCHECK(temp_conversion_buffer_); DCHECK(temp_conversion_buffer_);
DCHECK_LE(temp_conversion_buffer_->frames(), dest->frames()); DCHECK_LE(temp_conversion_buffer_->frames(), dest->frames());
temp_conversion_buffer_->CopyTo(dest); temp_conversion_buffer_->CopyTo(dest);
temp_conversion_buffer_ = NULL; temp_conversion_buffer_ = nullptr;
return 1.0; return 1.0;
} }
......
...@@ -23,7 +23,7 @@ class TestAudioInputStream : public media::AudioInputStream { ...@@ -23,7 +23,7 @@ class TestAudioInputStream : public media::AudioInputStream {
TestAudioInputStream(const media::AudioParameters& params, TestAudioInputStream(const media::AudioParameters& params,
const std::vector<float*> channel_data, const std::vector<float*> channel_data,
size_t samples) size_t samples)
: callback_(NULL), params_(params) { : callback_(nullptr), params_(params) {
buffer_ = media::AudioBus::CreateWrapper(2); buffer_ = media::AudioBus::CreateWrapper(2);
for (size_t i = 0; i < channel_data.size(); ++i) for (size_t i = 0; i < channel_data.size(); ++i)
buffer_->SetChannelData(i, channel_data[i]); buffer_->SetChannelData(i, channel_data[i]);
...@@ -73,7 +73,7 @@ namespace copresence { ...@@ -73,7 +73,7 @@ namespace copresence {
class AudioRecorderTest : public testing::Test { class AudioRecorderTest : public testing::Test {
public: public:
AudioRecorderTest() : total_samples_(0), recorder_(NULL) { AudioRecorderTest() : total_samples_(0), recorder_(nullptr) {
if (!media::AudioManager::Get()) if (!media::AudioManager::Get())
media::AudioManager::CreateForTesting(); media::AudioManager::CreateForTesting();
} }
...@@ -121,7 +121,7 @@ class AudioRecorderTest : public testing::Test { ...@@ -121,7 +121,7 @@ class AudioRecorderTest : public testing::Test {
if (!recorder_) if (!recorder_)
return; return;
recorder_->Finalize(); recorder_->Finalize();
recorder_ = NULL; recorder_ = nullptr;
} }
void RecordAndVerifySamples() { void RecordAndVerifySamples() {
......
...@@ -85,7 +85,7 @@ class RpcHandlerTest : public testing::Test, public CopresenceDelegate { ...@@ -85,7 +85,7 @@ class RpcHandlerTest : public testing::Test, public CopresenceDelegate {
} }
net::URLRequestContextGetter* GetRequestContext() const override { net::URLRequestContextGetter* GetRequestContext() const override {
return NULL; return nullptr;
} }
const std::string GetPlatformVersionString() const override { const std::string GetPlatformVersionString() const override {
...@@ -100,14 +100,14 @@ class RpcHandlerTest : public testing::Test, public CopresenceDelegate { ...@@ -100,14 +100,14 @@ class RpcHandlerTest : public testing::Test, public CopresenceDelegate {
return auth_token_; return auth_token_;
} }
WhispernetClient* GetWhispernetClient() override { return NULL; } WhispernetClient* GetWhispernetClient() override { return nullptr; }
protected: protected:
void InvokeReportResponseHandler(int status_code, void InvokeReportResponseHandler(int status_code,
const std::string& response) { const std::string& response) {
rpc_handler_.ReportResponseHandler( rpc_handler_.ReportResponseHandler(
base::Bind(&RpcHandlerTest::CaptureStatus, base::Unretained(this)), base::Bind(&RpcHandlerTest::CaptureStatus, base::Unretained(this)),
NULL, nullptr,
status_code, status_code,
response); response);
} }
......
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