| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_GPU_MEMORY_BUFFER_MANAGER_H_ | 5 #ifndef COMPONENTS_MUS_GPU_MUS_GPU_MEMORY_BUFFER_MANAGER_H_ |
| 6 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_GPU_MEMORY_BUFFER_MANAGER_H_ | 6 #define COMPONENTS_MUS_GPU_MUS_GPU_MEMORY_BUFFER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 11 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" | 12 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" |
| 12 | 13 |
| 13 namespace blimp { | 14 namespace mus { |
| 14 namespace client { | |
| 15 | 15 |
| 16 class BlimpGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager { | 16 // This GpuMemoryBufferManager is for establishing a GpuChannelHost used by |
| 17 // mus locally. |
| 18 class MusGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager { |
| 17 public: | 19 public: |
| 18 BlimpGpuMemoryBufferManager(); | 20 explicit MusGpuMemoryBufferManager(int client_id); |
| 19 ~BlimpGpuMemoryBufferManager() override; | 21 ~MusGpuMemoryBufferManager() override; |
| 22 |
| 23 static MusGpuMemoryBufferManager* current(); |
| 20 | 24 |
| 21 // Overridden from gpu::GpuMemoryBufferManager: | 25 // Overridden from gpu::GpuMemoryBufferManager: |
| 22 std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 26 std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
| 23 const gfx::Size& size, | 27 const gfx::Size& size, |
| 24 gfx::BufferFormat format, | 28 gfx::BufferFormat format, |
| 25 gfx::BufferUsage usage, | 29 gfx::BufferUsage usage, |
| 26 gpu::SurfaceHandle surface_handle) override; | 30 gpu::SurfaceHandle surface_handle) override; |
| 27 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle( | 31 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle( |
| 28 const gfx::GpuMemoryBufferHandle& handle, | 32 const gfx::GpuMemoryBufferHandle& handle, |
| 29 const gfx::Size& size, | 33 const gfx::Size& size, |
| 30 gfx::BufferFormat format) override; | 34 gfx::BufferFormat format) override; |
| 31 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromClientId( | 35 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromClientId( |
| 32 int client_id, | 36 int client_id, |
| 33 const gfx::GpuMemoryBufferId& gpu_memory_buffer_id) override; | 37 const gfx::GpuMemoryBufferId& gpu_memory_buffer_id) override; |
| 34 gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer( | 38 gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer( |
| 35 ClientBuffer buffer) override; | 39 ClientBuffer buffer) override; |
| 36 void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer, | 40 void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer, |
| 37 const gpu::SyncToken& sync_token) override; | 41 const gpu::SyncToken& sync_token) override; |
| 38 | 42 |
| 39 private: | 43 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(BlimpGpuMemoryBufferManager); | 44 DISALLOW_COPY_AND_ASSIGN(MusGpuMemoryBufferManager); |
| 45 |
| 46 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 47 int client_id, |
| 48 bool is_native, |
| 49 const gpu::SyncToken& sync_token); |
| 50 |
| 51 const int client_id_; |
| 52 base::WeakPtrFactory<MusGpuMemoryBufferManager> weak_factory_; |
| 41 }; | 53 }; |
| 42 | 54 |
| 43 } // namespace client | 55 } // namespace mus |
| 44 } // namespace blimp | |
| 45 | 56 |
| 46 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_GPU_MEMORY_BUFFER_MANAGER_H_ | 57 #endif // COMPONENTS_MUS_GPU_MUS_GPU_MEMORY_BUFFER_MANAGER_H_ |
| OLD | NEW |