| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ |
| 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ |
| 7 | 7 |
| 8 #include <IOSurface/IOSurfaceAPI.h> | 8 #include <IOSurface/IOSurfaceAPI.h> |
| 9 | 9 |
| 10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| 11 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 11 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 // Implementation of GPU memory buffer based on IO surfaces. | 15 // Implementation of GPU memory buffer based on IO surfaces. |
| 16 class GpuMemoryBufferImplIOSurface : public GpuMemoryBufferImpl { | 16 class GpuMemoryBufferImplIOSurface : public GpuMemoryBufferImpl { |
| 17 public: | 17 public: |
| 18 static void Create(const gfx::Size& size, |
| 19 unsigned internalformat, |
| 20 unsigned usage, |
| 21 int client_id, |
| 22 const CreationCallback& callback); |
| 23 |
| 24 static void AllocateForChildProcess(const gfx::Size& size, |
| 25 unsigned internalformat, |
| 26 unsigned usage, |
| 27 int child_client_id, |
| 28 const AllocationCallback& callback); |
| 29 |
| 18 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( | 30 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( |
| 19 const gfx::GpuMemoryBufferHandle& handle, | 31 const gfx::GpuMemoryBufferHandle& handle, |
| 20 const gfx::Size& size, | 32 const gfx::Size& size, |
| 21 unsigned internalformat, | 33 unsigned internalformat, |
| 22 const DestructionCallback& callback); | 34 const DestructionCallback& callback); |
| 23 | 35 |
| 24 static bool IsFormatSupported(unsigned internalformat); | 36 static bool IsFormatSupported(unsigned internalformat); |
| 25 static bool IsUsageSupported(unsigned usage); | 37 static bool IsUsageSupported(unsigned usage); |
| 26 static bool IsConfigurationSupported(unsigned internalformat, unsigned usage); | 38 static bool IsConfigurationSupported(unsigned internalformat, unsigned usage); |
| 27 static uint32 PixelFormat(unsigned internalformat); | 39 static uint32 PixelFormat(unsigned internalformat); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 40 virtual ~GpuMemoryBufferImplIOSurface(); | 52 virtual ~GpuMemoryBufferImplIOSurface(); |
| 41 | 53 |
| 42 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; | 54 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; |
| 43 | 55 |
| 44 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplIOSurface); | 56 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplIOSurface); |
| 45 }; | 57 }; |
| 46 | 58 |
| 47 } // namespace content | 59 } // namespace content |
| 48 | 60 |
| 49 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ | 61 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ |
| OLD | NEW |