Chromium Code Reviews| Index: content/common/gpu/gpu_memory_buffer_factory_android.cc |
| diff --git a/content/common/gpu/gpu_memory_buffer_factory_android.cc b/content/common/gpu/gpu_memory_buffer_factory_android.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3fb6706a246e1915528542c3b45590756cd9f3aa |
| --- /dev/null |
| +++ b/content/common/gpu/gpu_memory_buffer_factory_android.cc |
| @@ -0,0 +1,66 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/common/gpu/gpu_memory_buffer_factory.h" |
| + |
| +#include "ui/gl/gl_image.h" |
| +#include "ui/gl/gl_image_shared_memory.h" |
| +#include "ui/gl/gl_image_surface_texture.h" |
| + |
| +namespace content { |
| +namespace { |
| + |
| +class GpuMemoryBufferFactoryImpl : public GpuMemoryBufferFactory { |
| + public: |
| + // Overridden from GpuMemoryBufferFactory: |
| + virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
| + const gfx::GpuMemoryBufferHandle& handle, |
| + const gfx::Size& size, |
| + unsigned internalformat, |
| + unsigned usage) OVERRIDE { |
| + NOTREACHED(); |
|
alexst (slow to review)
2014/07/11 19:50:03
Maybe NOTIMPLEMENTED() is better? It could be reac
danakj
2014/07/11 20:20:24
I'd agree if the renderer process can cause this,
reveman
2014/07/11 21:08:06
There's no missing implementation here as the brow
|
| + return gfx::GpuMemoryBufferHandle(); |
| + } |
| + virtual void DestroyGpuMemoryBuffer( |
| + const gfx::GpuMemoryBufferHandle& handle) OVERRIDE { |
| + NOTREACHED(); |
| + } |
| + virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( |
| + const gfx::GpuMemoryBufferHandle& handle, |
| + const gfx::Size& size, |
| + unsigned internalformat, |
| + int client_id) OVERRIDE { |
| + switch (handle.type) { |
| + case gfx::SHARED_MEMORY_BUFFER: { |
| + scoped_refptr<gfx::GLImageSharedMemory> image( |
| + new gfx::GLImageSharedMemory(size, internalformat)); |
| + if (!image->Initialize(handle)) |
| + return NULL; |
| + |
| + return image; |
| + } |
| + case gfx::SURFACE_TEXTURE_BUFFER: { |
| + scoped_refptr<gfx::GLImageSurfaceTexture> image( |
| + new gfx::GLImageSurfaceTexture(size)); |
| + if (!image->Initialize(handle)) |
| + return NULL; |
| + |
| + return image; |
| + } |
| + default: |
| + NOTREACHED(); |
| + return scoped_refptr<gfx::GLImage>(); |
| + } |
| + } |
| +}; |
| + |
| +} // namespace |
| + |
| +// static |
| +scoped_ptr<GpuMemoryBufferFactory> GpuMemoryBufferFactory::Create() { |
| + return make_scoped_ptr<GpuMemoryBufferFactory>( |
| + new GpuMemoryBufferFactoryImpl); |
| +} |
| + |
| +} // namespace content |