| 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 void GpuMemoryBufferImpl::Create(const gfx::Size& size, | 12 void GpuMemoryBufferImpl::Create(const gfx::Size& size, |
| 13 unsigned internalformat, | 13 unsigned internalformat, |
| 14 unsigned usage, | 14 unsigned usage, |
| 15 int client_id, |
| 15 const CreationCallback& callback) { | 16 const CreationCallback& callback) { |
| 16 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( | 17 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( |
| 17 size, internalformat, usage)) { | 18 size, internalformat, usage)) { |
| 18 GpuMemoryBufferImplSharedMemory::Create( | 19 GpuMemoryBufferImplSharedMemory::Create( |
| 19 size, internalformat, usage, callback); | 20 size, internalformat, usage, callback); |
| 20 return; | 21 return; |
| 21 } | 22 } |
| 22 | 23 |
| 23 callback.Run(scoped_ptr<GpuMemoryBufferImpl>()); | 24 callback.Run(scoped_ptr<GpuMemoryBufferImpl>()); |
| 24 } | 25 } |
| 25 | 26 |
| 26 // static | 27 // static |
| 27 void GpuMemoryBufferImpl::AllocateForChildProcess( | 28 void GpuMemoryBufferImpl::AllocateForChildProcess( |
| 28 const gfx::Size& size, | 29 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 int child_id, | 33 int child_client_id, |
| 33 const AllocationCallback& callback) { | 34 const AllocationCallback& callback) { |
| 34 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( | 35 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( |
| 35 size, internalformat, usage)) { | 36 size, internalformat, usage)) { |
| 36 GpuMemoryBufferImplSharedMemory::AllocateSharedMemoryForChildProcess( | 37 GpuMemoryBufferImplSharedMemory::AllocateSharedMemoryForChildProcess( |
| 37 size, internalformat, child_process, callback); | 38 size, internalformat, child_process, callback); |
| 38 return; | 39 return; |
| 39 } | 40 } |
| 40 | 41 |
| 41 callback.Run(gfx::GpuMemoryBufferHandle()); | 42 callback.Run(gfx::GpuMemoryBufferHandle()); |
| 42 } | 43 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 61 return scoped_ptr<GpuMemoryBufferImpl>(); | 62 return scoped_ptr<GpuMemoryBufferImpl>(); |
| 62 | 63 |
| 63 return buffer.PassAs<GpuMemoryBufferImpl>(); | 64 return buffer.PassAs<GpuMemoryBufferImpl>(); |
| 64 } | 65 } |
| 65 default: | 66 default: |
| 66 return scoped_ptr<GpuMemoryBufferImpl>(); | 67 return scoped_ptr<GpuMemoryBufferImpl>(); |
| 67 } | 68 } |
| 68 } | 69 } |
| 69 | 70 |
| 70 } // namespace content | 71 } // namespace content |
| OLD | NEW |