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_SURFACE_TEXTURE_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ |
6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ | 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ |
7 | 7 |
| 8 #include <utility> |
| 9 |
8 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
10 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "content/common/content_export.h" |
11 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 14 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
12 #include "gpu/command_buffer/service/image_factory.h" | 15 #include "gpu/command_buffer/service/image_factory.h" |
13 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
14 #include "ui/gfx/gpu_memory_buffer.h" | 17 #include "ui/gfx/gpu_memory_buffer.h" |
15 | 18 |
16 namespace gfx { | 19 namespace gfx { |
17 class GLImage; | 20 class GLImage; |
18 class SurfaceTexture; | 21 class SurfaceTexture; |
19 } | 22 } |
20 | 23 |
21 namespace content { | 24 namespace content { |
22 | 25 |
23 class GpuMemoryBufferFactorySurfaceTexture : public GpuMemoryBufferFactory, | 26 class CONTENT_EXPORT GpuMemoryBufferFactorySurfaceTexture |
24 public gpu::ImageFactory { | 27 : public GpuMemoryBufferFactory, |
| 28 public gpu::ImageFactory { |
25 public: | 29 public: |
26 GpuMemoryBufferFactorySurfaceTexture(); | 30 GpuMemoryBufferFactorySurfaceTexture(); |
27 ~GpuMemoryBufferFactorySurfaceTexture() override; | 31 ~GpuMemoryBufferFactorySurfaceTexture() override; |
28 | 32 |
29 static bool IsGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format, | 33 static bool IsGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format, |
30 gfx::BufferUsage usage); | 34 gfx::BufferUsage usage); |
31 | 35 |
32 // Overridden from GpuMemoryBufferFactory: | 36 // Overridden from GpuMemoryBufferFactory: |
33 void GetSupportedGpuMemoryBufferConfigurations( | |
34 std::vector<Configuration>* configurations) override; | |
35 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | 37 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
36 gfx::GpuMemoryBufferId id, | 38 gfx::GpuMemoryBufferId id, |
37 const gfx::Size& size, | 39 const gfx::Size& size, |
38 gfx::BufferFormat format, | 40 gfx::BufferFormat format, |
39 gfx::BufferUsage usage, | 41 gfx::BufferUsage usage, |
40 int client_id, | 42 int client_id, |
41 gfx::PluginWindowHandle surface_handle) override; | 43 gfx::PluginWindowHandle surface_handle) override; |
42 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 44 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
43 int client_id) override; | 45 int client_id) override; |
44 gpu::ImageFactory* AsImageFactory() override; | 46 gpu::ImageFactory* AsImageFactory() override; |
(...skipping 10 matching lines...) Expand all Loading... |
55 typedef std::pair<int, int> SurfaceTextureMapKey; | 57 typedef std::pair<int, int> SurfaceTextureMapKey; |
56 typedef base::hash_map<SurfaceTextureMapKey, | 58 typedef base::hash_map<SurfaceTextureMapKey, |
57 scoped_refptr<gfx::SurfaceTexture>> SurfaceTextureMap; | 59 scoped_refptr<gfx::SurfaceTexture>> SurfaceTextureMap; |
58 SurfaceTextureMap surface_textures_; | 60 SurfaceTextureMap surface_textures_; |
59 base::Lock surface_textures_lock_; | 61 base::Lock surface_textures_lock_; |
60 }; | 62 }; |
61 | 63 |
62 } // namespace content | 64 } // namespace content |
63 | 65 |
64 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ | 66 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ |
OLD | NEW |