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 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 #endif | 55 #endif |
56 }; | 56 }; |
57 | 57 |
58 // This interface typically correspond to a type of shared memory that is also | 58 // This interface typically correspond to a type of shared memory that is also |
59 // shared with the GPU. A GPU memory buffer can be written to directly by | 59 // shared with the GPU. A GPU memory buffer can be written to directly by |
60 // regular CPU code, but can also be read by the GPU. | 60 // regular CPU code, but can also be read by the GPU. |
61 class GFX_EXPORT GpuMemoryBuffer { | 61 class GFX_EXPORT GpuMemoryBuffer { |
62 public: | 62 public: |
63 virtual ~GpuMemoryBuffer() {} | 63 virtual ~GpuMemoryBuffer() {} |
64 | 64 |
65 // Returns the shared memory's handle when the back end is base::SharedMemory. | |
66 // Otherwise, this returns an invalid handle. | |
67 virtual base::SharedMemoryHandle shared_memory_handle() const; | |
reveman
2017/05/30 21:37:01
I don't like to expose implementation specific fun
ssid
2017/05/31 03:35:45
We now have a shared memory tracker which records
reveman
2017/06/01 14:13:45
I prefer this latter approach as it's something th
| |
68 | |
65 // Maps each plane of the buffer into the client's address space so it can be | 69 // Maps each plane of the buffer into the client's address space so it can be |
66 // written to by the CPU. This call may block, for instance if the GPU needs | 70 // written to by the CPU. This call may block, for instance if the GPU needs |
67 // to finish accessing the buffer or if CPU caches need to be synchronized. | 71 // to finish accessing the buffer or if CPU caches need to be synchronized. |
68 // Returns false on failure. | 72 // Returns false on failure. |
69 virtual bool Map() = 0; | 73 virtual bool Map() = 0; |
70 | 74 |
71 // Returns a pointer to the memory address of a plane. Buffer must have been | 75 // Returns a pointer to the memory address of a plane. Buffer must have been |
72 // successfully mapped using a call to Map() before calling this function. | 76 // successfully mapped using a call to Map() before calling this function. |
73 virtual void* memory(size_t plane) = 0; | 77 virtual void* memory(size_t plane) = 0; |
74 | 78 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 | 110 |
107 // Returns an instance of |handle| which can be sent over IPC. This duplicates | 111 // Returns an instance of |handle| which can be sent over IPC. This duplicates |
108 // the file-handles as appropriate, so that the IPC code take ownership of them, | 112 // the file-handles as appropriate, so that the IPC code take ownership of them, |
109 // without invalidating |handle| itself. | 113 // without invalidating |handle| itself. |
110 GFX_EXPORT GpuMemoryBufferHandle | 114 GFX_EXPORT GpuMemoryBufferHandle |
111 CloneHandleForIPC(const GpuMemoryBufferHandle& handle); | 115 CloneHandleForIPC(const GpuMemoryBufferHandle& handle); |
112 | 116 |
113 } // namespace gfx | 117 } // namespace gfx |
114 | 118 |
115 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 119 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
OLD | NEW |