Chromium Code Reviews| Index: content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc |
| diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc b/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc |
| index afeeb2ca4747066483effec62b104d74c99a8868..52751480868dfcf5a4b7609e7b0acbeb09e60e92 100644 |
| --- a/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc |
| +++ b/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc |
| @@ -4,10 +4,20 @@ |
| #include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h" |
| +#include "content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.h" |
| #include "ui/ozone/public/client_native_pixmap_factory.h" |
| +#include "ui/ozone/public/native_pixmap.h" |
| +#include "ui/ozone/public/ozone_platform.h" |
| #include "ui/ozone/public/surface_factory_ozone.h" |
| namespace content { |
| +namespace { |
| + |
| +void FreeNativePixmapForTesting(scoped_refptr<ui::NativePixmap> native_pixmap) { |
| + native_pixmap = nullptr; |
|
piman
2015/10/07 01:20:17
nit: that doesn't really do anything.
reveman
2015/10/07 09:05:01
Replaced it with a comment.
|
| +} |
| + |
| +} // namespace |
| GpuMemoryBufferImplOzoneNativePixmap::GpuMemoryBufferImplOzoneNativePixmap( |
| gfx::GpuMemoryBufferId id, |
| @@ -20,7 +30,7 @@ GpuMemoryBufferImplOzoneNativePixmap::GpuMemoryBufferImplOzoneNativePixmap( |
| GpuMemoryBufferImplOzoneNativePixmap::~GpuMemoryBufferImplOzoneNativePixmap() {} |
| // static |
| -scoped_ptr<GpuMemoryBufferImpl> |
| +scoped_ptr<GpuMemoryBufferImplOzoneNativePixmap> |
| GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle( |
| const gfx::GpuMemoryBufferHandle& handle, |
| const gfx::Size& size, |
| @@ -35,6 +45,29 @@ GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle( |
| handle.id, size, format, callback, native_pixmap.Pass())); |
| } |
| +// static |
| +bool GpuMemoryBufferImplOzoneNativePixmap::IsConfigurationSupported( |
| + gfx::BufferFormat format, |
| + gfx::BufferUsage usage) { |
| + return GpuMemoryBufferFactoryOzoneNativePixmap:: |
| + IsGpuMemoryBufferConfigurationSupported(format, usage); |
| +} |
| + |
| +// static |
| +base::Closure GpuMemoryBufferImplOzoneNativePixmap::AllocateForTesting( |
| + const gfx::Size& size, |
| + gfx::BufferFormat format, |
| + gfx::BufferUsage usage, |
| + gfx::GpuMemoryBufferHandle* handle) { |
| + scoped_refptr<ui::NativePixmap> pixmap = |
| + ui::OzonePlatform::GetInstance() |
| + ->GetSurfaceFactoryOzone() |
| + ->CreateNativePixmap(gfx::kNullPluginWindow, size, format, usage); |
| + handle->type = gfx::OZONE_NATIVE_PIXMAP; |
| + handle->native_pixmap_handle = pixmap->ExportHandle(); |
| + return base::Bind(&FreeNativePixmapForTesting, pixmap); |
| +} |
| + |
| bool GpuMemoryBufferImplOzoneNativePixmap::Map(void** data) { |
| *data = pixmap_->Map(); |
| mapped_ = true; |