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 #ifndef CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ | 6 #define CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| 25 using GpuMemoryBufferConfigurationKey = | 25 using GpuMemoryBufferConfigurationKey = |
| 26 std::pair<gfx::BufferFormat, gfx::BufferUsage>; | 26 std::pair<gfx::BufferFormat, gfx::BufferUsage>; |
| 27 using GpuMemoryBufferConfigurationSet = | 27 using GpuMemoryBufferConfigurationSet = |
| 28 base::hash_set<GpuMemoryBufferConfigurationKey>; | 28 base::hash_set<GpuMemoryBufferConfigurationKey>; |
| 29 | 29 |
| 30 } // content | 30 } // content |
| 31 | 31 |
| 32 namespace gpu { | |
| 33 class GpuMemoryBufferImpl; | |
| 34 } // gpu | |
| 35 | |
| 32 namespace BASE_HASH_NAMESPACE { | 36 namespace BASE_HASH_NAMESPACE { |
| 33 | 37 |
| 34 template <> | 38 template <> |
| 35 struct hash<content::GpuMemoryBufferConfigurationKey> { | 39 struct hash<content::GpuMemoryBufferConfigurationKey> { |
| 36 size_t operator()(const content::GpuMemoryBufferConfigurationKey& key) const { | 40 size_t operator()(const content::GpuMemoryBufferConfigurationKey& key) const { |
| 37 return base::HashInts(static_cast<int>(key.first), | 41 return base::HashInts(static_cast<int>(key.first), |
| 38 static_cast<int>(key.second)); | 42 static_cast<int>(key.second)); |
| 39 } | 43 } |
| 40 }; | 44 }; |
| 41 | 45 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 gfx::BufferUsage usage) const; | 108 gfx::BufferUsage usage) const; |
| 105 | 109 |
| 106 private: | 110 private: |
| 107 struct BufferInfo { | 111 struct BufferInfo { |
| 108 BufferInfo(); | 112 BufferInfo(); |
| 109 BufferInfo(const gfx::Size& size, | 113 BufferInfo(const gfx::Size& size, |
| 110 gfx::GpuMemoryBufferType type, | 114 gfx::GpuMemoryBufferType type, |
| 111 gfx::BufferFormat format, | 115 gfx::BufferFormat format, |
| 112 gfx::BufferUsage usage, | 116 gfx::BufferUsage usage, |
| 113 int gpu_host_id); | 117 int gpu_host_id); |
| 114 BufferInfo(const BufferInfo& other); | 118 BufferInfo(BufferInfo&& other); |
| 115 ~BufferInfo(); | 119 ~BufferInfo(); |
| 116 | 120 |
| 117 gfx::Size size; | 121 gfx::Size size; |
| 118 gfx::GpuMemoryBufferType type = gfx::EMPTY_BUFFER; | 122 gfx::GpuMemoryBufferType type = gfx::EMPTY_BUFFER; |
| 119 gfx::BufferFormat format = gfx::BufferFormat::RGBA_8888; | 123 gfx::BufferFormat format = gfx::BufferFormat::RGBA_8888; |
| 120 gfx::BufferUsage usage = gfx::BufferUsage::GPU_READ; | 124 gfx::BufferUsage usage = gfx::BufferUsage::GPU_READ; |
| 121 int gpu_host_id = 0; | 125 int gpu_host_id = 0; |
| 126 | |
| 127 // For buffers created for a child process, open an instance of the | |
| 128 // buffer in the browser process for future use by | |
| 129 // CreateGpuMemoryBufferFromClientId. | |
| 130 std::unique_ptr<gpu::GpuMemoryBufferImpl> parent_buffer_instance; | |
|
reveman
2016/05/24 22:19:47
This is not just needed for FromClientId. It's nee
ccameron
2016/05/24 22:58:04
Definitely agree with this long-term. Removing the
| |
| 122 }; | 131 }; |
| 123 | 132 |
| 124 struct CreateGpuMemoryBufferRequest; | 133 struct CreateGpuMemoryBufferRequest; |
| 125 struct CreateGpuMemoryBufferFromHandleRequest; | 134 struct CreateGpuMemoryBufferFromHandleRequest; |
| 126 struct CreateGpuMemoryBufferFromClientIdRequest; | 135 struct CreateGpuMemoryBufferFromClientIdRequest; |
| 127 | 136 |
| 128 using CreateDelegate = base::Callback<void(GpuProcessHost* host, | 137 using CreateDelegate = base::Callback<void(GpuProcessHost* host, |
| 129 gfx::GpuMemoryBufferId id, | 138 gfx::GpuMemoryBufferId id, |
| 130 const gfx::Size& size, | 139 const gfx::Size& size, |
| 131 gfx::BufferFormat format, | 140 gfx::BufferFormat format, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>; | 192 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>; |
| 184 using ClientMap = base::hash_map<int, BufferMap>; | 193 using ClientMap = base::hash_map<int, BufferMap>; |
| 185 ClientMap clients_; | 194 ClientMap clients_; |
| 186 | 195 |
| 187 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager); | 196 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager); |
| 188 }; | 197 }; |
| 189 | 198 |
| 190 } // namespace content | 199 } // namespace content |
| 191 | 200 |
| 192 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ | 201 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ |
| OLD | NEW |