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