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 <vector> | 8 #include <set> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/trace_event/memory_dump_provider.h" | 11 #include "base/trace_event/memory_dump_provider.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "content/common/gpu/gpu_memory_buffer_factory.h" | |
14 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" | 13 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" |
15 | 14 |
16 namespace content { | 15 namespace content { |
17 | 16 |
17 using GpuMemoryBufferConfiguration = | |
18 std::pair<gfx::BufferFormat, gfx::BufferUsage>; | |
19 using GpuMemoryBufferConfigurationSet = std::set<GpuMemoryBufferConfiguration>; | |
piman
2015/10/07 01:20:17
nit: hash_set?
reveman
2015/10/07 09:05:01
Done.
| |
20 | |
18 class CONTENT_EXPORT BrowserGpuMemoryBufferManager | 21 class CONTENT_EXPORT BrowserGpuMemoryBufferManager |
19 : public gpu::GpuMemoryBufferManager, | 22 : public gpu::GpuMemoryBufferManager, |
20 public base::trace_event::MemoryDumpProvider { | 23 public base::trace_event::MemoryDumpProvider { |
21 public: | 24 public: |
22 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> | 25 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> |
23 AllocationCallback; | 26 AllocationCallback; |
24 | 27 |
25 BrowserGpuMemoryBufferManager(int gpu_client_id, | 28 BrowserGpuMemoryBufferManager(int gpu_client_id, |
26 uint64_t gpu_client_tracing_id); | 29 uint64_t gpu_client_tracing_id); |
27 ~BrowserGpuMemoryBufferManager() override; | 30 ~BrowserGpuMemoryBufferManager() override; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 gfx::BufferUsage usage; | 93 gfx::BufferUsage usage; |
91 int gpu_host_id; | 94 int gpu_host_id; |
92 }; | 95 }; |
93 struct AllocateGpuMemoryBufferRequest; | 96 struct AllocateGpuMemoryBufferRequest; |
94 | 97 |
95 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBufferForSurface( | 98 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBufferForSurface( |
96 const gfx::Size& size, | 99 const gfx::Size& size, |
97 gfx::BufferFormat format, | 100 gfx::BufferFormat format, |
98 gfx::BufferUsage usage, | 101 gfx::BufferUsage usage, |
99 int32 surface_id); | 102 int32 surface_id); |
100 bool IsGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format, | 103 bool IsNativeGpuMemoryBufferConfiguration(gfx::BufferFormat format, |
101 gfx::BufferUsage usage) const; | 104 gfx::BufferUsage usage) const; |
102 void AllocateGpuMemoryBufferForSurfaceOnIO( | 105 void AllocateGpuMemoryBufferForSurfaceOnIO( |
103 AllocateGpuMemoryBufferRequest* request); | 106 AllocateGpuMemoryBufferRequest* request); |
104 void GpuMemoryBufferAllocatedForSurfaceOnIO( | 107 void GpuMemoryBufferAllocatedForSurfaceOnIO( |
105 AllocateGpuMemoryBufferRequest* request, | 108 AllocateGpuMemoryBufferRequest* request, |
106 const gfx::GpuMemoryBufferHandle& handle); | 109 const gfx::GpuMemoryBufferHandle& handle); |
107 void AllocateGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, | 110 void AllocateGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, |
108 const gfx::Size& size, | 111 const gfx::Size& size, |
109 gfx::BufferFormat format, | 112 gfx::BufferFormat format, |
110 gfx::BufferUsage usage, | 113 gfx::BufferUsage usage, |
111 int client_id, | 114 int client_id, |
112 int surface_id, | 115 int surface_id, |
113 bool reused_gpu_process, | 116 bool reused_gpu_process, |
114 const AllocationCallback& callback); | 117 const AllocationCallback& callback); |
115 void GpuMemoryBufferAllocatedOnIO(gfx::GpuMemoryBufferId id, | 118 void GpuMemoryBufferAllocatedOnIO(gfx::GpuMemoryBufferId id, |
116 int client_id, | 119 int client_id, |
117 int surface_id, | 120 int surface_id, |
118 int gpu_host_id, | 121 int gpu_host_id, |
119 bool reused_gpu_process, | 122 bool reused_gpu_process, |
120 const AllocationCallback& callback, | 123 const AllocationCallback& callback, |
121 const gfx::GpuMemoryBufferHandle& handle); | 124 const gfx::GpuMemoryBufferHandle& handle); |
122 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, | 125 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, |
123 int client_id, | 126 int client_id, |
124 uint32 sync_point); | 127 uint32 sync_point); |
125 | 128 |
126 uint64_t ClientIdToTracingProcessId(int client_id) const; | 129 uint64_t ClientIdToTracingProcessId(int client_id) const; |
127 | 130 |
128 const gfx::GpuMemoryBufferType factory_type_; | 131 const GpuMemoryBufferConfigurationSet native_configurations_; |
129 const std::vector<GpuMemoryBufferFactory::Configuration> | |
130 supported_configurations_; | |
131 const int gpu_client_id_; | 132 const int gpu_client_id_; |
132 const uint64_t gpu_client_tracing_id_; | 133 const uint64_t gpu_client_tracing_id_; |
133 | 134 |
134 // The GPU process host ID. This should only be accessed on the IO thread. | 135 // The GPU process host ID. This should only be accessed on the IO thread. |
135 int gpu_host_id_; | 136 int gpu_host_id_; |
136 | 137 |
137 // Stores info about buffers for all clients. This should only be accessed | 138 // Stores info about buffers for all clients. This should only be accessed |
138 // on the IO thread. | 139 // on the IO thread. |
139 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>; | 140 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>; |
140 using ClientMap = base::hash_map<int, BufferMap>; | 141 using ClientMap = base::hash_map<int, BufferMap>; |
141 ClientMap clients_; | 142 ClientMap clients_; |
142 | 143 |
143 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager); | 144 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager); |
144 }; | 145 }; |
145 | 146 |
146 } // namespace content | 147 } // namespace content |
147 | 148 |
148 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ | 149 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ |
OLD | NEW |