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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 11 #include "base/thread_task_runner_handle.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 #include "base/thread_task_runner_handle.h" | |
13 #include "content/common/gpu/client/gpu_channel_host.h" | |
14 #include "content/common/gpu/media/media_messages.h" | 13 #include "content/common/gpu/media/media_messages.h" |
| 14 #include "gpu/ipc/client/gpu_channel_host.h" |
15 #include "ipc/ipc_message_macros.h" | 15 #include "ipc/ipc_message_macros.h" |
16 #include "ipc/ipc_message_utils.h" | 16 #include "ipc/ipc_message_utils.h" |
17 | 17 |
18 using media::VideoDecodeAccelerator; | 18 using media::VideoDecodeAccelerator; |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 GpuVideoDecodeAcceleratorHost::GpuVideoDecodeAcceleratorHost( | 21 GpuVideoDecodeAcceleratorHost::GpuVideoDecodeAcceleratorHost( |
22 GpuChannelHost* channel, | 22 gpu::GpuChannelHost* channel, |
23 CommandBufferProxyImpl* impl) | 23 gpu::CommandBufferProxyImpl* impl) |
24 : channel_(channel), | 24 : channel_(channel), |
25 decoder_route_id_(MSG_ROUTING_NONE), | 25 decoder_route_id_(MSG_ROUTING_NONE), |
26 client_(NULL), | 26 client_(NULL), |
27 impl_(impl), | 27 impl_(impl), |
28 weak_this_factory_(this) { | 28 weak_this_factory_(this) { |
29 DCHECK(channel_); | 29 DCHECK(channel_); |
30 DCHECK(impl_); | 30 DCHECK(impl_); |
31 impl_->AddDeletionObserver(this); | 31 impl_->AddDeletionObserver(this); |
32 } | 32 } |
33 | 33 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 if (channel_) | 180 if (channel_) |
181 Send(new AcceleratedVideoDecoderMsg_Destroy(decoder_route_id_)); | 181 Send(new AcceleratedVideoDecoderMsg_Destroy(decoder_route_id_)); |
182 client_ = NULL; | 182 client_ = NULL; |
183 delete this; | 183 delete this; |
184 } | 184 } |
185 | 185 |
186 void GpuVideoDecodeAcceleratorHost::OnWillDeleteImpl() { | 186 void GpuVideoDecodeAcceleratorHost::OnWillDeleteImpl() { |
187 DCHECK(CalledOnValidThread()); | 187 DCHECK(CalledOnValidThread()); |
188 impl_ = NULL; | 188 impl_ = NULL; |
189 | 189 |
190 // The CommandBufferProxyImpl is going away; error out this VDA. | 190 // The gpu::CommandBufferProxyImpl is going away; error out this VDA. |
191 OnChannelError(); | 191 OnChannelError(); |
192 } | 192 } |
193 | 193 |
194 void GpuVideoDecodeAcceleratorHost::PostNotifyError(Error error) { | 194 void GpuVideoDecodeAcceleratorHost::PostNotifyError(Error error) { |
195 DCHECK(CalledOnValidThread()); | 195 DCHECK(CalledOnValidThread()); |
196 DVLOG(2) << "PostNotifyError(): error=" << error; | 196 DVLOG(2) << "PostNotifyError(): error=" << error; |
197 base::ThreadTaskRunnerHandle::Get()->PostTask( | 197 base::ThreadTaskRunnerHandle::Get()->PostTask( |
198 FROM_HERE, base::Bind(&GpuVideoDecodeAcceleratorHost::OnNotifyError, | 198 FROM_HERE, base::Bind(&GpuVideoDecodeAcceleratorHost::OnNotifyError, |
199 weak_this_factory_.GetWeakPtr(), error)); | 199 weak_this_factory_.GetWeakPtr(), error)); |
200 } | 200 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 weak_this_factory_.InvalidateWeakPtrs(); | 274 weak_this_factory_.InvalidateWeakPtrs(); |
275 | 275 |
276 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 276 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
277 // last thing done on this stack! | 277 // last thing done on this stack! |
278 media::VideoDecodeAccelerator::Client* client = NULL; | 278 media::VideoDecodeAccelerator::Client* client = NULL; |
279 std::swap(client, client_); | 279 std::swap(client, client_); |
280 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); | 280 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); |
281 } | 281 } |
282 | 282 |
283 } // namespace content | 283 } // namespace content |
OLD | NEW |