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/IOSurface.h> | 8 #include <IOSurface/IOSurface.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 "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "content/common/content_export.h" |
14 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 15 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
15 #include "content/common/mac/io_surface_manager.h" | 16 #include "content/common/mac/io_surface_manager.h" |
16 #include "gpu/command_buffer/service/image_factory.h" | 17 #include "gpu/command_buffer/service/image_factory.h" |
17 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
18 #include "ui/gfx/gpu_memory_buffer.h" | 19 #include "ui/gfx/gpu_memory_buffer.h" |
19 | 20 |
20 namespace gfx { | 21 namespace gfx { |
21 class GLImage; | 22 class GLImage; |
22 } | 23 } |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 | 26 |
26 class GpuMemoryBufferFactoryIOSurface : public GpuMemoryBufferFactory, | 27 class CONTENT_EXPORT GpuMemoryBufferFactoryIOSurface |
27 public gpu::ImageFactory { | 28 : public GpuMemoryBufferFactory, |
| 29 public gpu::ImageFactory { |
28 public: | 30 public: |
29 GpuMemoryBufferFactoryIOSurface(); | 31 GpuMemoryBufferFactoryIOSurface(); |
30 ~GpuMemoryBufferFactoryIOSurface() override; | 32 ~GpuMemoryBufferFactoryIOSurface() override; |
31 | 33 |
32 static bool IsGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format, | 34 static bool IsGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format, |
33 gfx::BufferUsage usage); | 35 gfx::BufferUsage usage); |
34 | 36 |
| 37 static IOSurfaceRef CreateIOSurface(const gfx::Size& size, |
| 38 gfx::BufferFormat format); |
| 39 |
35 // Overridden from GpuMemoryBufferFactory: | 40 // Overridden from GpuMemoryBufferFactory: |
36 void GetSupportedGpuMemoryBufferConfigurations( | |
37 std::vector<Configuration>* configurations) override; | |
38 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | 41 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
39 gfx::GpuMemoryBufferId id, | 42 gfx::GpuMemoryBufferId id, |
40 const gfx::Size& size, | 43 const gfx::Size& size, |
41 gfx::BufferFormat format, | 44 gfx::BufferFormat format, |
42 gfx::BufferUsage usage, | 45 gfx::BufferUsage usage, |
43 int client_id, | 46 int client_id, |
44 gfx::PluginWindowHandle surface_handle) override; | 47 gfx::PluginWindowHandle surface_handle) override; |
45 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 48 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
46 int client_id) override; | 49 int client_id) override; |
47 gpu::ImageFactory* AsImageFactory() override; | 50 gpu::ImageFactory* AsImageFactory() override; |
(...skipping 12 matching lines...) Expand all Loading... |
60 IOSurfaceMap; | 63 IOSurfaceMap; |
61 IOSurfaceMap io_surfaces_; | 64 IOSurfaceMap io_surfaces_; |
62 base::Lock io_surfaces_lock_; | 65 base::Lock io_surfaces_lock_; |
63 | 66 |
64 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); | 67 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); |
65 }; | 68 }; |
66 | 69 |
67 } // namespace content | 70 } // namespace content |
68 | 71 |
69 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ | 72 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ |
OLD | NEW |