| 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;
|
| }
|
|
|