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