| 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 class GpuServiceMus; |
| 17 |
| 18 // This GpuMemoryBufferManager is for establishing a GpuChannelHost used by |
| 19 // mus locally. |
| 20 class MusGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager { |
| 17 public: | 21 public: |
| 18 BlimpGpuMemoryBufferManager(); | 22 MusGpuMemoryBufferManager(GpuServiceMus* gpu_service, int client_id); |
| 19 ~BlimpGpuMemoryBufferManager() override; | 23 ~MusGpuMemoryBufferManager() override; |
| 24 |
| 25 static MusGpuMemoryBufferManager* current(); |
| 20 | 26 |
| 21 // Overridden from gpu::GpuMemoryBufferManager: | 27 // Overridden from gpu::GpuMemoryBufferManager: |
| 22 std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 28 std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
| 23 const gfx::Size& size, | 29 const gfx::Size& size, |
| 24 gfx::BufferFormat format, | 30 gfx::BufferFormat format, |
| 25 gfx::BufferUsage usage, | 31 gfx::BufferUsage usage, |
| 26 gpu::SurfaceHandle surface_handle) override; | 32 gpu::SurfaceHandle surface_handle) override; |
| 27 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle( | 33 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle( |
| 28 const gfx::GpuMemoryBufferHandle& handle, | 34 const gfx::GpuMemoryBufferHandle& handle, |
| 29 const gfx::Size& size, | 35 const gfx::Size& size, |
| 30 gfx::BufferFormat format) override; | 36 gfx::BufferFormat format) override; |
| 31 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromClientId( | 37 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromClientId( |
| 32 int client_id, | 38 int client_id, |
| 33 const gfx::GpuMemoryBufferId& gpu_memory_buffer_id) override; | 39 const gfx::GpuMemoryBufferId& gpu_memory_buffer_id) override; |
| 34 gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer( | 40 gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer( |
| 35 ClientBuffer buffer) override; | 41 ClientBuffer buffer) override; |
| 36 void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer, | 42 void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer, |
| 37 const gpu::SyncToken& sync_token) override; | 43 const gpu::SyncToken& sync_token) override; |
| 38 | 44 |
| 39 private: | 45 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(BlimpGpuMemoryBufferManager); | 46 DISALLOW_COPY_AND_ASSIGN(MusGpuMemoryBufferManager); |
| 47 |
| 48 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 49 int client_id, |
| 50 bool is_native, |
| 51 const gpu::SyncToken& sync_token); |
| 52 |
| 53 GpuServiceMus* gpu_service_; |
| 54 const int client_id_; |
| 55 base::WeakPtrFactory<MusGpuMemoryBufferManager> weak_factory_; |
| 41 }; | 56 }; |
| 42 | 57 |
| 43 } // namespace client | 58 } // namespace mus |
| 44 } // namespace blimp | |
| 45 | 59 |
| 46 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_GPU_MEMORY_BUFFER_MANAGER_H_ | 60 #endif // COMPONENTS_MUS_GPU_MUS_GPU_MEMORY_BUFFER_MANAGER_H_ |
| OLD | NEW |