| 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::GpuMemoryBuffer::Format format, | 31 static uint32 GetImageTextureTarget(gfx::GpuMemoryBuffer::Format format, |
| 31 gfx::GpuMemoryBuffer::Usage usage); | 32 gfx::GpuMemoryBuffer::Usage 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 int client_id, | 115 int client_id, |
| 115 int surface_id, | 116 int surface_id, |
| 116 int gpu_host_id, | 117 int gpu_host_id, |
| 117 bool reused_gpu_process, | 118 bool reused_gpu_process, |
| 118 const AllocationCallback& callback, | 119 const AllocationCallback& callback, |
| 119 const gfx::GpuMemoryBufferHandle& handle); | 120 const gfx::GpuMemoryBufferHandle& handle); |
| 120 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, | 121 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, |
| 121 int client_id, | 122 int client_id, |
| 122 uint32 sync_point); | 123 uint32 sync_point); |
| 123 | 124 |
| 125 uint64_t ClientIdToTracingProcessId(int client_id) const; |
| 126 |
| 124 const gfx::GpuMemoryBufferType factory_type_; | 127 const gfx::GpuMemoryBufferType factory_type_; |
| 125 const std::vector<GpuMemoryBufferFactory::Configuration> | 128 const std::vector<GpuMemoryBufferFactory::Configuration> |
| 126 supported_configurations_; | 129 supported_configurations_; |
| 127 const int gpu_client_id_; | 130 const int gpu_client_id_; |
| 131 const uint64_t gpu_client_tracing_id_; |
| 128 | 132 |
| 129 // The GPU process host ID. This should only be accessed on the IO thread. | 133 // The GPU process host ID. This should only be accessed on the IO thread. |
| 130 int gpu_host_id_; | 134 int gpu_host_id_; |
| 131 | 135 |
| 132 // Stores info about buffers for all clients. This should only be accessed | 136 // Stores info about buffers for all clients. This should only be accessed |
| 133 // on the IO thread. | 137 // on the IO thread. |
| 134 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>; | 138 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>; |
| 135 using ClientMap = base::hash_map<int, BufferMap>; | 139 using ClientMap = base::hash_map<int, BufferMap>; |
| 136 ClientMap clients_; | 140 ClientMap clients_; |
| 137 | 141 |
| 138 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager); | 142 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager); |
| 139 }; | 143 }; |
| 140 | 144 |
| 141 } // namespace content | 145 } // namespace content |
| 142 | 146 |
| 143 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ | 147 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ |
| OLD | NEW |