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 "media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.h" | 5 #include "media/gpu/ipc/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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 if (!base::SharedMemory::IsHandleValid(input_handle)) { | 171 if (!base::SharedMemory::IsHandleValid(input_handle)) { |
172 DLOG(ERROR) << "Failed to duplicate handle of BitstreamBuffer"; | 172 DLOG(ERROR) << "Failed to duplicate handle of BitstreamBuffer"; |
173 return; | 173 return; |
174 } | 174 } |
175 decode_params.input_buffer.set_handle(input_handle); | 175 decode_params.input_buffer.set_handle(input_handle); |
176 base::SharedMemoryHandle output_handle = | 176 base::SharedMemoryHandle output_handle = |
177 channel_->ShareToGpuProcess(video_frame->shared_memory_handle()); | 177 channel_->ShareToGpuProcess(video_frame->shared_memory_handle()); |
178 if (!base::SharedMemory::IsHandleValid(output_handle)) { | 178 if (!base::SharedMemory::IsHandleValid(output_handle)) { |
179 DLOG(ERROR) << "Failed to duplicate handle of VideoFrame"; | 179 DLOG(ERROR) << "Failed to duplicate handle of VideoFrame"; |
180 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 180 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
181 if (input_handle.auto_close) { | 181 if (input_handle.OwnershipPassesToIPC()) { |
182 // Defer closing task to the ScopedFD. | 182 input_handle.Close(); |
183 base::ScopedFD(input_handle.fd); | |
184 } | 183 } |
185 #else | 184 #else |
186 // TODO(kcwu) fix the handle leak after crbug.com/493414 resolved. | 185 // TODO(kcwu) fix the handle leak after crbug.com/493414 resolved. |
187 #endif | 186 #endif |
188 return; | 187 return; |
189 } | 188 } |
190 | 189 |
191 size_t output_buffer_size = VideoFrame::AllocationSize( | 190 size_t output_buffer_size = VideoFrame::AllocationSize( |
192 video_frame->format(), video_frame->coded_size()); | 191 video_frame->format(), video_frame->coded_size()); |
193 | 192 |
(...skipping 14 matching lines...) Expand all Loading... |
208 if (!channel_->Send(message)) { | 207 if (!channel_->Send(message)) { |
209 DLOG(ERROR) << "Send(" << message->type() << ") failed"; | 208 DLOG(ERROR) << "Send(" << message->type() << ") failed"; |
210 } | 209 } |
211 } | 210 } |
212 | 211 |
213 base::WeakPtr<IPC::Listener> GpuJpegDecodeAcceleratorHost::GetReceiver() { | 212 base::WeakPtr<IPC::Listener> GpuJpegDecodeAcceleratorHost::GetReceiver() { |
214 return receiver_->AsWeakPtrForIO(); | 213 return receiver_->AsWeakPtrForIO(); |
215 } | 214 } |
216 | 215 |
217 } // namespace media | 216 } // namespace media |
OLD | NEW |