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/IOSurface.h> | 8 #include <IOSurface/IOSurface.h> |
9 | 9 |
10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| 11 #include "content/common/content_export.h" |
11 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 12 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 // Implementation of GPU memory buffer based on IO surfaces. | 16 // Implementation of GPU memory buffer based on IO surfaces. |
16 class GpuMemoryBufferImplIOSurface : public GpuMemoryBufferImpl { | 17 class CONTENT_EXPORT GpuMemoryBufferImplIOSurface : public GpuMemoryBufferImpl { |
17 public: | 18 public: |
18 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( | 19 ~GpuMemoryBufferImplIOSurface() override; |
| 20 |
| 21 static scoped_ptr<GpuMemoryBufferImplIOSurface> CreateFromHandle( |
19 const gfx::GpuMemoryBufferHandle& handle, | 22 const gfx::GpuMemoryBufferHandle& handle, |
20 const gfx::Size& size, | 23 const gfx::Size& size, |
21 gfx::BufferFormat format, | 24 gfx::BufferFormat format, |
22 gfx::BufferUsage usage, | 25 gfx::BufferUsage usage, |
23 const DestructionCallback& callback); | 26 const DestructionCallback& callback); |
24 | 27 |
| 28 static bool IsConfigurationSupported(gfx::BufferFormat format, |
| 29 gfx::BufferUsage usage); |
| 30 |
| 31 static base::Closure AllocateForTesting(const gfx::Size& size, |
| 32 gfx::BufferFormat format, |
| 33 gfx::BufferUsage usage, |
| 34 gfx::GpuMemoryBufferHandle* handle); |
| 35 |
25 // Overridden from gfx::GpuMemoryBuffer: | 36 // Overridden from gfx::GpuMemoryBuffer: |
26 bool Map(void** data) override; | 37 bool Map(void** data) override; |
27 void Unmap() override; | 38 void Unmap() override; |
28 void GetStride(int* stride) const override; | 39 void GetStride(int* stride) const override; |
29 gfx::GpuMemoryBufferHandle GetHandle() const override; | 40 gfx::GpuMemoryBufferHandle GetHandle() const override; |
30 | 41 |
31 private: | 42 private: |
32 GpuMemoryBufferImplIOSurface(gfx::GpuMemoryBufferId id, | 43 GpuMemoryBufferImplIOSurface(gfx::GpuMemoryBufferId id, |
33 const gfx::Size& size, | 44 const gfx::Size& size, |
34 gfx::BufferFormat format, | 45 gfx::BufferFormat format, |
35 const DestructionCallback& callback, | 46 const DestructionCallback& callback, |
36 IOSurfaceRef io_surface, | 47 IOSurfaceRef io_surface, |
37 uint32_t lock_flags); | 48 uint32_t lock_flags); |
38 ~GpuMemoryBufferImplIOSurface() override; | |
39 | 49 |
40 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; | 50 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; |
41 uint32_t lock_flags_; | 51 uint32_t lock_flags_; |
42 | 52 |
43 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplIOSurface); | 53 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplIOSurface); |
44 }; | 54 }; |
45 | 55 |
46 } // namespace content | 56 } // namespace content |
47 | 57 |
48 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ | 58 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ |
OLD | NEW |