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_OZONE_NATIVE_PIXMAP_H_ | 5 #ifndef GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_PIXMAP_H_ |
6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_PIXMAP_H_ | 6 #define GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_PIXMAP_H_ |
7 | 7 |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
11 #include "content/common/content_export.h" | |
12 #include "content/common/gpu/gpu_memory_buffer_factory.h" | |
13 #include "gpu/command_buffer/service/image_factory.h" | 11 #include "gpu/command_buffer/service/image_factory.h" |
| 12 #include "gpu/gpu_export.h" |
| 13 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
14 #include "ui/ozone/public/native_pixmap.h" | 14 #include "ui/ozone/public/native_pixmap.h" |
15 | 15 |
16 namespace gl { | 16 namespace gl { |
17 class GLImage; | 17 class GLImage; |
18 } | 18 } |
19 | 19 |
20 namespace content { | 20 namespace gpu { |
21 | 21 |
22 class CONTENT_EXPORT GpuMemoryBufferFactoryOzoneNativePixmap | 22 class GPU_EXPORT GpuMemoryBufferFactoryOzoneNativePixmap |
23 : public GpuMemoryBufferFactory, | 23 : public GpuMemoryBufferFactory, |
24 public gpu::ImageFactory { | 24 public ImageFactory { |
25 public: | 25 public: |
26 GpuMemoryBufferFactoryOzoneNativePixmap(); | 26 GpuMemoryBufferFactoryOzoneNativePixmap(); |
27 ~GpuMemoryBufferFactoryOzoneNativePixmap() override; | 27 ~GpuMemoryBufferFactoryOzoneNativePixmap() override; |
28 | 28 |
29 // Overridden from GpuMemoryBufferFactory: | 29 // Overridden from GpuMemoryBufferFactory: |
30 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | 30 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
31 gfx::GpuMemoryBufferId id, | 31 gfx::GpuMemoryBufferId id, |
32 const gfx::Size& size, | 32 const gfx::Size& size, |
33 gfx::BufferFormat format, | 33 gfx::BufferFormat format, |
34 gfx::BufferUsage usage, | 34 gfx::BufferUsage usage, |
35 int client_id, | 35 int client_id, |
36 gpu::SurfaceHandle surface_handle) override; | 36 SurfaceHandle surface_handle) override; |
37 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromHandle( | 37 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromHandle( |
38 const gfx::GpuMemoryBufferHandle& handle, | 38 const gfx::GpuMemoryBufferHandle& handle, |
39 gfx::GpuMemoryBufferId id, | 39 gfx::GpuMemoryBufferId id, |
40 const gfx::Size& size, | 40 const gfx::Size& size, |
41 gfx::BufferFormat format, | 41 gfx::BufferFormat format, |
42 int client_id) override; | 42 int client_id) override; |
43 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 43 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
44 int client_id) override; | 44 int client_id) override; |
45 gpu::ImageFactory* AsImageFactory() override; | 45 ImageFactory* AsImageFactory() override; |
46 | 46 |
47 // Overridden from gpu::ImageFactory: | 47 // Overridden from ImageFactory: |
48 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( | 48 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( |
49 const gfx::GpuMemoryBufferHandle& handle, | 49 const gfx::GpuMemoryBufferHandle& handle, |
50 const gfx::Size& size, | 50 const gfx::Size& size, |
51 gfx::BufferFormat format, | 51 gfx::BufferFormat format, |
52 unsigned internalformat, | 52 unsigned internalformat, |
53 int client_id) override; | 53 int client_id) override; |
54 | 54 |
55 private: | 55 private: |
56 using NativePixmapMapKey = std::pair<int, int>; | 56 using NativePixmapMapKey = std::pair<int, int>; |
57 using NativePixmapMap = | 57 using NativePixmapMap = |
58 base::hash_map<NativePixmapMapKey, scoped_refptr<ui::NativePixmap>>; | 58 base::hash_map<NativePixmapMapKey, scoped_refptr<ui::NativePixmap>>; |
59 NativePixmapMap native_pixmaps_; | 59 NativePixmapMap native_pixmaps_; |
60 base::Lock native_pixmaps_lock_; | 60 base::Lock native_pixmaps_lock_; |
61 | 61 |
62 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryOzoneNativePixmap); | 62 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryOzoneNativePixmap); |
63 }; | 63 }; |
64 | 64 |
65 } // namespace content | 65 } // namespace gpu |
66 | 66 |
67 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_PIXMAP_H_ | 67 #endif // GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_PIXMAP_H_ |
OLD | NEW |