Chromium Code Reviews| Index: content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc |
| diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc b/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc |
| index fe2681bf051df7b4e5efe3aef6b7db461204fe2e..560eef44610cc1bb9a7e0cb73bf72dbdbe9b68ed 100644 |
| --- a/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc |
| +++ b/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc |
| @@ -14,6 +14,15 @@ namespace { |
| base::StaticAtomicSequenceNumber g_next_buffer_id; |
| +void AllocatedOzoneNativeBuffer( |
| + const gfx::Size& size, |
| + unsigned internalformat, |
| + const GpuMemoryBufferImpl::CreationCallback& callback, |
| + const gfx::GpuMemoryBufferHandle& handle) { |
| + callback.Run( |
| + GpuMemoryBufferImpl::CreateFromHandle(handle, size, internalformat)); |
| +} |
| + |
| } // namespace |
| GpuMemoryBufferImplOzoneNativeBuffer::GpuMemoryBufferImplOzoneNativeBuffer( |
| @@ -33,8 +42,7 @@ void GpuMemoryBufferImplOzoneNativeBuffer::AllocateOzoneNativeBufferForChildId( |
| int child_id, |
| const AllocationCallback& callback) { |
| gfx::GpuMemoryBufferHandle handle; |
| - // +1 ensures we always get non-zero IDs. |
| - handle.global_id.primary_id = g_next_buffer_id.GetNext() + 1; |
| + handle.global_id.primary_id = g_next_buffer_id.GetNext(); |
| handle.global_id.secondary_id = child_id; |
| handle.type = gfx::OZONE_NATIVE_BUFFER; |
| GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer( |
| @@ -46,6 +54,20 @@ void GpuMemoryBufferImplOzoneNativeBuffer::AllocateOzoneNativeBufferForChildId( |
| } |
| // static |
| +void GpuMemoryBufferImplOzoneNativeBuffer::Create( |
|
reveman
2014/09/09 23:17:54
nit: please order the functions as GpuMemoryBuffer
alexst (slow to review)
2014/09/10 01:57:49
Done.
|
| + const gfx::Size& size, |
| + unsigned internalformat, |
| + unsigned usage, |
| + const CreationCallback& callback) { |
| + GpuMemoryBufferImplOzoneNativeBuffer::AllocateOzoneNativeBufferForChildId( |
|
reveman
2014/09/09 23:17:54
Not a fan of using a function called *ForChildId h
alexst (slow to review)
2014/09/10 01:57:49
I just used it as a shortcut, refactored to call G
|
| + size, |
| + internalformat, |
| + usage, |
| + 0, |
| + base::Bind(&AllocatedOzoneNativeBuffer, size, internalformat, callback)); |
| +} |
| + |
| +// static |
| bool GpuMemoryBufferImplOzoneNativeBuffer::IsFormatSupported( |
| unsigned internalformat) { |
| switch (internalformat) { |