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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
9 #include "ui/gfx/gpu_memory_buffer.h" | 10 #include "ui/gfx/gpu_memory_buffer.h" |
10 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 // Provides common implementation of a GPU memory buffer. | 15 // Provides common implementation of a GPU memory buffer. |
15 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { | 16 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { |
16 public: | 17 public: |
17 virtual ~GpuMemoryBufferImpl(); | 18 virtual ~GpuMemoryBufferImpl(); |
18 | 19 |
19 // Creates a GPU memory buffer instance with |size| and |internalformat| for | 20 // Creates a GPU memory buffer instance with |size| and |internalformat| for |
20 // |usage|. | 21 // |usage|. |
21 static scoped_ptr<GpuMemoryBufferImpl> Create(const gfx::Size& size, | 22 static scoped_ptr<GpuMemoryBufferImpl> Create(const gfx::Size& size, |
22 unsigned internalformat, | 23 unsigned internalformat, |
23 unsigned usage); | 24 unsigned usage); |
24 | 25 |
25 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage| | 26 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage| |
26 // by |child_process|. The |handle| returned can be used by the | 27 // by |child_process|. The |handle| returned can be used by the |
27 // |child_process| to create an instance of this class. | 28 // |child_process| to create an instance of this class. |
28 static void AllocateForChildProcess(const gfx::Size& size, | 29 static void AllocateForChildProcess(const gfx::Size& size, |
29 unsigned internalformat, | 30 unsigned internalformat, |
30 unsigned usage, | 31 unsigned usage, |
31 base::ProcessHandle child_process, | 32 base::ProcessHandle child_process, |
32 gfx::GpuMemoryBufferHandle* handle); | 33 gfx::GpuMemoryBufferHandle* handle, |
34 const base::Closure& allocate_callback); | |
reveman
2014/05/19 05:51:07
Instead of passing a heap allocated gfx::GpuMemory
| |
33 | 35 |
34 // Creates an instance from the given |handle|. |size| and |internalformat| | 36 // Creates an instance from the given |handle|. |size| and |internalformat| |
35 // should match what was used to allocate the |handle|. | 37 // should match what was used to allocate the |handle|. |
36 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( | 38 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( |
37 gfx::GpuMemoryBufferHandle handle, | 39 gfx::GpuMemoryBufferHandle handle, |
38 const gfx::Size& size, | 40 const gfx::Size& size, |
39 unsigned internalformat); | 41 unsigned internalformat); |
40 | 42 |
41 // Returns true if |internalformat| is a format recognized by this base class. | 43 // Returns true if |internalformat| is a format recognized by this base class. |
42 static bool IsFormatValid(unsigned internalformat); | 44 static bool IsFormatValid(unsigned internalformat); |
(...skipping 14 matching lines...) Expand all Loading... | |
57 const gfx::Size size_; | 59 const gfx::Size size_; |
58 const unsigned internalformat_; | 60 const unsigned internalformat_; |
59 bool mapped_; | 61 bool mapped_; |
60 | 62 |
61 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | 63 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); |
62 }; | 64 }; |
63 | 65 |
64 } // namespace content | 66 } // namespace content |
65 | 67 |
66 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 68 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
OLD | NEW |