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, | 18 static void Create(gfx::GpuMemoryBufferId id, |
| 19 const gfx::Size& size, |
19 Format format, | 20 Format format, |
20 int client_id, | 21 int client_id, |
21 const CreationCallback& callback); | 22 const CreationCallback& callback); |
22 | 23 |
23 static void AllocateForChildProcess(const gfx::Size& size, | 24 static void AllocateForChildProcess(gfx::GpuMemoryBufferId id, |
| 25 const gfx::Size& size, |
24 Format format, | 26 Format format, |
25 int child_client_id, | 27 int child_client_id, |
26 const AllocationCallback& callback); | 28 const AllocationCallback& callback); |
27 | 29 |
28 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( | 30 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( |
29 const gfx::GpuMemoryBufferHandle& handle, | 31 const gfx::GpuMemoryBufferHandle& handle, |
30 const gfx::Size& size, | 32 const gfx::Size& size, |
31 Format format, | 33 Format format, |
32 const DestructionCallback& callback); | 34 const DestructionCallback& callback); |
33 | 35 |
34 static void DeletedByChildProcess(const gfx::GpuMemoryBufferId& id, | 36 static void DeletedByChildProcess(gfx::GpuMemoryBufferId id, |
| 37 int child_client_id, |
35 uint32_t sync_point); | 38 uint32_t sync_point); |
36 | 39 |
37 static bool IsFormatSupported(Format format); | 40 static bool IsFormatSupported(Format format); |
38 static bool IsUsageSupported(Usage usage); | 41 static bool IsUsageSupported(Usage usage); |
39 static bool IsConfigurationSupported(Format format, Usage usage); | 42 static bool IsConfigurationSupported(Format format, Usage usage); |
40 static uint32 PixelFormat(Format format); | 43 static uint32 PixelFormat(Format format); |
41 | 44 |
42 // Overridden from gfx::GpuMemoryBuffer: | 45 // Overridden from gfx::GpuMemoryBuffer: |
43 void* Map() override; | 46 void* Map() override; |
44 void Unmap() override; | 47 void Unmap() override; |
45 uint32 GetStride() const override; | 48 uint32 GetStride() const override; |
46 gfx::GpuMemoryBufferHandle GetHandle() const override; | 49 gfx::GpuMemoryBufferHandle GetHandle() const override; |
47 | 50 |
48 private: | 51 private: |
49 GpuMemoryBufferImplIOSurface(const gfx::Size& size, | 52 GpuMemoryBufferImplIOSurface(gfx::GpuMemoryBufferId id, |
| 53 const gfx::Size& size, |
50 Format format, | 54 Format format, |
51 const DestructionCallback& callback, | 55 const DestructionCallback& callback, |
52 IOSurfaceRef io_surface); | 56 IOSurfaceRef io_surface); |
53 ~GpuMemoryBufferImplIOSurface() override; | 57 ~GpuMemoryBufferImplIOSurface() override; |
54 | 58 |
55 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; | 59 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; |
56 | 60 |
57 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplIOSurface); | 61 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplIOSurface); |
58 }; | 62 }; |
59 | 63 |
60 } // namespace content | 64 } // namespace content |
61 | 65 |
62 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ | 66 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ |
OLD | NEW |