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