Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: content/common/gpu/gpu_memory_buffer_factory_android.cc

Issue 634643002: content: Out-of-process GPU service support for SurfaceTexture backed GpuMemoryBuffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one last build fix Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
index db34d1a67b64c75ae8e09e6440345cb4cb2305cd..03f9aba42785753a6890ae1263439702616180f1 100644
--- a/content/common/gpu/gpu_memory_buffer_factory_android.cc
+++ b/content/common/gpu/gpu_memory_buffer_factory_android.cc
@@ -5,9 +5,9 @@
#include "content/common/gpu/gpu_memory_buffer_factory.h"
#include "base/logging.h"
+#include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.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 {
@@ -20,12 +20,25 @@ class GpuMemoryBufferFactoryImpl : public GpuMemoryBufferFactory {
const gfx::Size& size,
unsigned internalformat,
unsigned usage) override {
- NOTREACHED();
- return gfx::GpuMemoryBufferHandle();
+ switch (handle.type) {
+ case gfx::SURFACE_TEXTURE_BUFFER:
+ return surface_texture_factory_.CreateGpuMemoryBuffer(
+ handle.global_id, size, internalformat);
+ default:
+ NOTREACHED();
+ return gfx::GpuMemoryBufferHandle();
+ }
}
virtual void DestroyGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle) override {
- NOTREACHED();
+ switch (handle.type) {
+ case gfx::SURFACE_TEXTURE_BUFFER:
+ surface_texture_factory_.DestroyGpuMemoryBuffer(handle.global_id);
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
}
virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle,
@@ -42,18 +55,21 @@ class GpuMemoryBufferFactoryImpl : public GpuMemoryBufferFactory {
return image;
}
case gfx::SURFACE_TEXTURE_BUFFER: {
- scoped_refptr<gfx::GLImageSurfaceTexture> image(
- new gfx::GLImageSurfaceTexture(size));
- if (!image->Initialize(handle))
- return NULL;
+ // Verify that client is the owner of the buffer we're about to use.
+ if (handle.global_id.secondary_id != client_id)
+ return scoped_refptr<gfx::GLImage>();
- return image;
+ return surface_texture_factory_.CreateImageForGpuMemoryBuffer(
+ handle.global_id, size, internalformat);
}
default:
NOTREACHED();
return scoped_refptr<gfx::GLImage>();
}
}
+
+ private:
+ GpuMemoryBufferFactorySurfaceTexture surface_texture_factory_;
};
} // namespace
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.cc ('k') | content/common/gpu/gpu_memory_buffer_factory_surface_texture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698