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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 void GpuVideoDecodeAcceleratorHost::Flush() { | 110 void GpuVideoDecodeAcceleratorHost::Flush() { |
111 DCHECK(CalledOnValidThread()); | 111 DCHECK(CalledOnValidThread()); |
112 Send(new AcceleratedVideoDecoderMsg_Flush(decoder_route_id_)); | 112 Send(new AcceleratedVideoDecoderMsg_Flush(decoder_route_id_)); |
113 } | 113 } |
114 | 114 |
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(bool pass_ownership) { |
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 if (pass_ownership) |
| 126 delete this; |
125 } | 127 } |
126 | 128 |
127 GpuVideoDecodeAcceleratorHost::~GpuVideoDecodeAcceleratorHost() {} | 129 GpuVideoDecodeAcceleratorHost::~GpuVideoDecodeAcceleratorHost() {} |
128 | 130 |
129 void GpuVideoDecodeAcceleratorHost::Send(IPC::Message* message) { | 131 void GpuVideoDecodeAcceleratorHost::Send(IPC::Message* message) { |
130 // After OnChannelError is called, the client should no longer send | 132 // After OnChannelError is called, the client should no longer send |
131 // messages to the gpu channel through this object. But queued posted tasks | 133 // 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. | 134 // can still be draining, so we're forgiving and simply ignore them. |
133 bool error = false; | 135 bool error = false; |
134 if (!channel_) { | 136 if (!channel_) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } | 192 } |
191 | 193 |
192 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { | 194 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { |
193 DCHECK(CalledOnValidThread()); | 195 DCHECK(CalledOnValidThread()); |
194 if (!client_) | 196 if (!client_) |
195 return; | 197 return; |
196 client_->NotifyError( | 198 client_->NotifyError( |
197 static_cast<media::VideoDecodeAccelerator::Error>(error)); | 199 static_cast<media::VideoDecodeAccelerator::Error>(error)); |
198 client_ = NULL; | 200 client_ = NULL; |
199 } | 201 } |
OLD | NEW |