OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SHM_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SHARED_MEMORY_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SHM_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SHARED_MEMORY_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 namespace content { | 10 namespace content { |
11 | 11 |
12 // Implementation of GPU memory buffer based on shared memory. | 12 // Implementation of GPU memory buffer based on shared memory. |
13 class GpuMemoryBufferImplShm : public GpuMemoryBufferImpl { | 13 class GpuMemoryBufferImplSharedMemory : public GpuMemoryBufferImpl { |
14 public: | 14 public: |
15 GpuMemoryBufferImplShm(const gfx::Size& size, unsigned internalformat); | 15 GpuMemoryBufferImplSharedMemory(const gfx::Size& size, |
16 virtual ~GpuMemoryBufferImplShm(); | 16 unsigned internalformat); |
| 17 virtual ~GpuMemoryBufferImplSharedMemory(); |
17 | 18 |
18 // Allocates a shared memory backed GPU memory buffer with |size| and | 19 // Allocates a shared memory backed GPU memory buffer with |size| and |
19 // |internalformat| for use by |child_process|. | 20 // |internalformat| for use by |child_process|. |
20 static void AllocateSharedMemoryForChildProcess( | 21 static void AllocateSharedMemoryForChildProcess( |
21 const gfx::Size& size, | 22 const gfx::Size& size, |
22 unsigned internalformat, | 23 unsigned internalformat, |
23 base::ProcessHandle child_process, | 24 base::ProcessHandle child_process, |
24 const AllocationCallback& callback); | 25 const AllocationCallback& callback); |
25 | 26 |
26 static bool IsLayoutSupported(const gfx::Size& size, unsigned internalformat); | 27 static bool IsLayoutSupported(const gfx::Size& size, unsigned internalformat); |
27 static bool IsUsageSupported(unsigned usage); | 28 static bool IsUsageSupported(unsigned usage); |
28 static bool IsConfigurationSupported(const gfx::Size& size, | 29 static bool IsConfigurationSupported(const gfx::Size& size, |
29 unsigned internalformat, | 30 unsigned internalformat, |
30 unsigned usage); | 31 unsigned usage); |
31 | 32 |
32 bool Initialize(); | 33 bool Initialize(); |
33 bool InitializeFromHandle(gfx::GpuMemoryBufferHandle handle); | 34 bool InitializeFromHandle(gfx::GpuMemoryBufferHandle handle); |
34 | 35 |
35 // Overridden from gfx::GpuMemoryBuffer: | 36 // Overridden from gfx::GpuMemoryBuffer: |
36 virtual void* Map() OVERRIDE; | 37 virtual void* Map() OVERRIDE; |
37 virtual void Unmap() OVERRIDE; | 38 virtual void Unmap() OVERRIDE; |
38 virtual uint32 GetStride() const OVERRIDE; | 39 virtual uint32 GetStride() const OVERRIDE; |
39 virtual gfx::GpuMemoryBufferHandle GetHandle() const OVERRIDE; | 40 virtual gfx::GpuMemoryBufferHandle GetHandle() const OVERRIDE; |
40 | 41 |
41 private: | 42 private: |
42 scoped_ptr<base::SharedMemory> shared_memory_; | 43 scoped_ptr<base::SharedMemory> shared_memory_; |
43 | 44 |
44 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplShm); | 45 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSharedMemory); |
45 }; | 46 }; |
46 | 47 |
47 } // namespace content | 48 } // namespace content |
48 | 49 |
49 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SHM_H_ | 50 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SHARED_MEMORY_H_ |
OLD | NEW |