Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef UI_GFX_GPU_MEMORY_BUFFER_H_ | 5 #ifndef UI_GFX_GPU_MEMORY_BUFFER_H_ |
| 6 #define UI_GFX_GPU_MEMORY_BUFFER_H_ | 6 #define UI_GFX_GPU_MEMORY_BUFFER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
| 12 #include "base/trace_event/memory_allocator_dump_guid.h" | |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 #include "ui/gfx/buffer_types.h" | 14 #include "ui/gfx/buffer_types.h" |
| 14 #include "ui/gfx/generic_shared_memory_id.h" | 15 #include "ui/gfx/generic_shared_memory_id.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/gfx_export.h" | 17 #include "ui/gfx/gfx_export.h" |
| 17 | 18 |
| 18 #if defined(OS_LINUX) | 19 #if defined(OS_LINUX) |
| 19 #include "ui/gfx/native_pixmap_handle.h" | 20 #include "ui/gfx/native_pixmap_handle.h" |
| 20 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 21 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
| 21 #include "ui/gfx/mac/io_surface.h" | 22 #include "ui/gfx/mac/io_surface.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 45 GpuMemoryBufferType type; | 46 GpuMemoryBufferType type; |
| 46 GpuMemoryBufferId id; | 47 GpuMemoryBufferId id; |
| 47 base::SharedMemoryHandle handle; | 48 base::SharedMemoryHandle handle; |
| 48 uint32_t offset; | 49 uint32_t offset; |
| 49 int32_t stride; | 50 int32_t stride; |
| 50 #if defined(OS_LINUX) | 51 #if defined(OS_LINUX) |
| 51 NativePixmapHandle native_pixmap_handle; | 52 NativePixmapHandle native_pixmap_handle; |
| 52 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 53 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
| 53 ScopedRefCountedIOSurfaceMachPort mach_port; | 54 ScopedRefCountedIOSurfaceMachPort mach_port; |
| 54 #endif | 55 #endif |
| 56 | |
| 57 base::trace_event::MemoryAllocatorDumpGuid GetGUIDForTracing( | |
| 58 uint64_t tracing_process_id); | |
|
reveman
2017/04/17 13:21:06
I don't think this belongs as part of the Handle.
hajimehoshi
2017/04/18 08:21:59
Done.
| |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 // This interface typically correspond to a type of shared memory that is also | 61 // This interface typically correspond to a type of shared memory that is also |
| 58 // shared with the GPU. A GPU memory buffer can be written to directly by | 62 // shared with the GPU. A GPU memory buffer can be written to directly by |
| 59 // regular CPU code, but can also be read by the GPU. | 63 // regular CPU code, but can also be read by the GPU. |
| 60 class GFX_EXPORT GpuMemoryBuffer { | 64 class GFX_EXPORT GpuMemoryBuffer { |
| 61 public: | 65 public: |
| 62 virtual ~GpuMemoryBuffer() {} | 66 virtual ~GpuMemoryBuffer() {} |
| 63 | 67 |
| 64 // Maps each plane of the buffer into the client's address space so it can be | 68 // Maps each plane of the buffer into the client's address space so it can be |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 | 105 |
| 102 // Returns an instance of |handle| which can be sent over IPC. This duplicates | 106 // Returns an instance of |handle| which can be sent over IPC. This duplicates |
| 103 // the file-handles as appropriate, so that the IPC code take ownership of them, | 107 // the file-handles as appropriate, so that the IPC code take ownership of them, |
| 104 // without invalidating |handle| itself. | 108 // without invalidating |handle| itself. |
| 105 GFX_EXPORT GpuMemoryBufferHandle | 109 GFX_EXPORT GpuMemoryBufferHandle |
| 106 CloneHandleForIPC(const GpuMemoryBufferHandle& handle); | 110 CloneHandleForIPC(const GpuMemoryBufferHandle& handle); |
| 107 | 111 |
| 108 } // namespace gfx | 112 } // namespace gfx |
| 109 | 113 |
| 110 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 114 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
| OLD | NEW |