| 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_SURFACE_TEXTURE_H_ |
| 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ | 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ |
| 7 | |
| 8 #include <IOSurface/IOSurfaceAPI.h> | |
| 9 | 7 |
| 10 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 11 #include "base/mac/scoped_cftyperef.h" | |
| 12 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 13 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
| 14 #include "ui/gfx/gpu_memory_buffer.h" | 11 #include "ui/gfx/gpu_memory_buffer.h" |
| 15 | 12 |
| 16 namespace gfx { | 13 namespace gfx { |
| 17 class GLImage; | 14 class GLImage; |
| 15 class SurfaceTexture; |
| 18 } | 16 } |
| 19 | 17 |
| 20 namespace content { | 18 namespace content { |
| 21 | 19 |
| 22 class GpuMemoryBufferFactoryIOSurface { | 20 class GpuMemoryBufferFactorySurfaceTexture { |
| 23 public: | 21 public: |
| 24 GpuMemoryBufferFactoryIOSurface(); | 22 GpuMemoryBufferFactorySurfaceTexture(); |
| 25 ~GpuMemoryBufferFactoryIOSurface(); | 23 ~GpuMemoryBufferFactorySurfaceTexture(); |
| 26 | 24 |
| 27 // Creates a IOSurface backed GPU memory buffer with |size| and | 25 // Creates a SurfaceTexture backed GPU memory buffer with |size| and |
| 28 // |internalformat|. A valid handle is returned on success. | 26 // |internalformat|. A valid handle is returned on success. |
| 29 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | 27 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
| 30 const gfx::GpuMemoryBufferId& id, | 28 const gfx::GpuMemoryBufferId& id, |
| 31 const gfx::Size& size, | 29 const gfx::Size& size, |
| 32 unsigned internalformat); | 30 unsigned internalformat); |
| 33 | 31 |
| 34 // Destroy a previously created GPU memory buffer. | 32 // Destroy a previously created GPU memory buffer. |
| 35 void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferId& id); | 33 void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferId& id); |
| 36 | 34 |
| 37 // Creates a GLImage instance for a GPU memory buffer. | 35 // Creates a GLImage instance for a GPU memory buffer. |
| 38 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( | 36 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( |
| 39 const gfx::GpuMemoryBufferId& id, | 37 const gfx::GpuMemoryBufferId& id, |
| 40 const gfx::Size& size, | 38 const gfx::Size& size, |
| 41 unsigned internalformat); | 39 unsigned internalformat); |
| 42 | 40 |
| 43 private: | 41 private: |
| 44 typedef std::pair<int, int> IOSurfaceMapKey; | 42 typedef std::pair<int, int> SurfaceTextureMapKey; |
| 45 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>> | 43 typedef base::hash_map<SurfaceTextureMapKey, |
| 46 IOSurfaceMap; | 44 scoped_refptr<gfx::SurfaceTexture>> SurfaceTextureMap; |
| 47 IOSurfaceMap io_surfaces_; | 45 SurfaceTextureMap surface_textures_; |
| 48 }; | 46 }; |
| 49 | 47 |
| 50 } // namespace content | 48 } // namespace content |
| 51 | 49 |
| 52 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ | 50 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ |
| OLD | NEW |