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_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ |
7 | 7 |
| 8 #include "content/common/content_export.h" |
8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 9 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
9 | 10 |
10 struct ANativeWindow; | 11 struct ANativeWindow; |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 // Implementation of GPU memory buffer based on SurfaceTextures. | 15 // Implementation of GPU memory buffer based on SurfaceTextures. |
15 class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl { | 16 class CONTENT_EXPORT GpuMemoryBufferImplSurfaceTexture |
| 17 : public GpuMemoryBufferImpl { |
16 public: | 18 public: |
17 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( | 19 ~GpuMemoryBufferImplSurfaceTexture() override; |
| 20 |
| 21 static scoped_ptr<GpuMemoryBufferImplSurfaceTexture> CreateFromHandle( |
18 const gfx::GpuMemoryBufferHandle& handle, | 22 const gfx::GpuMemoryBufferHandle& handle, |
19 const gfx::Size& size, | 23 const gfx::Size& size, |
20 gfx::BufferFormat format, | 24 gfx::BufferFormat format, |
| 25 gfx::BufferUsage usage, |
21 const DestructionCallback& callback); | 26 const DestructionCallback& callback); |
22 | 27 |
| 28 static bool IsConfigurationSupported(gfx::BufferFormat format, |
| 29 gfx::BufferUsage usage); |
| 30 |
| 31 static base::Closure AllocateForTesting(const gfx::Size& size, |
| 32 gfx::BufferFormat format, |
| 33 gfx::BufferUsage usage, |
| 34 gfx::GpuMemoryBufferHandle* handle); |
| 35 |
23 // Overridden from gfx::GpuMemoryBuffer: | 36 // Overridden from gfx::GpuMemoryBuffer: |
24 bool Map(void** data) override; | 37 bool Map(void** data) override; |
25 void Unmap() override; | 38 void Unmap() override; |
26 gfx::GpuMemoryBufferHandle GetHandle() const override; | 39 gfx::GpuMemoryBufferHandle GetHandle() const override; |
27 void GetStride(int* stride) const override; | 40 void GetStride(int* stride) const override; |
28 | 41 |
29 private: | 42 private: |
30 GpuMemoryBufferImplSurfaceTexture(gfx::GpuMemoryBufferId id, | 43 GpuMemoryBufferImplSurfaceTexture(gfx::GpuMemoryBufferId id, |
31 const gfx::Size& size, | 44 const gfx::Size& size, |
32 gfx::BufferFormat format, | 45 gfx::BufferFormat format, |
33 const DestructionCallback& callback, | 46 const DestructionCallback& callback, |
34 ANativeWindow* native_window); | 47 ANativeWindow* native_window); |
35 ~GpuMemoryBufferImplSurfaceTexture() override; | |
36 | 48 |
37 ANativeWindow* native_window_; | 49 ANativeWindow* native_window_; |
38 size_t stride_; | 50 size_t stride_; |
39 | 51 |
40 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture); | 52 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture); |
41 }; | 53 }; |
42 | 54 |
43 } // namespace content | 55 } // namespace content |
44 | 56 |
45 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ | 57 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ |
OLD | NEW |