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