OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ | |
6 #define GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ | |
7 | |
8 #include <utility> | |
9 | |
10 #include "base/containers/hash_tables.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/synchronization/lock.h" | |
13 #include "gpu/command_buffer/service/image_factory.h" | |
14 #include "gpu/gpu_export.h" | |
15 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | |
16 #include "ui/gfx/geometry/size.h" | |
17 #include "ui/gfx/gpu_memory_buffer.h" | |
18 | |
19 namespace gl { | |
20 class GLImage; | |
21 class SurfaceTexture; | |
22 } | |
23 | |
24 namespace gpu { | |
25 | |
26 class GPU_EXPORT GpuMemoryBufferFactorySurfaceTexture | |
27 : public GpuMemoryBufferFactory, | |
28 public ImageFactory { | |
29 public: | |
30 GpuMemoryBufferFactorySurfaceTexture(); | |
31 ~GpuMemoryBufferFactorySurfaceTexture() override; | |
32 | |
33 // Overridden from GpuMemoryBufferFactory: | |
34 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | |
35 gfx::GpuMemoryBufferId id, | |
36 const gfx::Size& size, | |
37 gfx::BufferFormat format, | |
38 gfx::BufferUsage usage, | |
39 int client_id, | |
40 SurfaceHandle surface_handle) override; | |
41 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | |
42 int client_id) override; | |
43 ImageFactory* AsImageFactory() override; | |
44 | |
45 // Overridden from ImageFactory: | |
46 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( | |
47 const gfx::GpuMemoryBufferHandle& handle, | |
48 const gfx::Size& size, | |
49 gfx::BufferFormat format, | |
50 unsigned internalformat, | |
51 int client_id, | |
52 SurfaceHandle surface_handle) override; | |
53 | |
54 private: | |
55 typedef std::pair<int, int> SurfaceTextureMapKey; | |
56 typedef base::hash_map<SurfaceTextureMapKey, | |
57 scoped_refptr<gl::SurfaceTexture>> | |
58 SurfaceTextureMap; | |
59 SurfaceTextureMap surface_textures_; | |
60 base::Lock surface_textures_lock_; | |
61 }; | |
62 | |
63 } // namespace gpu | |
64 | |
65 #endif // GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ | |
OLD | NEW |