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

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

Issue 604903005: content: Move IOSurface backed GpuMemoryBuffer allocation to GPU process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include CoreFoundation.h Created 6 years, 3 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
« no previous file with comments | « content/common/gpu/gpu_memory_buffer_factory_io_surface.cc ('k') | content/content_common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_memory_buffer_factory_mac.cc
diff --git a/content/common/gpu/gpu_memory_buffer_factory_mac.cc b/content/common/gpu/gpu_memory_buffer_factory_mac.cc
index 71defa27b6a68f8a9177331f3034f526cd8332a4..e9e4215943c210ff84f9677978aacde11a8c1559 100644
--- a/content/common/gpu/gpu_memory_buffer_factory_mac.cc
+++ b/content/common/gpu/gpu_memory_buffer_factory_mac.cc
@@ -5,8 +5,8 @@
#include "content/common/gpu/gpu_memory_buffer_factory.h"
#include "base/logging.h"
+#include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h"
#include "ui/gl/gl_image.h"
-#include "ui/gl/gl_image_io_surface.h"
#include "ui/gl/gl_image_shared_memory.h"
namespace content {
@@ -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::IO_SURFACE_BUFFER:
+ return io_surface_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::IO_SURFACE_BUFFER:
+ io_surface_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::IO_SURFACE_BUFFER: {
- scoped_refptr<gfx::GLImageIOSurface> image(
- new gfx::GLImageIOSurface(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 io_surface_factory_.CreateImageForGpuMemoryBuffer(
+ handle.global_id, size, internalformat);
}
default:
NOTREACHED();
return scoped_refptr<gfx::GLImage>();
}
}
+
+ private:
+ GpuMemoryBufferFactoryIOSurface io_surface_factory_;
};
} // namespace
« no previous file with comments | « content/common/gpu/gpu_memory_buffer_factory_io_surface.cc ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698