Commit a7b800f0 authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

GMB FactoryAndroid: handle nullptr

GpuMemoryBufferImplAndroidHardwareBuffer::Create() can return a
nullptr [1], this CL handles that situation appropriately.

I found this path while investigating the bug below. It might be
related or not -- my android got into some metastate and it won't
install clankium images, but in the meantime this fix seems
legit to me.

[1] https://cs.chromium.org/chromium/src/gpu/ipc/common/gpu_memory_buffer_impl_android_hardware_buffer.cc?type=cs&sq=package:chromium&g=0&l=85

Bug: 865957
Change-Id: I37f431e70d90b955d812dd037076648bc3d30331
Reviewed-on: https://chromium-review.googlesource.com/c/1295249Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601823}
parent 4bc14eba
...@@ -34,6 +34,10 @@ GpuMemoryBufferFactoryAndroidHardwareBuffer::CreateGpuMemoryBuffer( ...@@ -34,6 +34,10 @@ GpuMemoryBufferFactoryAndroidHardwareBuffer::CreateGpuMemoryBuffer(
auto buffer = GpuMemoryBufferImplAndroidHardwareBuffer::Create( auto buffer = GpuMemoryBufferImplAndroidHardwareBuffer::Create(
id, size, format, usage, GpuMemoryBufferImpl::DestructionCallback()); id, size, format, usage, GpuMemoryBufferImpl::DestructionCallback());
if (!buffer) {
LOG(ERROR) << "Error creating new GpuMemoryBuffer";
return gfx::GpuMemoryBufferHandle();
}
auto handle = buffer->CloneHandle(); auto handle = buffer->CloneHandle();
buffer_map_[id] = std::move(buffer); buffer_map_[id] = std::move(buffer);
return handle; return 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