diff options
author | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-30 23:05:28 +0000 |
---|---|---|
committer | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-30 23:05:28 +0000 |
commit | 86323c45a13aadabb5fb14d2bd8ba0f0c0e86546 (patch) | |
tree | 83b68df85e015c1eae7e2118952d94451058376e /media | |
parent | 65616819960f4f4b90c303e6ef2772b78c5ea175 (diff) | |
download | chromium_src-86323c45a13aadabb5fb14d2bd8ba0f0c0e86546.zip chromium_src-86323c45a13aadabb5fb14d2bd8ba0f0c0e86546.tar.gz chromium_src-86323c45a13aadabb5fb14d2bd8ba0f0c0e86546.tar.bz2 |
Delay deleting GpuVideoDecoder until after GpuVideoDecodeAcceleratorHost::Destroy() fires.
BUG=139657
Review URL: https://chromiumcodereview.appspot.com/10827090
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149060 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/filters/gpu_video_decoder.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc index db86988..003f47c 100644 --- a/media/filters/gpu_video_decoder.cc +++ b/media/filters/gpu_video_decoder.cc @@ -107,8 +107,17 @@ void GpuVideoDecoder::Stop(const base::Closure& closure) { return; } VideoDecodeAccelerator* vda ALLOW_UNUSED = vda_.release(); - vda_loop_proxy_->PostTask(FROM_HERE, base::Bind( - &VideoDecodeAccelerator::Destroy, weak_vda_)); + // Tricky: |this| needs to stay alive until after VDA::Destroy is actually + // called, not just posted. We can't simply PostTaskAndReply using |closure| + // as the |reply| because we might be called while the renderer thread + // (a.k.a. vda_loop_proxy_) is paused (during WebMediaPlayerImpl::Destroy()), + // which would result in an apparent hang. Instead, we take an artificial ref + // to |this| and release it as |reply| after VDA::Destroy returns. + AddRef(); + vda_loop_proxy_->PostTaskAndReply( + FROM_HERE, + base::Bind(&VideoDecodeAccelerator::Destroy, weak_vda_), + base::Bind(&GpuVideoDecoder::Release, this)); closure.Run(); } |