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

Unified Diff: ui/gfx/gpu_memory_buffer.cc

Issue 2531963002: gfx: Fix sending native ozone pixmaps from InProcessCommandBuffer. (Closed)
Patch Set: . Created 4 years, 1 month 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 | « ui/gfx/gpu_memory_buffer.h ('k') | ui/gfx/native_pixmap_handle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/gpu_memory_buffer.cc
diff --git a/ui/gfx/gpu_memory_buffer.cc b/ui/gfx/gpu_memory_buffer.cc
index 569b588d5ad7b80c4c3594bf9d1b05a8ffc2b1ea..fa39142ed4cc6e1ea5e797ae868fa83990551c4f 100644
--- a/ui/gfx/gpu_memory_buffer.cc
+++ b/ui/gfx/gpu_memory_buffer.cc
@@ -18,4 +18,34 @@ GpuMemoryBufferHandle::~GpuMemoryBufferHandle() {}
void GpuMemoryBuffer::SetColorSpaceForScanout(
const gfx::ColorSpace& color_space) {}
+GpuMemoryBufferHandle CloneHandleForIPC(
+ const GpuMemoryBufferHandle& source_handle) {
+ switch (source_handle.type) {
+ case gfx::EMPTY_BUFFER:
+ NOTREACHED();
+ return source_handle;
+ case gfx::SHARED_MEMORY_BUFFER: {
+ gfx::GpuMemoryBufferHandle handle;
+ handle.type = gfx::SHARED_MEMORY_BUFFER;
+ handle.handle = base::SharedMemory::DuplicateHandle(source_handle.handle);
+ handle.offset = source_handle.offset;
+ handle.stride = source_handle.stride;
+ return handle;
+ }
+ case gfx::OZONE_NATIVE_PIXMAP: {
+ gfx::GpuMemoryBufferHandle handle;
+ handle.type = gfx::OZONE_NATIVE_PIXMAP;
+ handle.id = source_handle.id;
+#if defined(USE_OZONE)
+ handle.native_pixmap_handle =
+ gfx::CloneHandleForIPC(source_handle.native_pixmap_handle);
+#endif
+ return handle;
+ }
+ case gfx::IO_SURFACE_BUFFER:
+ return source_handle;
+ }
+ return gfx::GpuMemoryBufferHandle();
+}
+
} // namespace gfx
« no previous file with comments | « ui/gfx/gpu_memory_buffer.h ('k') | ui/gfx/native_pixmap_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698