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

Unified Diff: content/common/child_process_host_impl.cc

Issue 701033005: content: Move type selection logic out of GpuMemoryBufferImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review feedback Created 6 years, 1 month 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
Index: content/common/child_process_host_impl.cc
diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
index 8e1f56f694f2983140c40eefa89d37ebd8a40f71..fe2e55aae49ff4b44f9bbfc9beaeffd62bc4e526 100644
--- a/content/common/child_process_host_impl.cc
+++ b/content/common/child_process_host_impl.cc
@@ -320,16 +320,13 @@ void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer(
gfx::GpuMemoryBuffer::Format format,
gfx::GpuMemoryBuffer::Usage usage,
IPC::Message* reply) {
- base::CheckedNumeric<int> size = width;
- size *= height;
- if (!size.IsValid()) {
- GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle());
- return;
- }
-
// TODO(reveman): Add support for other types of GpuMemoryBuffers.
- if (!GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
- gfx::Size(width, height), format, usage)) {
+
+ // AllocateForChildProcess() will check if |width| and |height| are valid
+ // and handle failure in a controlled way when not. We just need to make
+ // sure |format| and |usage| are supported here.
+ if (!GpuMemoryBufferImplSharedMemory::IsFormatSupported(format) ||
+ !GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage)) {
GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle());
return;
}
« no previous file with comments | « content/common/android/surface_texture_manager.h ('k') | content/common/gpu/client/gpu_memory_buffer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698