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 #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_shm.h" | 7 #include "content/common/gpu/client/gpu_memory_buffer_impl_shm.h" |
| 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" | 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 27 return scoped_ptr<GpuMemoryBufferImpl>(); | 27 return scoped_ptr<GpuMemoryBufferImpl>(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 // static | 30 // static |
| 31 void GpuMemoryBufferImpl::AllocateForChildProcess( | 31 void GpuMemoryBufferImpl::AllocateForChildProcess( |
| 32 const gfx::Size& size, | 32 const gfx::Size& size, |
| 33 unsigned internalformat, | 33 unsigned internalformat, |
| 34 unsigned usage, | 34 unsigned usage, |
| 35 base::ProcessHandle child_process, | 35 base::ProcessHandle child_process, |
| 36 gfx::GpuMemoryBufferHandle* handle) { | 36 gfx::GpuMemoryBufferHandle* handle, |
| 37 const base::Closure& allocate_callback) { | |
| 38 handle->type = gfx::EMPTY_BUFFER; | |
| 37 if (GpuMemoryBufferImplShm::IsConfigurationSupported( | 39 if (GpuMemoryBufferImplShm::IsConfigurationSupported( |
| 38 size, internalformat, usage)) { | 40 size, internalformat, usage)) { |
| 39 GpuMemoryBufferImplShm::AllocateSharedMemoryForChildProcess( | 41 GpuMemoryBufferImplShm::AllocateSharedMemoryForChildProcess( |
| 40 size, internalformat, child_process, handle); | 42 size, internalformat, child_process, handle); |
| 41 return; | |
| 42 } | 43 } |
| 43 | 44 |
| 44 handle->type = gfx::EMPTY_BUFFER; | 45 allocate_callback.Run(); |
|
reveman
2014/05/19 05:51:07
I think it'd be better to forward the responsibili
| |
| 45 } | 46 } |
| 46 | 47 |
| 47 // static | 48 // static |
| 48 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( | 49 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( |
| 49 gfx::GpuMemoryBufferHandle handle, | 50 gfx::GpuMemoryBufferHandle handle, |
| 50 const gfx::Size& size, | 51 const gfx::Size& size, |
| 51 unsigned internalformat) { | 52 unsigned internalformat) { |
| 52 switch (handle.type) { | 53 switch (handle.type) { |
| 53 case gfx::SHARED_MEMORY_BUFFER: { | 54 case gfx::SHARED_MEMORY_BUFFER: { |
| 54 scoped_ptr<GpuMemoryBufferImplShm> buffer( | 55 scoped_ptr<GpuMemoryBufferImplShm> buffer( |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 65 return scoped_ptr<GpuMemoryBufferImpl>(); | 66 return scoped_ptr<GpuMemoryBufferImpl>(); |
| 66 | 67 |
| 67 return buffer.PassAs<GpuMemoryBufferImpl>(); | 68 return buffer.PassAs<GpuMemoryBufferImpl>(); |
| 68 } | 69 } |
| 69 default: | 70 default: |
| 70 return scoped_ptr<GpuMemoryBufferImpl>(); | 71 return scoped_ptr<GpuMemoryBufferImpl>(); |
| 71 } | 72 } |
| 72 } | 73 } |
| 73 | 74 |
| 74 } // namespace content | 75 } // namespace content |
| OLD | NEW |