Commit da036ca3 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

Add nullptr check for GpuProcessHost when allocating GpuMemoryBuffer

This can return nullptr if the gpu process has failed to launch, or if
the browser main message loop has exited.

The other calls to GpuProcessHost::GetFromId do not dereference their
result without first checking against nullptr.

TBR=zmo (revied at https://codereview.chromium.org/2963433002/)

Bug: 723698
Change-Id: I556b8c937d9aaea8806902003209543b85823fb7
Reviewed-on: https://chromium-review.googlesource.com/595037Reviewed-by: default avatarccameron chromium <ccameron@chromium.org>
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491529}
parent e2c16975
...@@ -356,6 +356,11 @@ void BrowserGpuMemoryBufferManager::CreateGpuMemoryBufferOnIO( ...@@ -356,6 +356,11 @@ void BrowserGpuMemoryBufferManager::CreateGpuMemoryBufferOnIO(
} }
GpuProcessHost* host = GpuProcessHost::Get(); GpuProcessHost* host = GpuProcessHost::Get();
if (!host) {
DLOG(ERROR) << "Cannot allocate GpuMemoryBuffer with no GpuProcessHost.";
callback.Run(gfx::GpuMemoryBufferHandle());
return;
}
// Note: Unretained is safe as IO thread is stopped before manager is // Note: Unretained is safe as IO thread is stopped before manager is
// destroyed. // destroyed.
host->CreateGpuMemoryBuffer( host->CreateGpuMemoryBuffer(
......
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