Index: content/common/gpu/gpu_command_buffer_stub.cc |
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc |
index e14cf986092b9c8817dcd3024e2474890734c368..423d2e54f1fba61cffd3feea7262ee153e43cce1 100644 |
--- a/content/common/gpu/gpu_command_buffer_stub.cc |
+++ b/content/common/gpu/gpu_command_buffer_stub.cc |
@@ -940,11 +940,12 @@ void GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback( |
} |
} |
-void GpuCommandBufferStub::OnCreateImage(int32 id, |
- gfx::GpuMemoryBufferHandle handle, |
- gfx::Size size, |
- gfx::GpuMemoryBuffer::Format format, |
- uint32 internalformat) { |
+void GpuCommandBufferStub::OnCreateImage( |
+ int32 id, |
+ std::vector<gfx::GpuMemoryBufferHandle> handles, |
+ gfx::Size size, |
+ std::vector<gfx::GpuMemoryBuffer::Format> formats, |
+ uint32 internalformat) { |
TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateImage"); |
if (!decoder_) |
@@ -957,26 +958,32 @@ void GpuCommandBufferStub::OnCreateImage(int32 id, |
return; |
} |
- if (!gpu::ImageFactory::IsGpuMemoryBufferFormatSupported( |
- format, decoder_->GetCapabilities())) { |
- LOG(ERROR) << "Format is not supported."; |
- return; |
- } |
+ int num_buffers = |
+ gpu::ImageFactory::GpuMemoryBufferCountForImageFormat(internalformat); |
+ CHECK_EQ(static_cast<int>(handles.size()), num_buffers); |
reveman
2015/03/10 04:27:21
CHECKS here makes it possible for a malicious rend
emircan
2015/03/11 18:36:35
Done.
|
+ CHECK_EQ(static_cast<int>(formats.size()), num_buffers); |
- if (!gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(size, |
- format)) { |
- LOG(ERROR) << "Invalid image size for format."; |
- return; |
- } |
- |
- if (!gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
- internalformat, format)) { |
- LOG(ERROR) << "Incompatible image format."; |
- return; |
+ for (int i = 0; i < num_buffers; ++i) { |
+ const gfx::GpuMemoryBuffer::Format& format = formats[i]; |
+ if (!gpu::ImageFactory::IsGpuMemoryBufferFormatSupported( |
+ format, decoder_->GetCapabilities())) { |
+ LOG(ERROR) << "Format is not supported."; |
+ return; |
+ } |
+ if (!gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat( |
+ size, format)) { |
+ LOG(ERROR) << "Invalid image size for format."; |
+ return; |
+ } |
+ if (!gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
+ internalformat, i, format)) { |
+ LOG(ERROR) << "Incompatible image format."; |
+ return; |
+ } |
} |
- scoped_refptr<gfx::GLImage> image = channel()->CreateImageForGpuMemoryBuffer( |
- handle, size, format, internalformat); |
+ scoped_refptr<gfx::GLImage> image = channel()->CreateImageForGpuMemoryBuffers( |
+ handles, size, formats, internalformat); |
if (!image.get()) |
return; |