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> |
11 | 11 |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/mac/scoped_cftyperef.h" | 13 #include "base/mac/scoped_cftyperef.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
18 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 18 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
19 #include "gpu/command_buffer/service/image_factory.h" | 19 #include "gpu/command_buffer/service/image_factory.h" |
20 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
21 #include "ui/gfx/gpu_memory_buffer.h" | 21 #include "ui/gfx/gpu_memory_buffer.h" |
22 #include "ui/gfx/mac/io_surface_manager.h" | 22 #include "ui/gfx/mac/io_surface.h" |
23 | 23 |
24 namespace gl { | 24 namespace gl { |
25 class GLImage; | 25 class GLImage; |
26 } | 26 } |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 | 29 |
30 class CONTENT_EXPORT GpuMemoryBufferFactoryIOSurface | 30 class CONTENT_EXPORT GpuMemoryBufferFactoryIOSurface |
31 : public GpuMemoryBufferFactory, | 31 : public GpuMemoryBufferFactory, |
32 public gpu::ImageFactory { | 32 public gpu::ImageFactory { |
(...skipping 27 matching lines...) Expand all Loading... |
60 const gfx::GpuMemoryBufferHandle& handle, | 60 const gfx::GpuMemoryBufferHandle& handle, |
61 const gfx::Size& size, | 61 const gfx::Size& size, |
62 gfx::BufferFormat format, | 62 gfx::BufferFormat format, |
63 unsigned internalformat, | 63 unsigned internalformat, |
64 int client_id) override; | 64 int client_id) override; |
65 | 65 |
66 private: | 66 private: |
67 typedef std::pair<gfx::IOSurfaceId, int> IOSurfaceMapKey; | 67 typedef std::pair<gfx::IOSurfaceId, int> IOSurfaceMapKey; |
68 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>> | 68 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>> |
69 IOSurfaceMap; | 69 IOSurfaceMap; |
| 70 // TOOD(reveman): Remove |io_surfaces_| and allow IOSurface backed GMBs to be |
| 71 // used with any GPU process by passing a mach_port to CreateImageCHROMIUM. |
70 IOSurfaceMap io_surfaces_; | 72 IOSurfaceMap io_surfaces_; |
71 base::Lock io_surfaces_lock_; | 73 base::Lock io_surfaces_lock_; |
72 | 74 |
73 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); | 75 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); |
74 }; | 76 }; |
75 | 77 |
76 } // namespace content | 78 } // namespace content |
77 | 79 |
78 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ | 80 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ |
OLD | NEW |