Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2566)

Unified Diff: media/filters/decrypting_video_decoder.cc

Issue 14348007: Reland: Remove reference counting from media::VideoDecoder and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/decrypting_video_decoder.h ('k') | media/filters/decrypting_video_decoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/decrypting_video_decoder.cc
diff --git a/media/filters/decrypting_video_decoder.cc b/media/filters/decrypting_video_decoder.cc
index 6fe6e69e0fd3304eea6008568917426f0bb71956..6179fd72369a002cc0ab38d8fcf97404fc0a40b2 100644
--- a/media/filters/decrypting_video_decoder.cc
+++ b/media/filters/decrypting_video_decoder.cc
@@ -24,6 +24,7 @@ DecryptingVideoDecoder::DecryptingVideoDecoder(
const scoped_refptr<base::MessageLoopProxy>& message_loop,
const SetDecryptorReadyCB& set_decryptor_ready_cb)
: message_loop_(message_loop),
+ weak_factory_(this),
state_(kUninitialized),
set_decryptor_ready_cb_(set_decryptor_ready_cb),
decryptor_(NULL),
@@ -40,6 +41,7 @@ void DecryptingVideoDecoder::Initialize(
DCHECK_EQ(state_, kUninitialized) << state_;
DCHECK(stream);
init_cb_ = BindToCurrentLoop(status_cb);
+ weak_this_ = weak_factory_.GetWeakPtr();
const VideoDecoderConfig& config = stream->video_decoder_config();
if (!config.IsValidConfig()) {
@@ -61,7 +63,7 @@ void DecryptingVideoDecoder::Initialize(
state_ = kDecryptorRequested;
set_decryptor_ready_cb_.Run(BindToCurrentLoop(base::Bind(
- &DecryptingVideoDecoder::SetDecryptor, this)));
+ &DecryptingVideoDecoder::SetDecryptor, weak_this_)));
}
void DecryptingVideoDecoder::Read(const ReadCB& read_cb) {
@@ -166,7 +168,7 @@ void DecryptingVideoDecoder::SetDecryptor(Decryptor* decryptor) {
state_ = kPendingDecoderInit;
decryptor_->InitializeVideoDecoder(
demuxer_stream_->video_decoder_config(), BindToCurrentLoop(base::Bind(
- &DecryptingVideoDecoder::FinishInitialization, this)));
+ &DecryptingVideoDecoder::FinishInitialization, weak_this_)));
}
void DecryptingVideoDecoder::FinishInitialization(bool success) {
@@ -188,7 +190,7 @@ void DecryptingVideoDecoder::FinishInitialization(bool success) {
}
decryptor_->RegisterNewKeyCB(Decryptor::kVideo, BindToCurrentLoop(
- base::Bind(&DecryptingVideoDecoder::OnKeyAdded, this)));
+ base::Bind(&DecryptingVideoDecoder::OnKeyAdded, weak_this_)));
// Success!
state_ = kIdle;
@@ -230,7 +232,7 @@ void DecryptingVideoDecoder::ReadFromDemuxerStream() {
DCHECK(!read_cb_.is_null());
demuxer_stream_->Read(
- base::Bind(&DecryptingVideoDecoder::DecryptAndDecodeBuffer, this));
+ base::Bind(&DecryptingVideoDecoder::DecryptAndDecodeBuffer, weak_this_));
}
void DecryptingVideoDecoder::DecryptAndDecodeBuffer(
@@ -253,7 +255,7 @@ void DecryptingVideoDecoder::DecryptAndDecodeBuffer(
decryptor_->DeinitializeDecoder(Decryptor::kVideo);
decryptor_->InitializeVideoDecoder(
demuxer_stream_->video_decoder_config(), BindToCurrentLoop(base::Bind(
- &DecryptingVideoDecoder::FinishConfigChange, this)));
+ &DecryptingVideoDecoder::FinishConfigChange, weak_this_)));
return;
}
@@ -289,7 +291,7 @@ void DecryptingVideoDecoder::DecodePendingBuffer() {
decryptor_->DecryptAndDecodeVideo(
pending_buffer_to_decode_, BindToCurrentLoop(base::Bind(
- &DecryptingVideoDecoder::DeliverFrame, this, buffer_size)));
+ &DecryptingVideoDecoder::DeliverFrame, weak_this_, buffer_size)));
}
void DecryptingVideoDecoder::DeliverFrame(
« no previous file with comments | « media/filters/decrypting_video_decoder.h ('k') | media/filters/decrypting_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698