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 <vector> |
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" | 13 #include "content/common/gpu/gpu_memory_buffer_factory.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 class CONTENT_EXPORT BrowserGpuMemoryBufferManager | 18 class CONTENT_EXPORT BrowserGpuMemoryBufferManager |
19 : public gpu::GpuMemoryBufferManager, | 19 : public gpu::GpuMemoryBufferManager, |
20 public base::trace_event::MemoryDumpProvider { | 20 public base::trace_event::MemoryDumpProvider { |
21 public: | 21 public: |
22 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> | 22 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> |
23 AllocationCallback; | 23 AllocationCallback; |
24 | 24 |
25 explicit BrowserGpuMemoryBufferManager(int gpu_client_id); | 25 BrowserGpuMemoryBufferManager(int gpu_client_id, |
| 26 uint64_t gpu_client_tracing_id); |
26 ~BrowserGpuMemoryBufferManager() override; | 27 ~BrowserGpuMemoryBufferManager() override; |
27 | 28 |
28 static BrowserGpuMemoryBufferManager* current(); | 29 static BrowserGpuMemoryBufferManager* current(); |
29 | 30 |
30 static uint32 GetImageTextureTarget(gfx::BufferFormat format, | 31 static uint32 GetImageTextureTarget(gfx::BufferFormat format, |
31 gfx::BufferUsage usage); | 32 gfx::BufferUsage usage); |
32 | 33 |
33 // Overridden from gpu::GpuMemoryBufferManager: | 34 // Overridden from gpu::GpuMemoryBufferManager: |
34 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 35 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
35 const gfx::Size& size, | 36 const gfx::Size& size, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 int client_id, | 114 int client_id, |
114 int surface_id, | 115 int surface_id, |
115 int gpu_host_id, | 116 int gpu_host_id, |
116 bool reused_gpu_process, | 117 bool reused_gpu_process, |
117 const AllocationCallback& callback, | 118 const AllocationCallback& callback, |
118 const gfx::GpuMemoryBufferHandle& handle); | 119 const gfx::GpuMemoryBufferHandle& handle); |
119 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, | 120 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, |
120 int client_id, | 121 int client_id, |
121 uint32 sync_point); | 122 uint32 sync_point); |
122 | 123 |
| 124 uint64_t ClientIdToTracingProcessId(int client_id) const; |
| 125 |
123 const gfx::GpuMemoryBufferType factory_type_; | 126 const gfx::GpuMemoryBufferType factory_type_; |
124 const std::vector<GpuMemoryBufferFactory::Configuration> | 127 const std::vector<GpuMemoryBufferFactory::Configuration> |
125 supported_configurations_; | 128 supported_configurations_; |
126 const int gpu_client_id_; | 129 const int gpu_client_id_; |
| 130 const uint64_t gpu_client_tracing_id_; |
127 | 131 |
128 // The GPU process host ID. This should only be accessed on the IO thread. | 132 // The GPU process host ID. This should only be accessed on the IO thread. |
129 int gpu_host_id_; | 133 int gpu_host_id_; |
130 | 134 |
131 // Stores info about buffers for all clients. This should only be accessed | 135 // Stores info about buffers for all clients. This should only be accessed |
132 // on the IO thread. | 136 // on the IO thread. |
133 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>; | 137 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>; |
134 using ClientMap = base::hash_map<int, BufferMap>; | 138 using ClientMap = base::hash_map<int, BufferMap>; |
135 ClientMap clients_; | 139 ClientMap clients_; |
136 | 140 |
137 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager); | 141 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager); |
138 }; | 142 }; |
139 | 143 |
140 } // namespace content | 144 } // namespace content |
141 | 145 |
142 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ | 146 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ |
OLD | NEW |