| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/trace_event/memory_dump_provider.h" | 12 #include "base/trace_event/memory_dump_provider.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" | 14 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 using GpuMemoryBufferConfigurationKey = | 18 using GpuMemoryBufferConfigurationKey = |
| 19 std::pair<gfx::BufferFormat, gfx::BufferUsage>; | 19 std::pair<gfx::BufferFormat, gfx::BufferUsage>; |
| 20 using GpuMemoryBufferConfigurationSet = | 20 using GpuMemoryBufferConfigurationSet = |
| 21 base::hash_set<GpuMemoryBufferConfigurationKey>; | 21 base::hash_set<GpuMemoryBufferConfigurationKey>; |
| 22 using GpuMemoryBufferConfigurationList = |
| 23 std::list<GpuMemoryBufferConfigurationKey>; |
| 22 | 24 |
| 23 } // content | 25 } // content |
| 24 | 26 |
| 25 namespace BASE_HASH_NAMESPACE { | 27 namespace BASE_HASH_NAMESPACE { |
| 26 | 28 |
| 27 template <> | 29 template <> |
| 28 struct hash<content::GpuMemoryBufferConfigurationKey> { | 30 struct hash<content::GpuMemoryBufferConfigurationKey> { |
| 29 size_t operator()(const content::GpuMemoryBufferConfigurationKey& key) const { | 31 size_t operator()(const content::GpuMemoryBufferConfigurationKey& key) const { |
| 30 return base::HashPair(static_cast<int>(key.first), | 32 return base::HashPair(static_cast<int>(key.first), |
| 31 static_cast<int>(key.second)); | 33 static_cast<int>(key.second)); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 base::ProcessHandle child_process_handle, | 88 base::ProcessHandle child_process_handle, |
| 87 int child_client_id, | 89 int child_client_id, |
| 88 const AllocationCallback& callback); | 90 const AllocationCallback& callback); |
| 89 void ChildProcessDeletedGpuMemoryBuffer( | 91 void ChildProcessDeletedGpuMemoryBuffer( |
| 90 gfx::GpuMemoryBufferId id, | 92 gfx::GpuMemoryBufferId id, |
| 91 base::ProcessHandle child_process_handle, | 93 base::ProcessHandle child_process_handle, |
| 92 int child_client_id, | 94 int child_client_id, |
| 93 uint32 sync_point); | 95 uint32 sync_point); |
| 94 void ProcessRemoved(base::ProcessHandle process_handle, int client_id); | 96 void ProcessRemoved(base::ProcessHandle process_handle, int client_id); |
| 95 | 97 |
| 98 GpuMemoryBufferConfigurationList |
| 99 GetNativeGpuMemoryBufferEnabledAndSupported() { return native_enabled_and_
supported_;} |
| 96 private: | 100 private: |
| 97 struct BufferInfo { | 101 struct BufferInfo { |
| 98 BufferInfo() | 102 BufferInfo() |
| 99 : type(gfx::EMPTY_BUFFER), | 103 : type(gfx::EMPTY_BUFFER), |
| 100 format(gfx::BufferFormat::RGBA_8888), | 104 format(gfx::BufferFormat::RGBA_8888), |
| 101 usage(gfx::BufferUsage::MAP), | 105 usage(gfx::BufferUsage::MAP), |
| 102 gpu_host_id(0) {} | 106 gpu_host_id(0) {} |
| 103 BufferInfo(const gfx::Size& size, | 107 BufferInfo(const gfx::Size& size, |
| 104 gfx::GpuMemoryBufferType type, | 108 gfx::GpuMemoryBufferType type, |
| 105 gfx::BufferFormat format, | 109 gfx::BufferFormat format, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 bool reused_gpu_process, | 166 bool reused_gpu_process, |
| 163 const CreateCallback& callback, | 167 const CreateCallback& callback, |
| 164 const gfx::GpuMemoryBufferHandle& handle); | 168 const gfx::GpuMemoryBufferHandle& handle); |
| 165 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, | 169 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, |
| 166 int client_id, | 170 int client_id, |
| 167 uint32 sync_point); | 171 uint32 sync_point); |
| 168 | 172 |
| 169 uint64_t ClientIdToTracingProcessId(int client_id) const; | 173 uint64_t ClientIdToTracingProcessId(int client_id) const; |
| 170 | 174 |
| 171 const GpuMemoryBufferConfigurationSet native_configurations_; | 175 const GpuMemoryBufferConfigurationSet native_configurations_; |
| 176 const GpuMemoryBufferConfigurationList native_enabled_and_supported_; |
| 172 const int gpu_client_id_; | 177 const int gpu_client_id_; |
| 173 const uint64_t gpu_client_tracing_id_; | 178 const uint64_t gpu_client_tracing_id_; |
| 174 | 179 |
| 175 // The GPU process host ID. This should only be accessed on the IO thread. | 180 // The GPU process host ID. This should only be accessed on the IO thread. |
| 176 int gpu_host_id_; | 181 int gpu_host_id_; |
| 177 | 182 |
| 178 // Stores info about buffers for all clients. This should only be accessed | 183 // Stores info about buffers for all clients. This should only be accessed |
| 179 // on the IO thread. | 184 // on the IO thread. |
| 180 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>; | 185 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>; |
| 181 using ClientMap = base::hash_map<int, BufferMap>; | 186 using ClientMap = base::hash_map<int, BufferMap>; |
| 182 ClientMap clients_; | 187 ClientMap clients_; |
| 183 | 188 |
| 184 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager); | 189 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager); |
| 185 }; | 190 }; |
| 186 | 191 |
| 187 } // namespace content | 192 } // namespace content |
| 188 | 193 |
| 189 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ | 194 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ |
| OLD | NEW |