| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_jpeg_decode_accelerator_host.h" | 5 #include "content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // TODO(kcwu) fix the handle leak after crbug.com/493414 resolved. | 174 // TODO(kcwu) fix the handle leak after crbug.com/493414 resolved. |
| 175 #endif | 175 #endif |
| 176 return; | 176 return; |
| 177 } | 177 } |
| 178 | 178 |
| 179 size_t output_buffer_size = media::VideoFrame::AllocationSize( | 179 size_t output_buffer_size = media::VideoFrame::AllocationSize( |
| 180 video_frame->format(), video_frame->coded_size()); | 180 video_frame->format(), video_frame->coded_size()); |
| 181 | 181 |
| 182 decode_params.coded_size = video_frame->coded_size(); | 182 decode_params.coded_size = video_frame->coded_size(); |
| 183 decode_params.output_video_frame_handle = output_handle; | 183 decode_params.output_video_frame_handle = output_handle; |
| 184 decode_params.output_buffer_size = output_buffer_size; | 184 decode_params.output_buffer_size = |
| 185 base::checked_cast<uint32_t>(output_buffer_size); |
| 185 Send(new AcceleratedJpegDecoderMsg_Decode(decoder_route_id_, decode_params)); | 186 Send(new AcceleratedJpegDecoderMsg_Decode(decoder_route_id_, decode_params)); |
| 186 } | 187 } |
| 187 | 188 |
| 188 bool GpuJpegDecodeAcceleratorHost::IsSupported() { | 189 bool GpuJpegDecodeAcceleratorHost::IsSupported() { |
| 189 return channel_->gpu_info().jpeg_decode_accelerator_supported; | 190 return channel_->gpu_info().jpeg_decode_accelerator_supported; |
| 190 } | 191 } |
| 191 | 192 |
| 192 void GpuJpegDecodeAcceleratorHost::Send(IPC::Message* message) { | 193 void GpuJpegDecodeAcceleratorHost::Send(IPC::Message* message) { |
| 193 DCHECK(CalledOnValidThread()); | 194 DCHECK(CalledOnValidThread()); |
| 194 | 195 |
| 195 if (!channel_->Send(message)) { | 196 if (!channel_->Send(message)) { |
| 196 DLOG(ERROR) << "Send(" << message->type() << ") failed"; | 197 DLOG(ERROR) << "Send(" << message->type() << ") failed"; |
| 197 } | 198 } |
| 198 } | 199 } |
| 199 | 200 |
| 200 base::WeakPtr<IPC::Listener> GpuJpegDecodeAcceleratorHost::GetReceiver() { | 201 base::WeakPtr<IPC::Listener> GpuJpegDecodeAcceleratorHost::GetReceiver() { |
| 201 return receiver_->AsWeakPtrForIO(); | 202 return receiver_->AsWeakPtrForIO(); |
| 202 } | 203 } |
| 203 | 204 |
| 204 } // namespace content | 205 } // namespace content |
| OLD | NEW |