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

Unified Diff: content/common/gpu/client/gpu_video_decode_accelerator_host.cc

Issue 10852009: Clarify ownership of GpuVideoDecodeAcceleratorHost and avoid crash on context loss. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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
Index: content/common/gpu/client/gpu_video_decode_accelerator_host.cc
diff --git a/content/common/gpu/client/gpu_video_decode_accelerator_host.cc b/content/common/gpu/client/gpu_video_decode_accelerator_host.cc
index de43eef617f4693ee44e0da9a938aa1aea0a9e7c..387327b53a165c77d5885267fa4e0e68fc2d0b62 100644
--- a/content/common/gpu/client/gpu_video_decode_accelerator_host.cc
+++ b/content/common/gpu/client/gpu_video_decode_accelerator_host.cc
@@ -119,13 +119,17 @@ void GpuVideoDecodeAcceleratorHost::Reset() {
void GpuVideoDecodeAcceleratorHost::Destroy() {
DCHECK(CalledOnValidThread());
- channel_->RemoveRoute(decoder_route_id_);
+ if (channel_)
+ channel_->RemoveRoute(decoder_route_id_);
client_ = NULL;
Send(new AcceleratedVideoDecoderMsg_Destroy(decoder_route_id_));
delete this;
}
-GpuVideoDecodeAcceleratorHost::~GpuVideoDecodeAcceleratorHost() {}
+GpuVideoDecodeAcceleratorHost::~GpuVideoDecodeAcceleratorHost() {
+ DCHECK(CalledOnValidThread());
+ DCHECK(!client_) << "destructor called without Destroy being called!";
+}
void GpuVideoDecodeAcceleratorHost::Send(IPC::Message* message) {
// After OnChannelError is called, the client should no longer send

Powered by Google App Engine
This is Rietveld 408576698