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

Unified Diff: media/filters/gpu_video_decoder.cc

Issue 193303002: WeakPtr destruction order cleanup: media edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 9 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/gpu_video_decoder.h ('k') | media/filters/opus_audio_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/gpu_video_decoder.cc
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc
index a415a76745e25610e57b829c623fa99da431b493..0c5f1005a7eac1c1da5ce07f8b5a4cd1476749e9 100644
--- a/media/filters/gpu_video_decoder.cc
+++ b/media/filters/gpu_video_decoder.cc
@@ -60,14 +60,14 @@ GpuVideoDecoder::GpuVideoDecoder(
const scoped_refptr<GpuVideoAcceleratorFactories>& factories,
const scoped_refptr<MediaLog>& media_log)
: needs_bitstream_conversion_(false),
- weak_factory_(this),
factories_(factories),
state_(kNormal),
media_log_(media_log),
decoder_texture_target_(0),
next_picture_buffer_id_(0),
next_bitstream_buffer_id_(0),
- available_pictures_(0) {
+ available_pictures_(0),
+ weak_factory_(this) {
DCHECK(factories_.get());
}
@@ -76,8 +76,10 @@ void GpuVideoDecoder::Reset(const base::Closure& closure) {
DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
if (state_ == kDrainingDecoder) {
- base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
- &GpuVideoDecoder::Reset, weak_this_, closure));
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(
+ &GpuVideoDecoder::Reset, weak_factory_.GetWeakPtr(), closure));
// NOTE: if we're deferring Reset() until a Flush() completes, return
// queued pictures to the VDA so they can be used to finish that Flush().
if (pending_decode_cb_.is_null())
@@ -147,8 +149,6 @@ void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config,
DCHECK(config.IsValidConfig());
DCHECK(!config.is_encrypted());
- weak_this_ = weak_factory_.GetWeakPtr();
-
PipelineStatusCB status_cb =
base::Bind(&ReportGpuVideoDecoderInitializeStatusToUMAAndRunCB,
BindToCurrentLoop(orig_status_cb));
@@ -463,7 +463,7 @@ void GpuVideoDecoder::PictureReady(const media::Picture& picture) {
make_scoped_ptr(new gpu::MailboxHolder(
pb.texture_mailbox(), decoder_texture_target_, 0 /* sync_point */)),
BindToCurrentLoop(base::Bind(&GpuVideoDecoder::ReusePictureBuffer,
- weak_this_,
+ weak_factory_.GetWeakPtr(),
picture.picture_buffer_id())),
pb.size(),
visible_rect,
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/filters/opus_audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698