| 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 <IOSurface/IOSurface.h> | 8 #include <IOSurface/IOSurface.h> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| 25 class GpuMemoryBufferFactoryIOSurface : public GpuMemoryBufferFactory, | 25 class GpuMemoryBufferFactoryIOSurface : public GpuMemoryBufferFactory, |
| 26 public gpu::ImageFactory { | 26 public gpu::ImageFactory { |
| 27 public: | 27 public: |
| 28 GpuMemoryBufferFactoryIOSurface(); | 28 GpuMemoryBufferFactoryIOSurface(); |
| 29 ~GpuMemoryBufferFactoryIOSurface() override; | 29 ~GpuMemoryBufferFactoryIOSurface() override; |
| 30 | 30 |
| 31 static bool IsGpuMemoryBufferConfigurationSupported( | 31 static bool IsGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format, |
| 32 gfx::GpuMemoryBuffer::Format format, | 32 gfx::BufferUsage usage); |
| 33 gfx::GpuMemoryBuffer::Usage usage); | |
| 34 | 33 |
| 35 // Overridden from GpuMemoryBufferFactory: | 34 // Overridden from GpuMemoryBufferFactory: |
| 36 void GetSupportedGpuMemoryBufferConfigurations( | 35 void GetSupportedGpuMemoryBufferConfigurations( |
| 37 std::vector<Configuration>* configurations) override; | 36 std::vector<Configuration>* configurations) override; |
| 38 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | 37 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
| 39 gfx::GpuMemoryBufferId id, | 38 gfx::GpuMemoryBufferId id, |
| 40 const gfx::Size& size, | 39 const gfx::Size& size, |
| 41 gfx::GpuMemoryBuffer::Format format, | 40 gfx::BufferFormat format, |
| 42 gfx::GpuMemoryBuffer::Usage usage, | 41 gfx::BufferUsage usage, |
| 43 int client_id, | 42 int client_id, |
| 44 gfx::PluginWindowHandle surface_handle) override; | 43 gfx::PluginWindowHandle surface_handle) override; |
| 45 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 44 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 46 int client_id) override; | 45 int client_id) override; |
| 47 gpu::ImageFactory* AsImageFactory() override; | 46 gpu::ImageFactory* AsImageFactory() override; |
| 48 | 47 |
| 49 // Overridden from gpu::ImageFactory: | 48 // Overridden from gpu::ImageFactory: |
| 50 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( | 49 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( |
| 51 const gfx::GpuMemoryBufferHandle& handle, | 50 const gfx::GpuMemoryBufferHandle& handle, |
| 52 const gfx::Size& size, | 51 const gfx::Size& size, |
| 53 gfx::GpuMemoryBuffer::Format format, | 52 gfx::BufferFormat format, |
| 54 unsigned internalformat, | 53 unsigned internalformat, |
| 55 int client_id) override; | 54 int client_id) override; |
| 56 | 55 |
| 57 private: | 56 private: |
| 58 typedef std::pair<int, int> IOSurfaceMapKey; | 57 typedef std::pair<int, int> IOSurfaceMapKey; |
| 59 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>> | 58 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>> |
| 60 IOSurfaceMap; | 59 IOSurfaceMap; |
| 61 IOSurfaceMap io_surfaces_; | 60 IOSurfaceMap io_surfaces_; |
| 62 base::Lock io_surfaces_lock_; | 61 base::Lock io_surfaces_lock_; |
| 63 | 62 |
| 64 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); | 63 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 } // namespace content | 66 } // namespace content |
| 68 | 67 |
| 69 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ | 68 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ |
| OLD | NEW |