| 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.h" | 9 #include "base/message_loop.h" |
| 10 #include "content/common/gpu/client/gpu_channel_host.h" | 10 #include "content/common/gpu/client/gpu_channel_host.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 GpuChannelHost* channel, | 23 GpuChannelHost* channel, |
| 24 int32 decoder_route_id, | 24 int32 decoder_route_id, |
| 25 VideoDecodeAccelerator::Client* client) | 25 VideoDecodeAccelerator::Client* client) |
| 26 : channel_(channel), | 26 : channel_(channel), |
| 27 decoder_route_id_(decoder_route_id), | 27 decoder_route_id_(decoder_route_id), |
| 28 client_(client) { | 28 client_(client) { |
| 29 DCHECK(channel_); | 29 DCHECK(channel_); |
| 30 DCHECK(client_); | 30 DCHECK(client_); |
| 31 } | 31 } |
| 32 | 32 |
| 33 GpuVideoDecodeAcceleratorHost::~GpuVideoDecodeAcceleratorHost() {} | |
| 34 | |
| 35 void GpuVideoDecodeAcceleratorHost::OnChannelError() { | 33 void GpuVideoDecodeAcceleratorHost::OnChannelError() { |
| 36 DLOG(ERROR) << "GpuVideoDecodeAcceleratorHost::OnChannelError()"; | 34 DLOG(ERROR) << "GpuVideoDecodeAcceleratorHost::OnChannelError()"; |
| 37 OnErrorNotification(PLATFORM_FAILURE); | 35 OnErrorNotification(PLATFORM_FAILURE); |
| 38 channel_ = NULL; | 36 channel_ = NULL; |
| 39 } | 37 } |
| 40 | 38 |
| 41 bool GpuVideoDecodeAcceleratorHost::OnMessageReceived(const IPC::Message& msg) { | 39 bool GpuVideoDecodeAcceleratorHost::OnMessageReceived(const IPC::Message& msg) { |
| 42 DCHECK(CalledOnValidThread()); | 40 DCHECK(CalledOnValidThread()); |
| 43 bool handled = true; | 41 bool handled = true; |
| 44 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAcceleratorHost, msg) | 42 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAcceleratorHost, msg) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 Send(new AcceleratedVideoDecoderMsg_Reset(decoder_route_id_)); | 117 Send(new AcceleratedVideoDecoderMsg_Reset(decoder_route_id_)); |
| 120 } | 118 } |
| 121 | 119 |
| 122 void GpuVideoDecodeAcceleratorHost::Destroy() { | 120 void GpuVideoDecodeAcceleratorHost::Destroy() { |
| 123 DCHECK(CalledOnValidThread()); | 121 DCHECK(CalledOnValidThread()); |
| 124 channel_->RemoveRoute(decoder_route_id_); | 122 channel_->RemoveRoute(decoder_route_id_); |
| 125 client_ = NULL; | 123 client_ = NULL; |
| 126 Send(new AcceleratedVideoDecoderMsg_Destroy(decoder_route_id_)); | 124 Send(new AcceleratedVideoDecoderMsg_Destroy(decoder_route_id_)); |
| 127 } | 125 } |
| 128 | 126 |
| 127 GpuVideoDecodeAcceleratorHost::~GpuVideoDecodeAcceleratorHost() {} |
| 128 |
| 129 void GpuVideoDecodeAcceleratorHost::Send(IPC::Message* message) { | 129 void GpuVideoDecodeAcceleratorHost::Send(IPC::Message* message) { |
| 130 // After OnChannelError is called, the client should no longer send | 130 // After OnChannelError is called, the client should no longer send |
| 131 // messages to the gpu channel through this object. | 131 // messages to the gpu channel through this object. |
| 132 DCHECK(channel_); | 132 DCHECK(channel_); |
| 133 if (!channel_ || !channel_->Send(message)) { | 133 if (!channel_ || !channel_->Send(message)) { |
| 134 DLOG(ERROR) << "Send(" << message->type() << ") failed"; | 134 DLOG(ERROR) << "Send(" << message->type() << ") failed"; |
| 135 OnErrorNotification(PLATFORM_FAILURE); | 135 OnErrorNotification(PLATFORM_FAILURE); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 client_->NotifyResetDone(); | 179 client_->NotifyResetDone(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { | 182 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { |
| 183 DCHECK(CalledOnValidThread()); | 183 DCHECK(CalledOnValidThread()); |
| 184 if (!client_) | 184 if (!client_) |
| 185 return; | 185 return; |
| 186 client_->NotifyError( | 186 client_->NotifyError( |
| 187 static_cast<media::VideoDecodeAccelerator::Error>(error)); | 187 static_cast<media::VideoDecodeAccelerator::Error>(error)); |
| 188 } | 188 } |
| OLD | NEW |