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/gpu/client/gpu_memory_buffer_impl.h" | 8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
9 | 9 |
10 struct ANativeWindow; | 10 struct ANativeWindow; |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 // Implementation of GPU memory buffer based on SurfaceTextures. | 14 // Implementation of GPU memory buffer based on SurfaceTextures. |
15 class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl { | 15 class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl { |
16 public: | 16 public: |
17 static void Create(const gfx::Size& size, | 17 static void Create(gfx::GpuMemoryBufferId id, |
| 18 const gfx::Size& size, |
18 Format format, | 19 Format format, |
19 int client_id, | 20 int client_id, |
20 const CreationCallback& callback); | 21 const CreationCallback& callback); |
21 | 22 |
22 static void AllocateForChildProcess(const gfx::Size& size, | 23 static void AllocateForChildProcess(gfx::GpuMemoryBufferId id, |
| 24 const gfx::Size& size, |
23 Format format, | 25 Format format, |
24 int child_client_id, | 26 int child_client_id, |
25 const AllocationCallback& callback); | 27 const AllocationCallback& callback); |
26 | 28 |
27 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( | 29 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( |
28 const gfx::GpuMemoryBufferHandle& handle, | 30 const gfx::GpuMemoryBufferHandle& handle, |
29 const gfx::Size& size, | 31 const gfx::Size& size, |
30 Format format, | 32 Format format, |
31 const DestructionCallback& callback); | 33 const DestructionCallback& callback); |
32 | 34 |
33 static bool IsFormatSupported(Format format); | 35 static bool IsFormatSupported(Format format); |
34 static bool IsUsageSupported(Usage usage); | 36 static bool IsUsageSupported(Usage usage); |
35 static bool IsConfigurationSupported(Format format, Usage usage); | 37 static bool IsConfigurationSupported(Format format, Usage usage); |
36 static int WindowFormat(Format format); | 38 static int WindowFormat(Format format); |
37 | 39 |
38 // Overridden from gfx::GpuMemoryBuffer: | 40 // Overridden from gfx::GpuMemoryBuffer: |
39 virtual void* Map() override; | 41 virtual void* Map() override; |
40 virtual void Unmap() override; | 42 virtual void Unmap() override; |
41 virtual gfx::GpuMemoryBufferHandle GetHandle() const override; | 43 virtual gfx::GpuMemoryBufferHandle GetHandle() const override; |
42 virtual uint32 GetStride() const override; | 44 virtual uint32 GetStride() const override; |
43 | 45 |
44 private: | 46 private: |
45 GpuMemoryBufferImplSurfaceTexture(const gfx::Size& size, | 47 GpuMemoryBufferImplSurfaceTexture(gfx::GpuMemoryBufferId id, |
| 48 const gfx::Size& size, |
46 Format format, | 49 Format format, |
47 const DestructionCallback& callback, | 50 const DestructionCallback& callback, |
48 const gfx::GpuMemoryBufferId& id, | |
49 ANativeWindow* native_window); | 51 ANativeWindow* native_window); |
50 virtual ~GpuMemoryBufferImplSurfaceTexture(); | 52 virtual ~GpuMemoryBufferImplSurfaceTexture(); |
51 | 53 |
52 gfx::GpuMemoryBufferId id_; | |
53 ANativeWindow* native_window_; | 54 ANativeWindow* native_window_; |
54 size_t stride_; | 55 size_t stride_; |
55 | 56 |
56 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture); | 57 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture); |
57 }; | 58 }; |
58 | 59 |
59 } // namespace content | 60 } // namespace content |
60 | 61 |
61 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ | 62 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ |
OLD | NEW |