| 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" |
| 11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 // Provides common implementation of a GPU memory buffer. | 15 // Provides common implementation of a GPU memory buffer. |
| 16 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { | 16 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { |
| 17 public: | 17 public: |
| 18 typedef base::Callback<void(scoped_ptr<GpuMemoryBufferImpl> buffer)> |
| 19 CreationCallback; |
| 18 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> | 20 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> |
| 19 AllocationCallback; | 21 AllocationCallback; |
| 20 | 22 |
| 21 virtual ~GpuMemoryBufferImpl(); | 23 virtual ~GpuMemoryBufferImpl(); |
| 22 | 24 |
| 23 // Creates a GPU memory buffer instance with |size| and |internalformat| for | 25 // Creates a GPU memory buffer instance with |size| and |internalformat| for |
| 24 // |usage|. | 26 // |usage|. |
| 25 static scoped_ptr<GpuMemoryBufferImpl> Create(const gfx::Size& size, | 27 static void Create(const gfx::Size& size, |
| 26 unsigned internalformat, | 28 unsigned internalformat, |
| 27 unsigned usage); | 29 unsigned usage, |
| 30 const CreationCallback& callback); |
| 28 | 31 |
| 29 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage| | 32 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage| |
| 30 // by |child_process| identified by |child_id|. The |handle| returned can be | 33 // by |child_process| identified by |child_id|. The |handle| returned can be |
| 31 // used by the |child_process| to create an instance of this class. | 34 // used by the |child_process| to create an instance of this class. |
| 32 static void AllocateForChildProcess(const gfx::Size& size, | 35 static void AllocateForChildProcess(const gfx::Size& size, |
| 33 unsigned internalformat, | 36 unsigned internalformat, |
| 34 unsigned usage, | 37 unsigned usage, |
| 35 base::ProcessHandle child_process, | 38 base::ProcessHandle child_process, |
| 36 int child_id, | 39 int child_id, |
| 37 const AllocationCallback& callback); | 40 const AllocationCallback& callback); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 67 const gfx::Size size_; | 70 const gfx::Size size_; |
| 68 const unsigned internalformat_; | 71 const unsigned internalformat_; |
| 69 bool mapped_; | 72 bool mapped_; |
| 70 | 73 |
| 71 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | 74 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); |
| 72 }; | 75 }; |
| 73 | 76 |
| 74 } // namespace content | 77 } // namespace content |
| 75 | 78 |
| 76 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 79 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
| OLD | NEW |