| 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> | 8 #include <utility> |
| 9 | 9 |
| 10 #include <IOSurface/IOSurface.h> | 10 #include <IOSurface/IOSurface.h> |
| 11 | 11 |
| 12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
| 13 #include "base/mac/scoped_cftyperef.h" | 13 #include "base/mac/scoped_cftyperef.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 17 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
| 18 #include "content/common/mac/io_surface_manager.h" | 18 #include "content/common/mac/io_surface_manager.h" |
| 19 #include "gpu/command_buffer/service/image_factory.h" | 19 #include "gpu/command_buffer/service/image_factory.h" |
| 20 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
| 21 #include "ui/gfx/gpu_memory_buffer.h" | 21 #include "ui/gfx/gpu_memory_buffer.h" |
| 22 | 22 |
| 23 namespace gfx { | 23 namespace gl { |
| 24 class GLImage; | 24 class GLImage; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 class CONTENT_EXPORT GpuMemoryBufferFactoryIOSurface | 29 class CONTENT_EXPORT GpuMemoryBufferFactoryIOSurface |
| 30 : public GpuMemoryBufferFactory, | 30 : public GpuMemoryBufferFactory, |
| 31 public gpu::ImageFactory { | 31 public gpu::ImageFactory { |
| 32 public: | 32 public: |
| 33 GpuMemoryBufferFactoryIOSurface(); | 33 GpuMemoryBufferFactoryIOSurface(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 51 const gfx::GpuMemoryBufferHandle& handle, | 51 const gfx::GpuMemoryBufferHandle& handle, |
| 52 gfx::GpuMemoryBufferId id, | 52 gfx::GpuMemoryBufferId id, |
| 53 const gfx::Size& size, | 53 const gfx::Size& size, |
| 54 gfx::BufferFormat format, | 54 gfx::BufferFormat format, |
| 55 int client_id) override; | 55 int client_id) override; |
| 56 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 56 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 57 int client_id) override; | 57 int client_id) override; |
| 58 gpu::ImageFactory* AsImageFactory() override; | 58 gpu::ImageFactory* AsImageFactory() override; |
| 59 | 59 |
| 60 // Overridden from gpu::ImageFactory: | 60 // Overridden from gpu::ImageFactory: |
| 61 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( | 61 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( |
| 62 const gfx::GpuMemoryBufferHandle& handle, | 62 const gfx::GpuMemoryBufferHandle& handle, |
| 63 const gfx::Size& size, | 63 const gfx::Size& size, |
| 64 gfx::BufferFormat format, | 64 gfx::BufferFormat format, |
| 65 unsigned internalformat, | 65 unsigned internalformat, |
| 66 int client_id) override; | 66 int client_id) override; |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 typedef std::pair<IOSurfaceId, int> IOSurfaceMapKey; | 69 typedef std::pair<IOSurfaceId, int> IOSurfaceMapKey; |
| 70 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>> | 70 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>> |
| 71 IOSurfaceMap; | 71 IOSurfaceMap; |
| 72 IOSurfaceMap io_surfaces_; | 72 IOSurfaceMap io_surfaces_; |
| 73 base::Lock io_surfaces_lock_; | 73 base::Lock io_surfaces_lock_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); | 75 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace content | 78 } // namespace content |
| 79 | 79 |
| 80 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ | 80 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ |
| OLD | NEW |