OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_encode_accelerator_host.h" | 5 #include "content/common/gpu/client/gpu_video_encode_accelerator_host.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop_proxy.h" | |
9 #include "content/common/gpu/client/gpu_channel_host.h" | 8 #include "content/common/gpu/client/gpu_channel_host.h" |
10 #include "content/common/gpu/gpu_messages.h" | 9 #include "content/common/gpu/gpu_messages.h" |
11 #include "content/common/gpu/media/gpu_video_accelerator_util.h" | 10 #include "content/common/gpu/media/gpu_video_accelerator_util.h" |
12 #include "media/base/video_frame.h" | 11 #include "media/base/video_frame.h" |
13 | 12 |
14 namespace content { | 13 namespace content { |
15 | 14 |
16 #define NOTIFY_ERROR(error) \ | 15 #define NOTIFY_ERROR(error) \ |
17 PostNotifyError(error); \ | 16 PostNotifyError(error); \ |
18 DLOG(ERROR) | 17 DLOG(ERROR) |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 impl_ = NULL; | 192 impl_ = NULL; |
194 | 193 |
195 // The CommandBufferProxyImpl is going away; error out this VEA. | 194 // The CommandBufferProxyImpl is going away; error out this VEA. |
196 OnChannelError(); | 195 OnChannelError(); |
197 } | 196 } |
198 | 197 |
199 void GpuVideoEncodeAcceleratorHost::PostNotifyError(Error error) { | 198 void GpuVideoEncodeAcceleratorHost::PostNotifyError(Error error) { |
200 DCHECK(CalledOnValidThread()); | 199 DCHECK(CalledOnValidThread()); |
201 DVLOG(2) << "PostNotifyError(): error=" << error; | 200 DVLOG(2) << "PostNotifyError(): error=" << error; |
202 // Post the error notification back to this thread, to avoid re-entrancy. | 201 // Post the error notification back to this thread, to avoid re-entrancy. |
203 base::MessageLoopProxy::current()->PostTask( | 202 base::ThreadTaskRunnerHandle::Get()->PostTask( |
204 FROM_HERE, | 203 FROM_HERE, base::Bind(&GpuVideoEncodeAcceleratorHost::OnNotifyError, |
205 base::Bind(&GpuVideoEncodeAcceleratorHost::OnNotifyError, | 204 weak_this_factory_.GetWeakPtr(), error)); |
206 weak_this_factory_.GetWeakPtr(), | |
207 error)); | |
208 } | 205 } |
209 | 206 |
210 void GpuVideoEncodeAcceleratorHost::Send(IPC::Message* message) { | 207 void GpuVideoEncodeAcceleratorHost::Send(IPC::Message* message) { |
211 DCHECK(CalledOnValidThread()); | 208 DCHECK(CalledOnValidThread()); |
212 uint32 message_type = message->type(); | 209 uint32 message_type = message->type(); |
213 if (!channel_->Send(message)) { | 210 if (!channel_->Send(message)) { |
214 NOTIFY_ERROR(kPlatformFailureError) << "Send(" << message_type | 211 NOTIFY_ERROR(kPlatformFailureError) << "Send(" << message_type |
215 << ") failed"; | 212 << ") failed"; |
216 } | 213 } |
217 } | 214 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 weak_this_factory_.InvalidateWeakPtrs(); | 268 weak_this_factory_.InvalidateWeakPtrs(); |
272 | 269 |
273 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 270 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
274 // last thing done on this stack! | 271 // last thing done on this stack! |
275 media::VideoEncodeAccelerator::Client* client = NULL; | 272 media::VideoEncodeAccelerator::Client* client = NULL; |
276 std::swap(client_, client); | 273 std::swap(client_, client); |
277 client->NotifyError(error); | 274 client->NotifyError(error); |
278 } | 275 } |
279 | 276 |
280 } // namespace content | 277 } // namespace content |
OLD | NEW |