| Index: content/common/gpu/client/gpu_memory_buffer_impl_android.cc
|
| diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_android.cc b/content/common/gpu/client/gpu_memory_buffer_impl_android.cc
|
| index a7f694f4a8f0b8ed4c756a2dfd8b256668356c7c..0e31dc9b65f31dc140d00887a2928258e214dafa 100644
|
| --- a/content/common/gpu/client/gpu_memory_buffer_impl_android.cc
|
| +++ b/content/common/gpu/client/gpu_memory_buffer_impl_android.cc
|
| @@ -9,15 +9,51 @@
|
|
|
| namespace content {
|
|
|
| +// static
|
| scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create(
|
| + const gfx::Size& size,
|
| + unsigned internalformat,
|
| + unsigned usage) {
|
| + if (GpuMemoryBufferImplShm::IsConfigurationSupported(
|
| + size, internalformat, usage)) {
|
| + scoped_ptr<GpuMemoryBufferImplShm> buffer(
|
| + new GpuMemoryBufferImplShm(size, internalformat));
|
| + if (!buffer->Initialize())
|
| + return scoped_ptr<GpuMemoryBufferImpl>();
|
| +
|
| + return buffer.PassAs<GpuMemoryBufferImpl>();
|
| + }
|
| +
|
| + return scoped_ptr<GpuMemoryBufferImpl>();
|
| +}
|
| +
|
| +// static
|
| +void GpuMemoryBufferImpl::AllocateForChildProcess(
|
| + const gfx::Size& size,
|
| + unsigned internalformat,
|
| + unsigned usage,
|
| + base::ProcessHandle child_process,
|
| + gfx::GpuMemoryBufferHandle* handle) {
|
| + if (GpuMemoryBufferImplShm::IsConfigurationSupported(
|
| + size, internalformat, usage)) {
|
| + GpuMemoryBufferImplShm::AllocateSharedMemoryForChildProcess(
|
| + size, internalformat, child_process, handle);
|
| + return;
|
| + }
|
| +
|
| + handle->type = gfx::EMPTY_BUFFER;
|
| +}
|
| +
|
| +// static
|
| +scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle(
|
| gfx::GpuMemoryBufferHandle handle,
|
| - gfx::Size size,
|
| + const gfx::Size& size,
|
| unsigned internalformat) {
|
| switch (handle.type) {
|
| case gfx::SHARED_MEMORY_BUFFER: {
|
| scoped_ptr<GpuMemoryBufferImplShm> buffer(
|
| new GpuMemoryBufferImplShm(size, internalformat));
|
| - if (!buffer->Initialize(handle))
|
| + if (!buffer->InitializeFromHandle(handle))
|
| return scoped_ptr<GpuMemoryBufferImpl>();
|
|
|
| return buffer.PassAs<GpuMemoryBufferImpl>();
|
| @@ -25,7 +61,7 @@ scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create(
|
| case gfx::SURFACE_TEXTURE_BUFFER: {
|
| scoped_ptr<GpuMemoryBufferImplSurfaceTexture> buffer(
|
| new GpuMemoryBufferImplSurfaceTexture(size, internalformat));
|
| - if (!buffer->Initialize(handle))
|
| + if (!buffer->InitializeFromHandle(handle))
|
| return scoped_ptr<GpuMemoryBufferImpl>();
|
|
|
| return buffer.PassAs<GpuMemoryBufferImpl>();
|
|
|