Commit 86323c45 authored by fischman@chromium.org's avatar fischman@chromium.org

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
parent 65616819
......@@ -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();
}
......
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