| 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_IO_SURFACE_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ |
| 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ | 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ |
| 7 | 7 |
| 8 #include <utility> |
| 9 |
| 8 #include <IOSurface/IOSurface.h> | 10 #include <IOSurface/IOSurface.h> |
| 9 | 11 |
| 10 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
| 11 #include "base/mac/scoped_cftyperef.h" | 13 #include "base/mac/scoped_cftyperef.h" |
| 12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 13 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "content/common/content_export.h" |
| 14 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 17 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
| 15 #include "content/common/mac/io_surface_manager.h" | 18 #include "content/common/mac/io_surface_manager.h" |
| 16 #include "gpu/command_buffer/service/image_factory.h" | 19 #include "gpu/command_buffer/service/image_factory.h" |
| 17 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
| 18 #include "ui/gfx/gpu_memory_buffer.h" | 21 #include "ui/gfx/gpu_memory_buffer.h" |
| 19 | 22 |
| 20 namespace gfx { | 23 namespace gfx { |
| 21 class GLImage; | 24 class GLImage; |
| 22 } | 25 } |
| 23 | 26 |
| 24 namespace content { | 27 namespace content { |
| 25 | 28 |
| 26 class GpuMemoryBufferFactoryIOSurface : public GpuMemoryBufferFactory, | 29 class CONTENT_EXPORT GpuMemoryBufferFactoryIOSurface |
| 27 public gpu::ImageFactory { | 30 : public GpuMemoryBufferFactory, |
| 31 public gpu::ImageFactory { |
| 28 public: | 32 public: |
| 29 GpuMemoryBufferFactoryIOSurface(); | 33 GpuMemoryBufferFactoryIOSurface(); |
| 30 ~GpuMemoryBufferFactoryIOSurface() override; | 34 ~GpuMemoryBufferFactoryIOSurface() override; |
| 31 | 35 |
| 32 static bool IsGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format, | 36 static bool IsGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format, |
| 33 gfx::BufferUsage usage); | 37 gfx::BufferUsage usage); |
| 34 | 38 |
| 39 static IOSurfaceRef CreateIOSurface(const gfx::Size& size, |
| 40 gfx::BufferFormat format); |
| 41 |
| 35 // Overridden from GpuMemoryBufferFactory: | 42 // Overridden from GpuMemoryBufferFactory: |
| 36 void GetSupportedGpuMemoryBufferConfigurations( | |
| 37 std::vector<Configuration>* configurations) override; | |
| 38 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | 43 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
| 39 gfx::GpuMemoryBufferId id, | 44 gfx::GpuMemoryBufferId id, |
| 40 const gfx::Size& size, | 45 const gfx::Size& size, |
| 41 gfx::BufferFormat format, | 46 gfx::BufferFormat format, |
| 42 gfx::BufferUsage usage, | 47 gfx::BufferUsage usage, |
| 43 int client_id, | 48 int client_id, |
| 44 gfx::PluginWindowHandle surface_handle) override; | 49 gfx::PluginWindowHandle surface_handle) override; |
| 45 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 50 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 46 int client_id) override; | 51 int client_id) override; |
| 47 gpu::ImageFactory* AsImageFactory() override; | 52 gpu::ImageFactory* AsImageFactory() override; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 60 IOSurfaceMap; | 65 IOSurfaceMap; |
| 61 IOSurfaceMap io_surfaces_; | 66 IOSurfaceMap io_surfaces_; |
| 62 base::Lock io_surfaces_lock_; | 67 base::Lock io_surfaces_lock_; |
| 63 | 68 |
| 64 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); | 69 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); |
| 65 }; | 70 }; |
| 66 | 71 |
| 67 } // namespace content | 72 } // namespace content |
| 68 | 73 |
| 69 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ | 74 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ |
| OLD | NEW |