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