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_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/gfx/gpu_memory_buffer.h" | 10 #include "ui/gfx/gpu_memory_buffer.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage| | 29 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage| |
30 // by |child_process|. The |handle| returned can be used by the | 30 // by |child_process|. The |handle| returned can be used by the |
31 // |child_process| to create an instance of this class. | 31 // |child_process| to create an instance of this class. |
32 static void AllocateForChildProcess(const gfx::Size& size, | 32 static void AllocateForChildProcess(const gfx::Size& size, |
33 unsigned internalformat, | 33 unsigned internalformat, |
34 unsigned usage, | 34 unsigned usage, |
35 base::ProcessHandle child_process, | 35 base::ProcessHandle child_process, |
36 const AllocationCallback& callback); | 36 const AllocationCallback& callback); |
37 | 37 |
| 38 // Notify that GPU memory buffer has been deleted by |child_process|. |
| 39 static void DeletedByChildProcess(gfx::GpuMemoryBufferType type, |
| 40 const gfx::GpuMemoryBufferId& id, |
| 41 base::ProcessHandle child_process); |
| 42 |
38 // Creates an instance from the given |handle|. |size| and |internalformat| | 43 // Creates an instance from the given |handle|. |size| and |internalformat| |
39 // should match what was used to allocate the |handle|. | 44 // should match what was used to allocate the |handle|. |
40 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( | 45 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( |
41 gfx::GpuMemoryBufferHandle handle, | 46 const gfx::GpuMemoryBufferHandle& handle, |
42 const gfx::Size& size, | 47 const gfx::Size& size, |
43 unsigned internalformat); | 48 unsigned internalformat); |
44 | 49 |
45 // Returns true if |internalformat| is a format recognized by this base class. | 50 // Returns true if |internalformat| is a format recognized by this base class. |
46 static bool IsFormatValid(unsigned internalformat); | 51 static bool IsFormatValid(unsigned internalformat); |
47 | 52 |
48 // Returns true if |usage| is recognized by this base class. | 53 // Returns true if |usage| is recognized by this base class. |
49 static bool IsUsageValid(unsigned usage); | 54 static bool IsUsageValid(unsigned usage); |
50 | 55 |
51 // Returns the number of bytes per pixel that must be used by an | 56 // Returns the number of bytes per pixel that must be used by an |
52 // implementation when using |internalformat|. | 57 // implementation when using |internalformat|. |
53 static size_t BytesPerPixel(unsigned internalformat); | 58 static size_t BytesPerPixel(unsigned internalformat); |
54 | 59 |
55 // Overridden from gfx::GpuMemoryBuffer: | 60 // Overridden from gfx::GpuMemoryBuffer: |
56 virtual bool IsMapped() const OVERRIDE; | 61 virtual bool IsMapped() const OVERRIDE; |
57 | 62 |
58 protected: | 63 protected: |
59 GpuMemoryBufferImpl(const gfx::Size& size, unsigned internalformat); | 64 GpuMemoryBufferImpl(const gfx::Size& size, unsigned internalformat); |
60 | 65 |
61 const gfx::Size size_; | 66 const gfx::Size size_; |
62 const unsigned internalformat_; | 67 const unsigned internalformat_; |
63 bool mapped_; | 68 bool mapped_; |
64 | 69 |
65 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | 70 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); |
66 }; | 71 }; |
67 | 72 |
68 } // namespace content | 73 } // namespace content |
69 | 74 |
70 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 75 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
OLD | NEW |