Commit ec689def authored by reveman's avatar reveman Committed by Commit bot

content: Fix OOM error handling in...

content: Fix OOM error handling in GpuMemoryBufferImplSharedMemory::AllocateSharedMemoryForChildProcess.

We need to run the callback with an empty handle after failing
to allocated shared memory.

BUG=
TBR=piman@chromium.org

Review URL: https://codereview.chromium.org/595063004

Cr-Commit-Position: refs/heads/master@{#296333}
parent 90e2db1a
...@@ -43,13 +43,13 @@ void GpuMemoryBufferImplSharedMemory::AllocateSharedMemoryForChildProcess( ...@@ -43,13 +43,13 @@ void GpuMemoryBufferImplSharedMemory::AllocateSharedMemoryForChildProcess(
base::ProcessHandle child_process, base::ProcessHandle child_process,
const AllocationCallback& callback) { const AllocationCallback& callback) {
DCHECK(IsLayoutSupported(size, internalformat)); DCHECK(IsLayoutSupported(size, internalformat));
gfx::GpuMemoryBufferHandle handle;
base::SharedMemory shared_memory; base::SharedMemory shared_memory;
if (!shared_memory.CreateAnonymous(size.GetArea() * if (!shared_memory.CreateAnonymous(size.GetArea() *
BytesPerPixel(internalformat))) { BytesPerPixel(internalformat))) {
handle.type = gfx::EMPTY_BUFFER; callback.Run(gfx::GpuMemoryBufferHandle());
return; return;
} }
gfx::GpuMemoryBufferHandle handle;
handle.type = gfx::SHARED_MEMORY_BUFFER; handle.type = gfx::SHARED_MEMORY_BUFFER;
shared_memory.GiveToProcess(child_process, &handle.handle); shared_memory.GiveToProcess(child_process, &handle.handle);
callback.Run(handle); callback.Run(handle);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment