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 "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
11 #include "ui/gfx/gpu_memory_buffer.h" | 11 #include "ui/gfx/gpu_memory_buffer.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class GLImage; | 14 class GLImage; |
15 class SurfaceTexture; | 15 class SurfaceTexture; |
16 } | 16 } |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class GpuMemoryBufferFactorySurfaceTexture { | 20 class GpuMemoryBufferFactorySurfaceTexture { |
21 public: | 21 public: |
22 GpuMemoryBufferFactorySurfaceTexture(); | 22 GpuMemoryBufferFactorySurfaceTexture(); |
23 ~GpuMemoryBufferFactorySurfaceTexture(); | 23 ~GpuMemoryBufferFactorySurfaceTexture(); |
24 | 24 |
25 // Creates a SurfaceTexture backed GPU memory buffer with |size| and | 25 // Creates a SurfaceTexture backed GPU memory buffer with |size| and |
26 // |internalformat|. A valid handle is returned on success. | 26 // |internalformat|. A valid handle is returned on success. |
27 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | 27 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
28 const gfx::GpuMemoryBufferId& id, | 28 const gfx::Size& size, |
29 const gfx::Size& size, | 29 unsigned internalformat, |
30 unsigned internalformat); | 30 int client_id); |
31 | 31 |
32 // Destroy a previously created GPU memory buffer. | 32 // Destroy a previously created GPU memory buffer. |
33 void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferId& id); | 33 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); |
34 | 34 |
35 // Creates a GLImage instance for a GPU memory buffer. | 35 // Creates a GLImage instance for a GPU memory buffer. |
36 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( | 36 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( |
37 const gfx::GpuMemoryBufferId& id, | 37 gfx::GpuMemoryBufferId id, |
38 const gfx::Size& size, | 38 const gfx::Size& size, |
39 unsigned internalformat); | 39 unsigned internalformat, |
| 40 int client_id); |
40 | 41 |
41 private: | 42 private: |
42 typedef std::pair<int, int> SurfaceTextureMapKey; | 43 typedef std::pair<int, int> SurfaceTextureMapKey; |
43 typedef base::hash_map<SurfaceTextureMapKey, | 44 typedef base::hash_map<SurfaceTextureMapKey, |
44 scoped_refptr<gfx::SurfaceTexture>> SurfaceTextureMap; | 45 scoped_refptr<gfx::SurfaceTexture>> SurfaceTextureMap; |
45 SurfaceTextureMap surface_textures_; | 46 SurfaceTextureMap surface_textures_; |
46 }; | 47 }; |
47 | 48 |
48 } // namespace content | 49 } // namespace content |
49 | 50 |
50 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ | 51 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ |
OLD | NEW |