| Index: content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| index 7bc6fca71e6ea30a2cef3cb891b3dd3a7977a142..2f0418934a4dade0da9f87fad9e2e46b2ce88b81 100644
|
| --- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| +++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| @@ -9,8 +9,9 @@
|
| #include "content/browser/gpu/gpu_data_manager_impl.h"
|
| #include "content/browser/gpu/gpu_process_host.h"
|
| #include "content/browser/gpu/gpu_surface_tracker.h"
|
| -#include "content/common/gpu/gpu_messages.h"
|
| #include "content/common/child_process_host_impl.h"
|
| +#include "content/common/gpu/client/gpu_memory_buffer_impl.h"
|
| +#include "content/common/gpu/gpu_messages.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/common/content_client.h"
|
| #include "ipc/ipc_forwarding_message_filter.h"
|
| @@ -284,6 +285,27 @@ GpuChannelHost* BrowserGpuChannelHostFactory::EstablishGpuChannelSync(
|
| return gpu_channel_.get();
|
| }
|
|
|
| +scoped_ptr<gfx::GpuMemoryBuffer>
|
| + BrowserGpuChannelHostFactory::AllocateGpuMemoryBuffer(
|
| + size_t width,
|
| + size_t height,
|
| + unsigned internalformat) {
|
| + if (!GpuMemoryBufferImpl::IsFormatValid(internalformat))
|
| + return scoped_ptr<gfx::GpuMemoryBuffer>();
|
| +
|
| + size_t size = width * height *
|
| + GpuMemoryBufferImpl::BytesPerPixel(internalformat);
|
| + scoped_ptr<base::SharedMemory> shm(new base::SharedMemory());
|
| + if (!shm->CreateAnonymous(size))
|
| + return scoped_ptr<gfx::GpuMemoryBuffer>();
|
| +
|
| + return make_scoped_ptr<gfx::GpuMemoryBuffer>(
|
| + new GpuMemoryBufferImpl(shm.Pass(),
|
| + width,
|
| + height,
|
| + internalformat));
|
| +}
|
| +
|
| // static
|
| void BrowserGpuChannelHostFactory::AddFilterOnIO(
|
| int host_id,
|
|
|