Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1255)

Unified Diff: content/browser/gpu/browser_gpu_memory_buffer_manager.cc

Issue 2963433002: Add nullptr check for GpuProcessHost when allocating GpuMemoryBuffer
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/browser_gpu_memory_buffer_manager.cc
diff --git a/content/browser/gpu/browser_gpu_memory_buffer_manager.cc b/content/browser/gpu/browser_gpu_memory_buffer_manager.cc
index 9db43c78485cbadc0969a25a56f7826903bf88fa..ed8a172ab366e9445c768be36903f2a065997fad 100644
--- a/content/browser/gpu/browser_gpu_memory_buffer_manager.cc
+++ b/content/browser/gpu/browser_gpu_memory_buffer_manager.cc
@@ -338,6 +338,13 @@ void BrowserGpuMemoryBufferManager::CreateGpuMemoryBufferOnIO(
DCHECK_CURRENTLY_ON(BrowserThread::IO);
BufferMap& buffers = clients_[client_id];
+ GpuProcessHost* host = GpuProcessHost::Get();
+ if (!host) {
+ DLOG(ERROR) << "Cannot allocate GpuMemoryBuffer with no GpuProcessHost.";
+ callback.Run(gfx::GpuMemoryBufferHandle());
+ return;
+ }
+
// Note: Handling of cases where the client is removed before the allocation
// completes is less subtle if we set the buffer type to EMPTY_BUFFER here
// and verify that this has not changed when creation completes.
@@ -350,7 +357,6 @@ void BrowserGpuMemoryBufferManager::CreateGpuMemoryBufferOnIO(
return;
}
- GpuProcessHost* host = GpuProcessHost::Get();
// Note: Unretained is safe as IO thread is stopped before manager is
// destroyed.
host->CreateGpuMemoryBuffer(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698