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> | 8 #include <utility> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 14 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
15 #include "gpu/command_buffer/service/image_factory.h" | 15 #include "gpu/command_buffer/service/image_factory.h" |
16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
17 #include "ui/gfx/gpu_memory_buffer.h" | 17 #include "ui/gfx/gpu_memory_buffer.h" |
18 | 18 |
19 namespace gfx { | 19 namespace gfx { |
| 20 class SurfaceTexture; |
| 21 } |
| 22 |
| 23 namespace gl { |
20 class GLImage; | 24 class GLImage; |
21 class SurfaceTexture; | |
22 } | 25 } |
23 | 26 |
24 namespace content { | 27 namespace content { |
25 | 28 |
26 class CONTENT_EXPORT GpuMemoryBufferFactorySurfaceTexture | 29 class CONTENT_EXPORT GpuMemoryBufferFactorySurfaceTexture |
27 : public GpuMemoryBufferFactory, | 30 : public GpuMemoryBufferFactory, |
28 public gpu::ImageFactory { | 31 public gpu::ImageFactory { |
29 public: | 32 public: |
30 GpuMemoryBufferFactorySurfaceTexture(); | 33 GpuMemoryBufferFactorySurfaceTexture(); |
31 ~GpuMemoryBufferFactorySurfaceTexture() override; | 34 ~GpuMemoryBufferFactorySurfaceTexture() override; |
(...skipping 13 matching lines...) Expand all Loading... |
45 const gfx::GpuMemoryBufferHandle& handle, | 48 const gfx::GpuMemoryBufferHandle& handle, |
46 gfx::GpuMemoryBufferId id, | 49 gfx::GpuMemoryBufferId id, |
47 const gfx::Size& size, | 50 const gfx::Size& size, |
48 gfx::BufferFormat format, | 51 gfx::BufferFormat format, |
49 int client_id) override; | 52 int client_id) override; |
50 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 53 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
51 int client_id) override; | 54 int client_id) override; |
52 gpu::ImageFactory* AsImageFactory() override; | 55 gpu::ImageFactory* AsImageFactory() override; |
53 | 56 |
54 // Overridden from gpu::ImageFactory: | 57 // Overridden from gpu::ImageFactory: |
55 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( | 58 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( |
56 const gfx::GpuMemoryBufferHandle& handle, | 59 const gfx::GpuMemoryBufferHandle& handle, |
57 const gfx::Size& size, | 60 const gfx::Size& size, |
58 gfx::BufferFormat format, | 61 gfx::BufferFormat format, |
59 unsigned internalformat, | 62 unsigned internalformat, |
60 int client_id) override; | 63 int client_id) override; |
61 | 64 |
62 private: | 65 private: |
63 typedef std::pair<int, int> SurfaceTextureMapKey; | 66 typedef std::pair<int, int> SurfaceTextureMapKey; |
64 typedef base::hash_map<SurfaceTextureMapKey, | 67 typedef base::hash_map<SurfaceTextureMapKey, |
65 scoped_refptr<gfx::SurfaceTexture>> SurfaceTextureMap; | 68 scoped_refptr<gfx::SurfaceTexture>> SurfaceTextureMap; |
66 SurfaceTextureMap surface_textures_; | 69 SurfaceTextureMap surface_textures_; |
67 base::Lock surface_textures_lock_; | 70 base::Lock surface_textures_lock_; |
68 }; | 71 }; |
69 | 72 |
70 } // namespace content | 73 } // namespace content |
71 | 74 |
72 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ | 75 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ |
OLD | NEW |