| 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_OZONE_NATIVE_PIXMAP_H_ | |
| 6 #define GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_PIXMAP_H_ | |
| 7 | |
| 8 #include <unordered_map> | |
| 9 #include <utility> | |
| 10 | |
| 11 #include "base/hash.h" | |
| 12 #include "base/macros.h" | |
| 13 #include "base/synchronization/lock.h" | |
| 14 #include "gpu/command_buffer/service/image_factory.h" | |
| 15 #include "gpu/gpu_export.h" | |
| 16 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | |
| 17 #include "ui/gfx/native_pixmap.h" | |
| 18 | |
| 19 namespace gl { | |
| 20 class GLImage; | |
| 21 } | |
| 22 | |
| 23 namespace gpu { | |
| 24 | |
| 25 class GPU_EXPORT GpuMemoryBufferFactoryOzoneNativePixmap | |
| 26 : public GpuMemoryBufferFactory, | |
| 27 public ImageFactory { | |
| 28 public: | |
| 29 GpuMemoryBufferFactoryOzoneNativePixmap(); | |
| 30 ~GpuMemoryBufferFactoryOzoneNativePixmap() override; | |
| 31 | |
| 32 // Overridden from GpuMemoryBufferFactory: | |
| 33 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | |
| 34 gfx::GpuMemoryBufferId id, | |
| 35 const gfx::Size& size, | |
| 36 gfx::BufferFormat format, | |
| 37 gfx::BufferUsage usage, | |
| 38 int client_id, | |
| 39 SurfaceHandle surface_handle) override; | |
| 40 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | |
| 41 int client_id) override; | |
| 42 ImageFactory* AsImageFactory() override; | |
| 43 | |
| 44 // Overridden from ImageFactory: | |
| 45 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( | |
| 46 const gfx::GpuMemoryBufferHandle& handle, | |
| 47 const gfx::Size& size, | |
| 48 gfx::BufferFormat format, | |
| 49 unsigned internalformat, | |
| 50 int client_id, | |
| 51 SurfaceHandle surface_handle) override; | |
| 52 scoped_refptr<gl::GLImage> CreateAnonymousImage( | |
| 53 const gfx::Size& size, | |
| 54 gfx::BufferFormat format, | |
| 55 unsigned internalformat) override; | |
| 56 unsigned RequiredTextureType() override; | |
| 57 | |
| 58 private: | |
| 59 using NativePixmapMapKey = std::pair<int, int>; | |
| 60 using NativePixmapMapKeyHash = base::IntPairHash<NativePixmapMapKey>; | |
| 61 using NativePixmapMap = std::unordered_map<NativePixmapMapKey, | |
| 62 scoped_refptr<gfx::NativePixmap>, | |
| 63 NativePixmapMapKeyHash>; | |
| 64 NativePixmapMap native_pixmaps_; | |
| 65 base::Lock native_pixmaps_lock_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryOzoneNativePixmap); | |
| 68 }; | |
| 69 | |
| 70 } // namespace gpu | |
| 71 | |
| 72 #endif // GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_PIXMAP_H_ | |
| OLD | NEW |