| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_PIXMAP_H_ | 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_ | 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_PIXMAP_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/synchronization/lock.h" |
| 9 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 10 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
| 10 #include "gpu/command_buffer/service/image_factory.h" | 11 #include "gpu/command_buffer/service/image_factory.h" |
| 11 #include "ui/gfx/geometry/size.h" | 12 #include "ui/ozone/public/native_pixmap.h" |
| 12 #include "ui/gfx/gpu_memory_buffer.h" | |
| 13 #include "ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.h" | |
| 14 | 13 |
| 15 namespace gfx { | 14 namespace gfx { |
| 16 class GLImage; | 15 class GLImage; |
| 17 } | 16 } |
| 18 | 17 |
| 19 namespace content { | 18 namespace content { |
| 20 | 19 |
| 21 class GpuMemoryBufferFactoryOzoneNativePixmap : public GpuMemoryBufferFactory, | 20 class GpuMemoryBufferFactoryOzoneNativePixmap : public GpuMemoryBufferFactory, |
| 22 public gpu::ImageFactory { | 21 public gpu::ImageFactory { |
| 23 public: | 22 public: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 | 43 |
| 45 // Overridden from gpu::ImageFactory: | 44 // Overridden from gpu::ImageFactory: |
| 46 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( | 45 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( |
| 47 const gfx::GpuMemoryBufferHandle& handle, | 46 const gfx::GpuMemoryBufferHandle& handle, |
| 48 const gfx::Size& size, | 47 const gfx::Size& size, |
| 49 gfx::GpuMemoryBuffer::Format format, | 48 gfx::GpuMemoryBuffer::Format format, |
| 50 unsigned internalformat, | 49 unsigned internalformat, |
| 51 int client_id) override; | 50 int client_id) override; |
| 52 | 51 |
| 53 private: | 52 private: |
| 54 ui::GpuMemoryBufferFactoryOzoneNativePixmap ozone_native_pixmap_factory_; | 53 using NativePixmapMapKey = std::pair<int, int>; |
| 54 using NativePixmapMap = |
| 55 base::hash_map<NativePixmapMapKey, scoped_refptr<ui::NativePixmap>>; |
| 56 NativePixmapMap native_pixmaps_; |
| 57 base::Lock native_pixmaps_lock_; |
| 55 | 58 |
| 56 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryOzoneNativePixmap); | 59 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryOzoneNativePixmap); |
| 57 }; | 60 }; |
| 58 | 61 |
| 59 } // namespace content | 62 } // namespace content |
| 60 | 63 |
| 61 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_PIXMAP_H_ | 64 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_PIXMAP_H_ |
| OLD | NEW |