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 "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "ui/gfx/gfx_export.h" | 10 #include "ui/gfx/gfx_export.h" |
11 #include "ui/gfx/native_widget_types.h" | |
11 | 12 |
12 #if defined(OS_ANDROID) | 13 #if defined(OS_ANDROID) |
13 #include <third_party/khronos/EGL/egl.h> | 14 #include <third_party/khronos/EGL/egl.h> |
14 #endif | 15 #endif |
15 | 16 |
16 namespace gfx { | 17 namespace gfx { |
17 | 18 |
18 enum GpuMemoryBufferType { | 19 enum GpuMemoryBufferType { |
19 EMPTY_BUFFER, | 20 EMPTY_BUFFER, |
20 SHARED_MEMORY_BUFFER, | 21 SHARED_MEMORY_BUFFER, |
21 IO_SURFACE_BUFFER, | 22 IO_SURFACE_BUFFER, |
22 ANDROID_NATIVE_BUFFER, | 23 ANDROID_NATIVE_BUFFER, |
23 SURFACE_TEXTURE_BUFFER, | 24 SURFACE_TEXTURE_BUFFER, |
24 GPU_MEMORY_BUFFER_TYPE_LAST = SURFACE_TEXTURE_BUFFER | 25 GPU_MEMORY_BUFFER_TYPE_LAST = SURFACE_TEXTURE_BUFFER |
25 }; | 26 }; |
26 | 27 |
27 #if defined(OS_ANDROID) | 28 #if defined(OS_ANDROID) |
28 struct SurfaceTextureId { | 29 struct SurfaceTextureId { |
29 SurfaceTextureId() : primary_id(0), secondary_id(0) {} | 30 SurfaceTextureId() : primary_id(0), secondary_id(0) {} |
30 SurfaceTextureId(int32 primary_id, int32 secondary_id) | 31 SurfaceTextureId(int32 primary_id, int32 secondary_id) |
31 : primary_id(primary_id), secondary_id(secondary_id) {} | 32 : primary_id(primary_id), secondary_id(secondary_id) {} |
32 int32 primary_id; | 33 int32 primary_id; |
33 int32 secondary_id; | 34 int32 secondary_id; |
34 }; | 35 }; |
35 #endif | 36 #endif |
36 | 37 |
38 struct GpuMemoryBufferParams { | |
reveman
2014/05/27 22:46:01
I don't think we need this. Some of the fields in
alexst (slow to review)
2014/05/28 14:18:57
I'll move the relevant fields into GpuMemoryBuffer
reveman
2014/05/28 16:42:26
Ok, hopefully not needed in the final patch but in
| |
39 GpuMemoryBufferParams() | |
40 : width(0), | |
41 height(0), | |
42 internalformat(0), | |
43 usage(0), | |
44 window(kNullPluginWindow), | |
45 process_handle(base::kNullProcessHandle), | |
46 client_id(-1) {} | |
47 size_t width; | |
48 size_t height; | |
49 unsigned internalformat; | |
50 unsigned usage; | |
51 gfx::PluginWindowHandle window; | |
52 base::ProcessHandle process_handle; | |
53 int client_id; | |
54 }; | |
55 | |
37 struct GpuMemoryBufferHandle { | 56 struct GpuMemoryBufferHandle { |
38 GpuMemoryBufferHandle() | 57 GpuMemoryBufferHandle() |
39 : type(EMPTY_BUFFER), | 58 : type(EMPTY_BUFFER), |
40 handle(base::SharedMemory::NULLHandle()) | 59 handle(base::SharedMemory::NULLHandle()) |
41 #if defined(OS_MACOSX) | 60 #if defined(OS_MACOSX) |
42 , | 61 , |
43 io_surface_id(0u) | 62 io_surface_id(0u) |
44 #endif | 63 #endif |
45 #if defined(OS_ANDROID) | 64 #if defined(OS_ANDROID) |
46 , | 65 , |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 // Returns the stride in bytes for the buffer. | 103 // Returns the stride in bytes for the buffer. |
85 virtual uint32 GetStride() const = 0; | 104 virtual uint32 GetStride() const = 0; |
86 | 105 |
87 // Returns a platform specific handle for this buffer. | 106 // Returns a platform specific handle for this buffer. |
88 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 107 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
89 }; | 108 }; |
90 | 109 |
91 } // namespace gfx | 110 } // namespace gfx |
92 | 111 |
93 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 112 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
OLD | NEW |