Index: content/renderer/render_thread_impl.cc |
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc |
index f7d66eaf458bc13dba047faa28ae7cccdd235ace..c446d9de40ae33075f09d8db2798a3efde29d4c3 100644 |
--- a/content/renderer/render_thread_impl.cc |
+++ b/content/renderer/render_thread_impl.cc |
@@ -1071,15 +1071,13 @@ scoped_ptr<gfx::GpuMemoryBuffer> RenderThreadImpl::AllocateGpuMemoryBuffer( |
if (!GpuMemoryBufferImpl::IsFormatValid(internalformat)) |
return scoped_ptr<gfx::GpuMemoryBuffer>(); |
- size_t size = width * height * |
- GpuMemoryBufferImpl::BytesPerPixel(internalformat); |
- if (size > static_cast<size_t>(std::numeric_limits<int>::max())) |
- return scoped_ptr<gfx::GpuMemoryBuffer>(); |
- |
gfx::GpuMemoryBufferHandle handle; |
bool success; |
IPC::Message* message = |
- new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer(size, &handle); |
+ new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer(width, |
+ height, |
+ internalformat, |
+ &handle); |
// Allow calling this from the compositor thread. |
if (base::MessageLoop::current() == message_loop()) |
@@ -1090,19 +1088,10 @@ scoped_ptr<gfx::GpuMemoryBuffer> RenderThreadImpl::AllocateGpuMemoryBuffer( |
if (!success) |
return scoped_ptr<gfx::GpuMemoryBuffer>(); |
- // Currently, shared memory is the only supported buffer type. |
- if (handle.type != gfx::SHARED_MEMORY_BUFFER) |
- return scoped_ptr<gfx::GpuMemoryBuffer>(); |
- |
- if (!base::SharedMemory::IsHandleValid(handle.handle)) |
- return scoped_ptr<gfx::GpuMemoryBuffer>(); |
- |
- return make_scoped_ptr<gfx::GpuMemoryBuffer>( |
- new GpuMemoryBufferImpl( |
- make_scoped_ptr(new base::SharedMemory(handle.handle, false)), |
- width, |
- height, |
- internalformat)); |
+ return GpuMemoryBufferImpl::Create( |
+ handle, |
+ gfx::Size(width, height), |
+ internalformat).PassAs<gfx::GpuMemoryBuffer>(); |
} |
void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { |