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

Unified Diff: components/viz/common/server_gpu_memory_buffer_manager.cc

Issue 2955813002: viz: Replace a DCHECK with proper error handling. (Closed)
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 | components/viz/common/server_gpu_memory_buffer_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/viz/common/server_gpu_memory_buffer_manager.cc
diff --git a/components/viz/common/server_gpu_memory_buffer_manager.cc b/components/viz/common/server_gpu_memory_buffer_manager.cc
index 7690382b8dd4f98f237aa35b1025f30b11744d33..8b31b1158fb2a1d86093cc5fca2ed414ce898c08 100644
--- a/components/viz/common/server_gpu_memory_buffer_manager.cc
+++ b/components/viz/common/server_gpu_memory_buffer_manager.cc
@@ -47,14 +47,18 @@ void ServerGpuMemoryBufferManager::AllocateGpuMemoryBuffer(
}
}
- DCHECK(gpu::GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage))
- << static_cast<int>(usage);
- task_runner_->PostTask(
- FROM_HERE,
- base::BindOnce(
- std::move(callback),
- gpu::GpuMemoryBufferImplSharedMemory::CreateGpuMemoryBuffer(id, size,
- format)));
+ gfx::GpuMemoryBufferHandle buffer_handle;
+ // The requests are coming in from untrusted clients. So verify that it is
+ // possible to allocate shared memory buffer first.
+ if (gpu::GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage) &&
+ gpu::GpuMemoryBufferImplSharedMemory::IsSizeValidForFormat(size,
+ format)) {
+ buffer_handle = gpu::GpuMemoryBufferImplSharedMemory::CreateGpuMemoryBuffer(
+ id, size, format);
+ }
+
+ task_runner_->PostTask(FROM_HERE,
+ base::BindOnce(std::move(callback), buffer_handle));
}
std::unique_ptr<gfx::GpuMemoryBuffer>
« no previous file with comments | « no previous file | components/viz/common/server_gpu_memory_buffer_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698