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 "content/common/gpu/client/gpu_channel_host.h" | 10 #include "content/common/gpu/client/gpu_channel_host.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 DCHECK(CalledOnValidThread()); | 181 DCHECK(CalledOnValidThread()); |
182 impl_ = NULL; | 182 impl_ = NULL; |
183 | 183 |
184 // The CommandBufferProxyImpl is going away; error out this VDA. | 184 // The CommandBufferProxyImpl is going away; error out this VDA. |
185 OnChannelError(); | 185 OnChannelError(); |
186 } | 186 } |
187 | 187 |
188 void GpuVideoDecodeAcceleratorHost::PostNotifyError(Error error) { | 188 void GpuVideoDecodeAcceleratorHost::PostNotifyError(Error error) { |
189 DCHECK(CalledOnValidThread()); | 189 DCHECK(CalledOnValidThread()); |
190 DVLOG(2) << "PostNotifyError(): error=" << error; | 190 DVLOG(2) << "PostNotifyError(): error=" << error; |
191 base::MessageLoopProxy::current()->PostTask( | 191 base::ThreadTaskRunnerHandle::Get()->PostTask( |
192 FROM_HERE, | 192 FROM_HERE, base::Bind(&GpuVideoDecodeAcceleratorHost::OnNotifyError, |
193 base::Bind(&GpuVideoDecodeAcceleratorHost::OnNotifyError, | 193 weak_this_factory_.GetWeakPtr(), error)); |
194 weak_this_factory_.GetWeakPtr(), | |
195 error)); | |
196 } | 194 } |
197 | 195 |
198 void GpuVideoDecodeAcceleratorHost::Send(IPC::Message* message) { | 196 void GpuVideoDecodeAcceleratorHost::Send(IPC::Message* message) { |
199 DCHECK(CalledOnValidThread()); | 197 DCHECK(CalledOnValidThread()); |
200 uint32 message_type = message->type(); | 198 uint32 message_type = message->type(); |
201 if (!channel_->Send(message)) { | 199 if (!channel_->Send(message)) { |
202 DLOG(ERROR) << "Send(" << message_type << ") failed"; | 200 DLOG(ERROR) << "Send(" << message_type << ") failed"; |
203 PostNotifyError(PLATFORM_FAILURE); | 201 PostNotifyError(PLATFORM_FAILURE); |
204 } | 202 } |
205 } | 203 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 weak_this_factory_.InvalidateWeakPtrs(); | 260 weak_this_factory_.InvalidateWeakPtrs(); |
263 | 261 |
264 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 262 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
265 // last thing done on this stack! | 263 // last thing done on this stack! |
266 media::VideoDecodeAccelerator::Client* client = NULL; | 264 media::VideoDecodeAccelerator::Client* client = NULL; |
267 std::swap(client, client_); | 265 std::swap(client, client_); |
268 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); | 266 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); |
269 } | 267 } |
270 | 268 |
271 } // namespace content | 269 } // namespace content |
OLD | NEW |