| Index: ui/gl/gl_image_shared_memory.cc
|
| diff --git a/ui/gl/gl_image_shared_memory.cc b/ui/gl/gl_image_shared_memory.cc
|
| index 7c615f8efabc9f191267995c96b1a55092799d04..4aa255b03df7edb15b46936eba3af6bf5df3da3a 100644
|
| --- a/ui/gl/gl_image_shared_memory.cc
|
| +++ b/ui/gl/gl_image_shared_memory.cc
|
| @@ -18,10 +18,8 @@ GLImageSharedMemory::~GLImageSharedMemory() {
|
| DCHECK(!shared_memory_);
|
| }
|
|
|
| -bool GLImageSharedMemory::Initialize(const gfx::GpuMemoryBufferHandle& handle) {
|
| - if (!HasValidFormat())
|
| - return false;
|
| -
|
| +bool GLImageSharedMemory::Initialize(const gfx::GpuMemoryBufferHandle& handle,
|
| + gfx::GpuMemoryBuffer::Format format) {
|
| if (!base::SharedMemory::IsHandleValid(handle.handle))
|
| return false;
|
|
|
| @@ -37,16 +35,18 @@ bool GLImageSharedMemory::Initialize(const gfx::GpuMemoryBufferHandle& handle) {
|
|
|
| scoped_ptr<base::SharedMemory> duped_shared_memory(
|
| new base::SharedMemory(duped_shared_memory_handle, true));
|
| -
|
| - if (!duped_shared_memory->Map(Bytes())) {
|
| + if (!duped_shared_memory->Map(GetSize().GetArea() * BytesPerPixel(format))) {
|
| DVLOG(0) << "Failed to map shared memory.";
|
| return false;
|
| }
|
|
|
| + if (!GLImageMemory::Initialize(
|
| + static_cast<unsigned char*>(duped_shared_memory->memory()), format)) {
|
| + return false;
|
| + }
|
| +
|
| DCHECK(!shared_memory_);
|
| shared_memory_ = duped_shared_memory.Pass();
|
| - GLImageMemory::Initialize(
|
| - static_cast<unsigned char*>(shared_memory_->memory()));
|
| return true;
|
| }
|
|
|
|
|