Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h" | 5 #include "gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "gpu/ipc/common/gpu_memory_buffer_support.h" | 10 #include "gpu/ipc/common/gpu_memory_buffer_support.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 return nullptr; | 61 return nullptr; |
| 62 } | 62 } |
| 63 | 63 |
| 64 gfx::NativePixmapHandle native_pixmap_handle; | 64 gfx::NativePixmapHandle native_pixmap_handle; |
| 65 native_pixmap_handle.fds.emplace_back(handle.native_pixmap_handle.fds[0].fd, | 65 native_pixmap_handle.fds.emplace_back(handle.native_pixmap_handle.fds[0].fd, |
| 66 true /* auto_close */); | 66 true /* auto_close */); |
| 67 native_pixmap_handle.planes = handle.native_pixmap_handle.planes; | 67 native_pixmap_handle.planes = handle.native_pixmap_handle.planes; |
| 68 std::unique_ptr<ui::ClientNativePixmap> native_pixmap = | 68 std::unique_ptr<ui::ClientNativePixmap> native_pixmap = |
| 69 ui::ClientNativePixmapFactory::GetInstance()->ImportFromHandle( | 69 ui::ClientNativePixmapFactory::GetInstance()->ImportFromHandle( |
| 70 native_pixmap_handle, size, usage); | 70 native_pixmap_handle, size, usage); |
| 71 DCHECK(native_pixmap); | 71 if (!native_pixmap) |
|
rjkroege
2016/09/02 01:14:29
yeah. I think so.
sadrul
2016/09/02 03:59:53
Not sure what you are agreeing with here :)
| |
| 72 return nullptr; | |
| 72 | 73 |
| 73 return base::WrapUnique(new GpuMemoryBufferImplOzoneNativePixmap( | 74 return base::WrapUnique(new GpuMemoryBufferImplOzoneNativePixmap( |
| 74 handle.id, size, format, callback, std::move(native_pixmap), | 75 handle.id, size, format, callback, std::move(native_pixmap), |
| 75 handle.native_pixmap_handle.planes, std::move(scoped_fd))); | 76 handle.native_pixmap_handle.planes, std::move(scoped_fd))); |
| 76 } | 77 } |
| 77 | 78 |
| 78 // static | 79 // static |
| 79 bool GpuMemoryBufferImplOzoneNativePixmap::IsConfigurationSupported( | 80 bool GpuMemoryBufferImplOzoneNativePixmap::IsConfigurationSupported( |
| 80 gfx::BufferFormat format, | 81 gfx::BufferFormat format, |
| 81 gfx::BufferUsage usage) { | 82 gfx::BufferUsage usage) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 gfx::GpuMemoryBufferHandle handle; | 136 gfx::GpuMemoryBufferHandle handle; |
| 136 handle.type = gfx::OZONE_NATIVE_PIXMAP; | 137 handle.type = gfx::OZONE_NATIVE_PIXMAP; |
| 137 handle.id = id_; | 138 handle.id = id_; |
| 138 handle.native_pixmap_handle.fds.emplace_back(fd_.get(), | 139 handle.native_pixmap_handle.fds.emplace_back(fd_.get(), |
| 139 false /* auto_close */); | 140 false /* auto_close */); |
| 140 handle.native_pixmap_handle.planes = planes_; | 141 handle.native_pixmap_handle.planes = planes_; |
| 141 return handle; | 142 return handle; |
| 142 } | 143 } |
| 143 | 144 |
| 144 } // namespace gpu | 145 } // namespace gpu |
| OLD | NEW |