Index: content/common/gpu/gpu_memory_buffer_factory_shared_memory.cc |
diff --git a/content/common/gpu/gpu_memory_buffer_factory_shared_memory.cc b/content/common/gpu/gpu_memory_buffer_factory_shared_memory.cc |
index 790fcab9f8ae4bfcda1daba8d4b1638a446cdb03..e82a15c38e44ebc73a9af9d7bed2ad5d6d18c897 100644 |
--- a/content/common/gpu/gpu_memory_buffer_factory_shared_memory.cc |
+++ b/content/common/gpu/gpu_memory_buffer_factory_shared_memory.cc |
@@ -24,7 +24,8 @@ void GpuMemoryBufferFactorySharedMemory:: |
std::vector<Configuration>* configurations) { |
const Configuration supported_configurations[] = { |
{ gfx::GpuMemoryBuffer::RGBA_8888, gfx::GpuMemoryBuffer::MAP }, |
- { gfx::GpuMemoryBuffer::BGRA_8888, gfx::GpuMemoryBuffer::MAP } |
+ { gfx::GpuMemoryBuffer::BGRA_8888, gfx::GpuMemoryBuffer::MAP }, |
+ { gfx::GpuMemoryBuffer::YUV_420, gfx::GpuMemoryBuffer::MAP } |
}; |
configurations->assign( |
supported_configurations, |
@@ -39,19 +40,12 @@ GpuMemoryBufferFactorySharedMemory::CreateGpuMemoryBuffer( |
gfx::GpuMemoryBuffer::Usage usage, |
int client_id, |
gfx::PluginWindowHandle surface_handle) { |
- base::SharedMemory shared_memory; |
- |
- size_t stride_in_bytes = 0; |
- if (!GpuMemoryBufferImpl::StrideInBytes( |
- size.width(), format, &stride_in_bytes)) |
+ size_t buffer_size = 0u; |
+ if (!GpuMemoryBufferImpl::BufferSizeInBytes(size, format, &buffer_size)) |
return gfx::GpuMemoryBufferHandle(); |
- base::CheckedNumeric<size_t> size_in_bytes = stride_in_bytes; |
- size_in_bytes *= size.height(); |
- if (!size_in_bytes.IsValid()) |
- return gfx::GpuMemoryBufferHandle(); |
- |
- if (!shared_memory.CreateAnonymous(size_in_bytes.ValueOrDie())) |
+ base::SharedMemory shared_memory; |
+ if (!shared_memory.CreateAnonymous(buffer_size)) |
return gfx::GpuMemoryBufferHandle(); |
gfx::GpuMemoryBufferHandle handle; |