Chromium Code Reviews| Index: content/common/gpu/client/gpu_memory_buffer_impl_linux.cc |
| diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_linux.cc b/content/common/gpu/client/gpu_memory_buffer_impl_linux.cc |
| index 0fc371b99dac9f24de68c5c5d347bec58863eca8..cf9341a5185b674c66f01befc33818dc6e11f4cd 100644 |
| --- a/content/common/gpu/client/gpu_memory_buffer_impl_linux.cc |
| +++ b/content/common/gpu/client/gpu_memory_buffer_impl_linux.cc |
| @@ -4,15 +4,33 @@ |
| #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
| +#include "content/common/gpu/client/gpu_memory_buffer_impl_ozone.h" |
| #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" |
| namespace content { |
| +#if defined(USE_OZONE) |
|
reveman
2014/08/11 19:43:05
No idefs in these files. Please add a platform spe
achaulk
2014/08/12 19:03:56
Ok
|
| +namespace { |
| +const int kBrowserClientId = 1; |
| +} // namespace |
| +#endif // defined(USE_OZONE) |
| // static |
| scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create( |
| const gfx::Size& size, |
| unsigned internalformat, |
| unsigned usage) { |
| +#if defined(USE_OZONE) |
| + if (GpuMemoryBufferImplOzone::IsConfigurationSupported( |
| + size, internalformat, usage)) { |
| + scoped_ptr<GpuMemoryBufferImplOzone> buffer( |
| + new GpuMemoryBufferImplOzone(size, internalformat, kBrowserClientId)); |
| + if (!buffer->Initialize()) |
| + return scoped_ptr<GpuMemoryBufferImpl>(); |
| + |
| + return buffer.PassAs<GpuMemoryBufferImpl>(); |
| + } |
| +#endif // defined(USE_OZONE) |
|
reveman
2014/08/11 19:43:05
do we need browser compositor support for this?
achaulk
2014/08/12 19:03:57
Not for using them. We will eventually to render t
reveman
2014/08/12 20:19:11
I'm failing to see how this works. Latest patch is
achaulk
2014/08/12 21:38:01
That is something that we will need to figure out
|
| + |
| if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( |
| size, internalformat, usage)) { |
| scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer( |
| @@ -32,7 +50,22 @@ void GpuMemoryBufferImpl::AllocateForChildProcess( |
| unsigned internalformat, |
| unsigned usage, |
| base::ProcessHandle child_process, |
| + int client_id, |
| + GpuMemoryBufferFactoryHost* gpu_factory_host, |
| const AllocationCallback& callback) { |
| +#if defined(USE_OZONE) |
| + if (GpuMemoryBufferImplOzone::IsConfigurationSupported( |
| + size, internalformat, usage)) { |
| + GpuMemoryBufferImplOzone::AllocateSharedMemoryForChildProcess( |
| + size, |
| + internalformat, |
| + child_process, |
| + client_id, |
| + gpu_factory_host, |
| + callback); |
| + return; |
| + } |
| +#endif // defined(USE_OZONE) |
| if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( |
| size, internalformat, usage)) { |
| GpuMemoryBufferImplSharedMemory::AllocateSharedMemoryForChildProcess( |
| @@ -64,6 +97,16 @@ scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( |
| return buffer.PassAs<GpuMemoryBufferImpl>(); |
| } |
| +#if defined(USE_OZONE) |
| + case gfx::OZONE_NATIVE_BUFFER: { |
| + scoped_ptr<GpuMemoryBufferImplOzone> buffer( |
| + new GpuMemoryBufferImplOzone(size, internalformat, 0)); |
| + if (!buffer->InitializeFromHandle(handle)) |
| + return scoped_ptr<GpuMemoryBufferImpl>(); |
| + |
| + return buffer.PassAs<GpuMemoryBufferImpl>(); |
| + } |
| +#endif // defined(USE_OZONE) |
| default: |
| return scoped_ptr<GpuMemoryBufferImpl>(); |
| } |