| 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 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
| 6 | 6 |
| 7 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" | 7 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| 11 // static | 11 // static |
| 12 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create( | 12 void GpuMemoryBufferImpl::Create(const gfx::Size& size, |
| 13 const gfx::Size& size, | 13 unsigned internalformat, |
| 14 unsigned internalformat, | 14 unsigned usage, |
| 15 unsigned usage) { | 15 const CreationCallback& callback) { |
| 16 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( | 16 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( |
| 17 size, internalformat, usage)) { | 17 size, internalformat, usage)) { |
| 18 scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer( | 18 GpuMemoryBufferImplSharedMemory::Create( |
| 19 new GpuMemoryBufferImplSharedMemory(size, internalformat)); | 19 size, internalformat, usage, callback); |
| 20 if (!buffer->Initialize()) | 20 return; |
| 21 return scoped_ptr<GpuMemoryBufferImpl>(); | |
| 22 | |
| 23 return buffer.PassAs<GpuMemoryBufferImpl>(); | |
| 24 } | 21 } |
| 25 | 22 |
| 26 return scoped_ptr<GpuMemoryBufferImpl>(); | 23 callback.Run(scoped_ptr<GpuMemoryBufferImpl>()); |
| 27 } | 24 } |
| 28 | 25 |
| 29 // static | 26 // static |
| 30 void GpuMemoryBufferImpl::AllocateForChildProcess( | 27 void GpuMemoryBufferImpl::AllocateForChildProcess( |
| 31 const gfx::Size& size, | 28 const gfx::Size& size, |
| 32 unsigned internalformat, | 29 unsigned internalformat, |
| 33 unsigned usage, | 30 unsigned usage, |
| 34 base::ProcessHandle child_process, | 31 base::ProcessHandle child_process, |
| 35 int child_id, | 32 int child_id, |
| 36 const AllocationCallback& callback) { | 33 const AllocationCallback& callback) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 64 return scoped_ptr<GpuMemoryBufferImpl>(); | 61 return scoped_ptr<GpuMemoryBufferImpl>(); |
| 65 | 62 |
| 66 return buffer.PassAs<GpuMemoryBufferImpl>(); | 63 return buffer.PassAs<GpuMemoryBufferImpl>(); |
| 67 } | 64 } |
| 68 default: | 65 default: |
| 69 return scoped_ptr<GpuMemoryBufferImpl>(); | 66 return scoped_ptr<GpuMemoryBufferImpl>(); |
| 70 } | 67 } |
| 71 } | 68 } |
| 72 | 69 |
| 73 } // namespace content | 70 } // namespace content |
| OLD | NEW |