Commit 938dc44b 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=liberato@chromium.org

Bug: 1018887
Change-Id: I589a654b9f76a8e066533ea789fdd9c6f7bb3c14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1885079
Auto-Submit: kylechar <kylechar@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710337}
parent 6e72acaf
......@@ -138,7 +138,7 @@ void FakeDemuxerStream::Reset() {
read_to_hold_ = -1;
if (read_cb_)
std::move(read_cb_).Run(kAborted, NULL);
std::move(read_cb_).Run(kAborted, nullptr);
}
void FakeDemuxerStream::Error() {
......@@ -185,7 +185,7 @@ void FakeDemuxerStream::DoRead() {
// Config change.
num_buffers_left_in_current_config_ = num_buffers_in_one_config_;
UpdateVideoDecoderConfig();
std::move(read_cb_).Run(kConfigChanged, NULL);
std::move(read_cb_).Run(kConfigChanged, nullptr);
return;
}
......
......@@ -81,7 +81,7 @@ void FakeTextTrackStream::SatisfyPendingRead(
void FakeTextTrackStream::AbortPendingRead() {
DCHECK(read_cb_);
std::move(read_cb_).Run(kAborted, NULL);
std::move(read_cb_).Run(kAborted, nullptr);
}
void FakeTextTrackStream::SendEosNotification() {
......
......@@ -173,7 +173,7 @@ void TextRenderer::BufferReady(DemuxerStream* stream,
}
if (input->end_of_stream()) {
CueReady(stream, NULL);
CueReady(stream, nullptr);
return;
}
......
......@@ -12,7 +12,7 @@ namespace media {
SinkFilterObserver::~SinkFilterObserver() {
}
SinkFilter::SinkFilter(SinkFilterObserver* observer) : input_pin_(NULL) {
SinkFilter::SinkFilter(SinkFilterObserver* observer) {
input_pin_ = new SinkInputPin(this, observer);
}
......@@ -27,7 +27,7 @@ size_t SinkFilter::NoOfPins() {
}
IPin* SinkFilter::GetPin(int index) {
return index == 0 ? input_pin_.get() : NULL;
return index == 0 ? input_pin_.get() : nullptr;
}
STDMETHODIMP SinkFilter::GetClassID(CLSID* clsid) {
......@@ -36,7 +36,7 @@ STDMETHODIMP SinkFilter::GetClassID(CLSID* clsid) {
}
SinkFilter::~SinkFilter() {
input_pin_->SetOwner(NULL);
input_pin_->SetOwner(nullptr);
}
} // namespace media
......@@ -52,7 +52,7 @@ scoped_refptr<SingleThreadTaskRunner> CastEnvironment::GetTaskRunner(
return video_thread_proxy_;
default:
NOTREACHED() << "Invalid Thread identifier";
return NULL;
return nullptr;
}
}
......
......@@ -134,23 +134,21 @@ class VideoDecoder::Vp8Impl : public VideoDecoder::ImplBase {
}
scoped_refptr<VideoFrame> Decode(uint8_t* data, int len) final {
if (len <= 0 || vpx_codec_decode(&context_,
data,
static_cast<unsigned int>(len),
NULL,
0) != VPX_CODEC_OK) {
return NULL;
if (len <= 0 ||
vpx_codec_decode(&context_, data, static_cast<unsigned int>(len),
nullptr, 0) != VPX_CODEC_OK) {
return nullptr;
}
vpx_codec_iter_t iter = NULL;
vpx_codec_iter_t iter = nullptr;
vpx_image_t* const image = vpx_codec_get_frame(&context_, &iter);
if (!image)
return NULL;
return nullptr;
if (image->fmt != VPX_IMG_FMT_I420) {
NOTREACHED() << "Only pixel format supported is I420, got " << image->fmt;
return NULL;
return nullptr;
}
DCHECK(vpx_codec_get_frame(&context_, &iter) == NULL)
DCHECK(vpx_codec_get_frame(&context_, &iter) == nullptr)
<< "Should have only decoded exactly one frame.";
const gfx::Size frame_size(image->d_w, image->d_h);
......@@ -198,12 +196,12 @@ class VideoDecoder::FakeImpl : public VideoDecoder::ImplBase {
scoped_refptr<VideoFrame> Decode(uint8_t* data, int len) final {
// Make sure this is a JSON string.
if (!len || data[0] != '{')
return NULL;
return nullptr;
std::unique_ptr<base::Value> values(base::JSONReader::ReadDeprecated(
base::StringPiece(reinterpret_cast<char*>(data), len)));
if (!values)
return NULL;
base::DictionaryValue* dict = NULL;
return nullptr;
base::DictionaryValue* dict = nullptr;
values->GetAsDictionary(&dict);
bool key = false;
......@@ -259,7 +257,7 @@ void VideoDecoder::DecodeFrame(std::unique_ptr<EncodedFrame> encoded_frame,
DCHECK(encoded_frame.get());
DCHECK(!callback.is_null());
if (!impl_.get() || impl_->InitializationResult() != STATUS_INITIALIZED) {
callback.Run(base::WrapRefCounted<VideoFrame>(NULL), false);
callback.Run(base::WrapRefCounted<VideoFrame>(nullptr), false);
return;
}
cast_environment_->PostTask(CastEnvironment::VIDEO,
......
......@@ -13,7 +13,10 @@ namespace media {
namespace cast {
StandaloneCastEnvironment::StandaloneCastEnvironment()
: CastEnvironment(base::DefaultTickClock::GetInstance(), NULL, NULL, NULL),
: CastEnvironment(base::DefaultTickClock::GetInstance(),
nullptr,
nullptr,
nullptr),
main_thread_("StandaloneCastEnvironment Main"),
audio_thread_("StandaloneCastEnvironment Audio"),
video_thread_("StandaloneCastEnvironment Video") {
......
......@@ -83,7 +83,7 @@ void ChunkDemuxerStream::AbortReads() {
base::AutoLock auto_lock(lock_);
ChangeState_Locked(RETURNING_ABORT_FOR_READS);
if (read_cb_)
std::move(read_cb_).Run(kAborted, NULL);
std::move(read_cb_).Run(kAborted, nullptr);
}
void ChunkDemuxerStream::CompletePendingReadIfPossible() {
......@@ -415,7 +415,7 @@ void ChunkDemuxerStream::CompletePendingReadIfPossible_Locked() {
break;
case SourceBufferStreamStatus::kConfigChange:
status = kConfigChanged;
buffer = NULL;
buffer = nullptr;
DVLOG(2) << __func__ << ": returning kConfigChange, type " << type_;
break;
}
......@@ -425,7 +425,7 @@ void ChunkDemuxerStream::CompletePendingReadIfPossible_Locked() {
// for a seek. Any buffers in the SourceBuffer should NOT be returned
// because they are associated with the seek.
status = DemuxerStream::kAborted;
buffer = NULL;
buffer = nullptr;
DVLOG(2) << __func__ << ": returning kAborted, type " << type_;
break;
case SHUTDOWN:
......@@ -445,7 +445,7 @@ ChunkDemuxer::ChunkDemuxer(
MediaLog* media_log)
: state_(WAITING_FOR_INIT),
cancel_next_seek_(false),
host_(NULL),
host_(nullptr),
open_cb_(open_cb),
progress_cb_(progress_cb),
encrypted_media_init_data_cb_(encrypted_media_init_data_cb),
......
......@@ -64,7 +64,7 @@ class DecryptingAudioDecoderTest : public testing::Test {
num_decrypt_and_decode_calls_(0),
num_frames_in_decryptor_(0),
encrypted_buffer_(CreateFakeEncryptedBuffer()),
decoded_frame_(NULL),
decoded_frame_(nullptr),
decoded_frame_list_() {}
~DecryptingAudioDecoderTest() override { Destroy(); }
......
......@@ -249,13 +249,13 @@ class DecryptingDemuxerStreamTest : public testing::Test {
void AbortPendingDecryptCB() {
if (pending_decrypt_cb_) {
std::move(pending_decrypt_cb_).Run(Decryptor::kSuccess, NULL);
std::move(pending_decrypt_cb_).Run(Decryptor::kSuccess, nullptr);
}
}
void SatisfyPendingDemuxerReadCB(DemuxerStream::Status status) {
scoped_refptr<DecoderBuffer> buffer =
(status == DemuxerStream::kOk) ? encrypted_buffer_ : NULL;
(status == DemuxerStream::kOk) ? encrypted_buffer_ : nullptr;
std::move(pending_demuxer_read_cb_).Run(status, buffer);
}
......@@ -415,7 +415,7 @@ TEST_F(DecryptingDemuxerStreamTest, KeyAdded_DuringPendingDecrypt) {
EXPECT_CALL(*this, BufferReady(DemuxerStream::kOk, decrypted_buffer_));
// The decrypt callback is returned after the correct decryption key is added.
key_added_cb_.Run();
std::move(pending_decrypt_cb_).Run(Decryptor::kNoKey, NULL);
std::move(pending_decrypt_cb_).Run(Decryptor::kNoKey, nullptr);
base::RunLoop().RunUntilIdle();
}
......@@ -476,11 +476,11 @@ TEST_F(DecryptingDemuxerStreamTest, Reset_AfterReset) {
TEST_F(DecryptingDemuxerStreamTest, DemuxerRead_Aborted) {
Initialize();
// ReturnBuffer() with NULL triggers aborted demuxer read.
// ReturnBuffer() with null triggers aborted demuxer read.
EXPECT_CALL(*input_audio_stream_, OnRead(_))
.WillOnce(ReturnBuffer(scoped_refptr<DecoderBuffer>()));
ReadAndExpectBufferReadyWith(DemuxerStream::kAborted, NULL);
ReadAndExpectBufferReadyWith(DemuxerStream::kAborted, nullptr);
}
// Test resetting when waiting for an aborted read.
......@@ -488,7 +488,7 @@ TEST_F(DecryptingDemuxerStreamTest, Reset_DuringAbortedDemuxerRead) {
Initialize();
EnterPendingReadState();
// Make sure we get a NULL audio frame returned.
// Make sure we get a null audio frame returned.
EXPECT_CALL(*this, BufferReady(DemuxerStream::kAborted, IsNull()));
Reset();
......@@ -509,7 +509,7 @@ TEST_F(DecryptingDemuxerStreamTest, DemuxerRead_ConfigChanged) {
.WillOnce(RunOnceCallback<0>(DemuxerStream::kConfigChanged,
scoped_refptr<DecoderBuffer>()));
ReadAndExpectBufferReadyWith(DemuxerStream::kConfigChanged, NULL);
ReadAndExpectBufferReadyWith(DemuxerStream::kConfigChanged, nullptr);
}
// Test resetting when waiting for a config changed read.
......
......@@ -184,7 +184,7 @@ class DecryptingVideoDecoderTest : public testing::Test {
void AbortPendingVideoDecodeCB() {
if (pending_video_decode_cb_) {
std::move(pending_video_decode_cb_)
.Run(Decryptor::kSuccess, scoped_refptr<VideoFrame>(NULL));
.Run(Decryptor::kSuccess, scoped_refptr<VideoFrame>(nullptr));
}
}
......@@ -301,8 +301,8 @@ TEST_F(DecryptingVideoDecoderTest, DecryptAndDecode_DecodeError) {
Initialize();
EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _))
.WillRepeatedly(
RunCallback<1>(Decryptor::kError, scoped_refptr<VideoFrame>(NULL)));
.WillRepeatedly(RunCallback<1>(Decryptor::kError,
scoped_refptr<VideoFrame>(nullptr)));
DecodeAndExpect(encrypted_buffer_, DecodeStatus::DECODE_ERROR);
......
......@@ -289,7 +289,7 @@ class VideoDecoderStreamTest
const Decryptor::DecryptCB& decrypt_cb) {
DCHECK(encrypted->decrypt_config());
if (has_no_key_) {
decrypt_cb.Run(Decryptor::kNoKey, NULL);
decrypt_cb.Run(Decryptor::kNoKey, nullptr);
return;
}
......@@ -328,7 +328,7 @@ class VideoDecoderStreamTest
}
void ReadOneFrame() {
frame_read_ = NULL;
frame_read_ = nullptr;
pending_read_ = true;
video_decoder_stream_->Read(base::BindOnce(
&VideoDecoderStreamTest::FrameReady, base::Unretained(this)));
......
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