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 "media/gpu/ipc/client/gpu_video_decode_accelerator_host.h" | 5 #include "media/gpu/ipc/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/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 Send(new AcceleratedVideoDecoderMsg_Flush(decoder_route_id_)); | 156 Send(new AcceleratedVideoDecoderMsg_Flush(decoder_route_id_)); |
157 } | 157 } |
158 | 158 |
159 void GpuVideoDecodeAcceleratorHost::Reset() { | 159 void GpuVideoDecodeAcceleratorHost::Reset() { |
160 DCHECK(CalledOnValidThread()); | 160 DCHECK(CalledOnValidThread()); |
161 if (!channel_) | 161 if (!channel_) |
162 return; | 162 return; |
163 Send(new AcceleratedVideoDecoderMsg_Reset(decoder_route_id_)); | 163 Send(new AcceleratedVideoDecoderMsg_Reset(decoder_route_id_)); |
164 } | 164 } |
165 | 165 |
| 166 void GpuVideoDecodeAcceleratorHost::SetSurface(int32_t surface_id) { |
| 167 DCHECK(CalledOnValidThread()); |
| 168 if (!channel_) |
| 169 return; |
| 170 Send( |
| 171 new AcceleratedVideoDecoderMsg_SetSurface(decoder_route_id_, surface_id)); |
| 172 } |
| 173 |
166 void GpuVideoDecodeAcceleratorHost::Destroy() { | 174 void GpuVideoDecodeAcceleratorHost::Destroy() { |
167 DCHECK(CalledOnValidThread()); | 175 DCHECK(CalledOnValidThread()); |
168 if (channel_) | 176 if (channel_) |
169 Send(new AcceleratedVideoDecoderMsg_Destroy(decoder_route_id_)); | 177 Send(new AcceleratedVideoDecoderMsg_Destroy(decoder_route_id_)); |
170 client_ = NULL; | 178 client_ = NULL; |
171 delete this; | 179 delete this; |
172 } | 180 } |
173 | 181 |
174 void GpuVideoDecodeAcceleratorHost::OnWillDeleteImpl() { | 182 void GpuVideoDecodeAcceleratorHost::OnWillDeleteImpl() { |
175 DCHECK(CalledOnValidThread()); | 183 DCHECK(CalledOnValidThread()); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 weak_this_factory_.InvalidateWeakPtrs(); | 277 weak_this_factory_.InvalidateWeakPtrs(); |
270 | 278 |
271 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 279 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
272 // last thing done on this stack! | 280 // last thing done on this stack! |
273 VideoDecodeAccelerator::Client* client = NULL; | 281 VideoDecodeAccelerator::Client* client = NULL; |
274 std::swap(client, client_); | 282 std::swap(client, client_); |
275 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); | 283 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); |
276 } | 284 } |
277 | 285 |
278 } // namespace media | 286 } // namespace media |
OLD | NEW |