| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ | |
| 6 #define GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ | |
| 7 | |
| 8 #include <utility> | |
| 9 | |
| 10 #include "base/containers/hash_tables.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/synchronization/lock.h" | |
| 13 #include "gpu/command_buffer/service/image_factory.h" | |
| 14 #include "gpu/gpu_export.h" | |
| 15 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | |
| 16 #include "ui/gfx/geometry/size.h" | |
| 17 #include "ui/gfx/gpu_memory_buffer.h" | |
| 18 | |
| 19 namespace gfx { | |
| 20 class SurfaceTexture; | |
| 21 } | |
| 22 | |
| 23 namespace gl { | |
| 24 class GLImage; | |
| 25 } | |
| 26 | |
| 27 namespace gpu { | |
| 28 | |
| 29 class GPU_EXPORT GpuMemoryBufferFactorySurfaceTexture | |
| 30 : public GpuMemoryBufferFactory, | |
| 31 public ImageFactory { | |
| 32 public: | |
| 33 GpuMemoryBufferFactorySurfaceTexture(); | |
| 34 ~GpuMemoryBufferFactorySurfaceTexture() override; | |
| 35 | |
| 36 // Overridden from GpuMemoryBufferFactory: | |
| 37 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | |
| 38 gfx::GpuMemoryBufferId id, | |
| 39 const gfx::Size& size, | |
| 40 gfx::BufferFormat format, | |
| 41 gfx::BufferUsage usage, | |
| 42 int client_id, | |
| 43 SurfaceHandle surface_handle) override; | |
| 44 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromHandle( | |
| 45 const gfx::GpuMemoryBufferHandle& handle, | |
| 46 gfx::GpuMemoryBufferId id, | |
| 47 const gfx::Size& size, | |
| 48 gfx::BufferFormat format, | |
| 49 int client_id) override; | |
| 50 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | |
| 51 int client_id) override; | |
| 52 ImageFactory* AsImageFactory() override; | |
| 53 | |
| 54 // Overridden from ImageFactory: | |
| 55 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( | |
| 56 const gfx::GpuMemoryBufferHandle& handle, | |
| 57 const gfx::Size& size, | |
| 58 gfx::BufferFormat format, | |
| 59 unsigned internalformat, | |
| 60 int client_id) override; | |
| 61 | |
| 62 private: | |
| 63 typedef std::pair<int, int> SurfaceTextureMapKey; | |
| 64 typedef base::hash_map<SurfaceTextureMapKey, | |
| 65 scoped_refptr<gfx::SurfaceTexture>> SurfaceTextureMap; | |
| 66 SurfaceTextureMap surface_textures_; | |
| 67 base::Lock surface_textures_lock_; | |
| 68 }; | |
| 69 | |
| 70 } // namespace gpu | |
| 71 | |
| 72 #endif // GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ | |
| OLD | NEW |