| Index: content/common/gpu/client/gpu_memory_buffer_impl_win.cc
|
| diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_win.cc b/content/common/gpu/client/gpu_memory_buffer_impl_win.cc
|
| index 3c144f37ccf6b6159d2ba9692fffccf3b23b9e87..ef508984646ac8a79b0c99e04c99bcf1ba1b0621 100644
|
| --- a/content/common/gpu/client/gpu_memory_buffer_impl_win.cc
|
| +++ b/content/common/gpu/client/gpu_memory_buffer_impl_win.cc
|
| @@ -4,28 +4,56 @@
|
|
|
| #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
|
|
|
| +#include "base/logging.h"
|
| #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
|
|
|
| namespace content {
|
|
|
| // static
|
| -void GpuMemoryBufferImpl::Create(gfx::GpuMemoryBufferId id,
|
| +void GpuMemoryBufferImpl::GetSupportedTypes(
|
| + std::vector<gfx::GpuMemoryBufferType>* types) {
|
| + const gfx::GpuMemoryBufferType supported_types[] = {
|
| + gfx::SHARED_MEMORY_BUFFER
|
| + };
|
| + types->assign(supported_types, supported_types + arraysize(supported_types));
|
| +}
|
| +
|
| +// static
|
| +bool GpuMemoryBufferImpl::IsConfigurationSupported(
|
| + gfx::GpuMemoryBufferType type,
|
| + Format format,
|
| + Usage usage) {
|
| + switch (type) {
|
| + case gfx::SHARED_MEMORY_BUFFER:
|
| + return GpuMemoryBufferImplSharedMemory::IsFormatSupported(format) &&
|
| + GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage);
|
| + default:
|
| + NOTREACHED();
|
| + return false;
|
| + }
|
| +}
|
| +
|
| +// static
|
| +void GpuMemoryBufferImpl::Create(gfx::GpuMemoryBufferType type,
|
| + gfx::GpuMemoryBufferId id,
|
| const gfx::Size& size,
|
| Format format,
|
| Usage usage,
|
| int client_id,
|
| const CreationCallback& callback) {
|
| - if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
|
| - size, format, usage)) {
|
| - GpuMemoryBufferImplSharedMemory::Create(id, size, format, callback);
|
| - return;
|
| + switch (type) {
|
| + case gfx::SHARED_MEMORY_BUFFER:
|
| + GpuMemoryBufferImplSharedMemory::Create(id, size, format, callback);
|
| + break;
|
| + default:
|
| + NOTREACHED();
|
| + break;
|
| }
|
| -
|
| - callback.Run(scoped_ptr<GpuMemoryBufferImpl>());
|
| }
|
|
|
| // static
|
| void GpuMemoryBufferImpl::AllocateForChildProcess(
|
| + gfx::GpuMemoryBufferType type,
|
| gfx::GpuMemoryBufferId id,
|
| const gfx::Size& size,
|
| Format format,
|
| @@ -33,14 +61,15 @@ void GpuMemoryBufferImpl::AllocateForChildProcess(
|
| base::ProcessHandle child_process,
|
| int child_client_id,
|
| const AllocationCallback& callback) {
|
| - if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
|
| - size, format, usage)) {
|
| - GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
|
| - id, size, format, child_process, callback);
|
| - return;
|
| + switch (type) {
|
| + case gfx::SHARED_MEMORY_BUFFER:
|
| + GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
|
| + id, size, format, child_process, callback);
|
| + break;
|
| + default:
|
| + NOTREACHED();
|
| + break;
|
| }
|
| -
|
| - callback.Run(gfx::GpuMemoryBufferHandle());
|
| }
|
|
|
| // static
|
| @@ -50,6 +79,13 @@ void GpuMemoryBufferImpl::DeletedByChildProcess(
|
| base::ProcessHandle child_process,
|
| int child_client_id,
|
| uint32 sync_point) {
|
| + switch (type) {
|
| + case gfx::SHARED_MEMORY_BUFFER:
|
| + break;
|
| + default:
|
| + NOTREACHED();
|
| + break;
|
| + }
|
| }
|
|
|
| // static
|
| @@ -63,6 +99,7 @@ scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle(
|
| return GpuMemoryBufferImplSharedMemory::CreateFromHandle(
|
| handle, size, format, callback);
|
| default:
|
| + NOTREACHED();
|
| return scoped_ptr<GpuMemoryBufferImpl>();
|
| }
|
| }
|
|
|