| 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..8ebd1f8da4ea2111ac61b31b0702f67bc3ee16b1 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,21 @@
|
|
|
| #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) {
|
| + // Nothing to do here. |native_pixmap| will be freed when this function
|
| + // returns and reference count drops to 0.
|
| +}
|
| +
|
| +} // namespace
|
|
|
| GpuMemoryBufferImplOzoneNativePixmap::GpuMemoryBufferImplOzoneNativePixmap(
|
| gfx::GpuMemoryBufferId id,
|
| @@ -20,7 +31,7 @@ GpuMemoryBufferImplOzoneNativePixmap::GpuMemoryBufferImplOzoneNativePixmap(
|
| GpuMemoryBufferImplOzoneNativePixmap::~GpuMemoryBufferImplOzoneNativePixmap() {}
|
|
|
| // static
|
| -scoped_ptr<GpuMemoryBufferImpl>
|
| +scoped_ptr<GpuMemoryBufferImplOzoneNativePixmap>
|
| GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle(
|
| const gfx::GpuMemoryBufferHandle& handle,
|
| const gfx::Size& size,
|
| @@ -35,6 +46,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;
|
|
|