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