| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" | 5 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "content/common/gpu/client/gpu_channel_host.h" | 10 #include "content/common/gpu/client/gpu_channel_host.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void GpuVideoDecodeAcceleratorHost::Reset() { | 115 void GpuVideoDecodeAcceleratorHost::Reset() { |
| 116 DCHECK(CalledOnValidThread()); | 116 DCHECK(CalledOnValidThread()); |
| 117 Send(new AcceleratedVideoDecoderMsg_Reset(decoder_route_id_)); | 117 Send(new AcceleratedVideoDecoderMsg_Reset(decoder_route_id_)); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void GpuVideoDecodeAcceleratorHost::Destroy() { | 120 void GpuVideoDecodeAcceleratorHost::Destroy() { |
| 121 DCHECK(CalledOnValidThread()); | 121 DCHECK(CalledOnValidThread()); |
| 122 channel_->RemoveRoute(decoder_route_id_); | 122 channel_->RemoveRoute(decoder_route_id_); |
| 123 client_ = NULL; | 123 client_ = NULL; |
| 124 Send(new AcceleratedVideoDecoderMsg_Destroy(decoder_route_id_)); | 124 Send(new AcceleratedVideoDecoderMsg_Destroy(decoder_route_id_)); |
| 125 delete this; |
| 125 } | 126 } |
| 126 | 127 |
| 127 GpuVideoDecodeAcceleratorHost::~GpuVideoDecodeAcceleratorHost() {} | 128 GpuVideoDecodeAcceleratorHost::~GpuVideoDecodeAcceleratorHost() {} |
| 128 | 129 |
| 129 void GpuVideoDecodeAcceleratorHost::Send(IPC::Message* message) { | 130 void GpuVideoDecodeAcceleratorHost::Send(IPC::Message* message) { |
| 130 // After OnChannelError is called, the client should no longer send | 131 // After OnChannelError is called, the client should no longer send |
| 131 // messages to the gpu channel through this object. But queued posted tasks | 132 // messages to the gpu channel through this object. But queued posted tasks |
| 132 // can still be draining, so we're forgiving and simply ignore them. | 133 // can still be draining, so we're forgiving and simply ignore them. |
| 133 bool error = false; | 134 bool error = false; |
| 134 if (!channel_) { | 135 if (!channel_) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 191 } |
| 191 | 192 |
| 192 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { | 193 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { |
| 193 DCHECK(CalledOnValidThread()); | 194 DCHECK(CalledOnValidThread()); |
| 194 if (!client_) | 195 if (!client_) |
| 195 return; | 196 return; |
| 196 client_->NotifyError( | 197 client_->NotifyError( |
| 197 static_cast<media::VideoDecodeAccelerator::Error>(error)); | 198 static_cast<media::VideoDecodeAccelerator::Error>(error)); |
| 198 client_ = NULL; | 199 client_ = NULL; |
| 199 } | 200 } |
| OLD | NEW |