| 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> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 ~GpuMemoryBufferFactoryIOSurface() override; | 35 ~GpuMemoryBufferFactoryIOSurface() override; |
| 36 | 36 |
| 37 // Overridden from GpuMemoryBufferFactory: | 37 // Overridden from GpuMemoryBufferFactory: |
| 38 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | 38 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
| 39 gfx::GpuMemoryBufferId id, | 39 gfx::GpuMemoryBufferId id, |
| 40 const gfx::Size& size, | 40 const gfx::Size& size, |
| 41 gfx::BufferFormat format, | 41 gfx::BufferFormat format, |
| 42 gfx::BufferUsage usage, | 42 gfx::BufferUsage usage, |
| 43 int client_id, | 43 int client_id, |
| 44 gpu::SurfaceHandle surface_handle) override; | 44 gpu::SurfaceHandle surface_handle) override; |
| 45 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromHandle( | |
| 46 const gfx::GpuMemoryBufferHandle& handle, | |
| 47 gfx::GpuMemoryBufferId id, | |
| 48 const gfx::Size& size, | |
| 49 gfx::BufferFormat format, | |
| 50 int client_id) override; | |
| 51 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 45 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 52 int client_id) override; | 46 int client_id) override; |
| 53 gpu::ImageFactory* AsImageFactory() override; | 47 gpu::ImageFactory* AsImageFactory() override; |
| 54 | 48 |
| 55 // Overridden from gpu::ImageFactory: | 49 // Overridden from gpu::ImageFactory: |
| 56 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( | 50 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( |
| 57 const gfx::GpuMemoryBufferHandle& handle, | 51 const gfx::GpuMemoryBufferHandle& handle, |
| 58 const gfx::Size& size, | 52 const gfx::Size& size, |
| 59 gfx::BufferFormat format, | 53 gfx::BufferFormat format, |
| 60 unsigned internalformat, | 54 unsigned internalformat, |
| 61 int client_id) override; | 55 int client_id) override; |
| 62 | 56 |
| 63 private: | 57 private: |
| 64 typedef std::pair<gfx::IOSurfaceId, int> IOSurfaceMapKey; | 58 typedef std::pair<gfx::IOSurfaceId, int> IOSurfaceMapKey; |
| 65 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>> | 59 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>> |
| 66 IOSurfaceMap; | 60 IOSurfaceMap; |
| 67 // TOOD(reveman): Remove |io_surfaces_| and allow IOSurface backed GMBs to be | 61 // TOOD(reveman): Remove |io_surfaces_| and allow IOSurface backed GMBs to be |
| 68 // used with any GPU process by passing a mach_port to CreateImageCHROMIUM. | 62 // used with any GPU process by passing a mach_port to CreateImageCHROMIUM. |
| 69 IOSurfaceMap io_surfaces_; | 63 IOSurfaceMap io_surfaces_; |
| 70 base::Lock io_surfaces_lock_; | 64 base::Lock io_surfaces_lock_; |
| 71 | 65 |
| 72 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); | 66 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); |
| 73 }; | 67 }; |
| 74 | 68 |
| 75 } // namespace content | 69 } // namespace content |
| 76 | 70 |
| 77 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ | 71 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ |
| OLD | NEW |