Chromium Code Reviews| 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)> | 18 typedef base::Callback<void(scoped_ptr<GpuMemoryBufferImpl> buffer)> |
| 19 CreationCallback; | 19 CreationCallback; |
| 20 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> | 20 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> |
| 21 AllocationCallback; | 21 AllocationCallback; |
| 22 | 22 |
| 23 virtual ~GpuMemoryBufferImpl(); | 23 virtual ~GpuMemoryBufferImpl(); |
| 24 | 24 |
| 25 // Creates a GPU memory buffer instance with |size| and |internalformat| for | 25 // Creates a GPU memory buffer instance with |size| and |internalformat| for |
| 26 // |usage|. | 26 // |usage|. |
|
reveman
2014/09/10 16:10:14
Please update this comment. Something along the li
| |
| 27 static void Create(const gfx::Size& size, | 27 static void Create(const gfx::Size& size, |
| 28 unsigned internalformat, | 28 unsigned internalformat, |
| 29 unsigned usage, | 29 unsigned usage, |
| 30 int gpu_client_id, | |
|
reveman
2014/09/10 16:10:13
Sorry, I'd prefer "client_id" rather than gpu_clie
| |
| 30 const CreationCallback& callback); | 31 const CreationCallback& callback); |
| 31 | 32 |
| 32 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage| | 33 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage| |
| 33 // by |child_process| identified by |child_id|. The |handle| returned can be | 34 // by |child_process| identified by |child_id|. The |handle| returned can be |
|
reveman
2014/09/10 16:10:14
I think we should change "for |usage| by |child_pr
| |
| 34 // used by the |child_process| to create an instance of this class. | 35 // used by the |child_process| to create an instance of this class. |
| 35 static void AllocateForChildProcess(const gfx::Size& size, | 36 static void AllocateForChildProcess(const gfx::Size& size, |
| 36 unsigned internalformat, | 37 unsigned internalformat, |
| 37 unsigned usage, | 38 unsigned usage, |
| 38 base::ProcessHandle child_process, | 39 base::ProcessHandle child_process, |
| 39 int child_id, | 40 int child_id, |
|
reveman
2014/09/10 16:10:14
Please s/child_id/child_client_id/ to make the con
| |
| 40 const AllocationCallback& callback); | 41 const AllocationCallback& callback); |
| 41 | 42 |
| 42 // Notify that GPU memory buffer has been deleted by |child_process|. | 43 // Notify that GPU memory buffer has been deleted by |child_process|. |
| 43 static void DeletedByChildProcess(gfx::GpuMemoryBufferType type, | 44 static void DeletedByChildProcess(gfx::GpuMemoryBufferType type, |
| 44 const gfx::GpuMemoryBufferId& id, | 45 const gfx::GpuMemoryBufferId& id, |
| 45 base::ProcessHandle child_process); | 46 base::ProcessHandle child_process); |
| 46 | 47 |
| 47 // Creates an instance from the given |handle|. |size| and |internalformat| | 48 // Creates an instance from the given |handle|. |size| and |internalformat| |
| 48 // should match what was used to allocate the |handle|. | 49 // should match what was used to allocate the |handle|. |
| 49 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( | 50 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 70 const gfx::Size size_; | 71 const gfx::Size size_; |
| 71 const unsigned internalformat_; | 72 const unsigned internalformat_; |
| 72 bool mapped_; | 73 bool mapped_; |
| 73 | 74 |
| 74 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | 75 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); |
| 75 }; | 76 }; |
| 76 | 77 |
| 77 } // namespace content | 78 } // namespace content |
| 78 | 79 |
| 79 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 80 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
| OLD | NEW |