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

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

Issue 1263323004: Add NativePixmapHandle type & interface for exporting them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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_ozone_native_pixmap.cc
diff --git a/content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc b/content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc
index d3e0576124a9be60c8f6e67f2dddfbc0ca0f63d8..d54ee2180cdef90ada8a406309ddc3e9d90ec038 100644
--- a/content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc
+++ b/content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc
@@ -5,6 +5,7 @@
#include "content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.h"
#include "ui/gl/gl_image_ozone_native_pixmap.h"
+#include "ui/ozone/public/client_native_pixmap.h"
#include "ui/ozone/public/client_native_pixmap_factory.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/surface_factory_ozone.h"
@@ -70,15 +71,23 @@ GpuMemoryBufferFactoryOzoneNativePixmap::CreateGpuMemoryBuffer(
<< ", usage " << static_cast<int>(usage);
return gfx::GpuMemoryBufferHandle();
}
- base::AutoLock lock(native_pixmaps_lock_);
- NativePixmapMapKey key(id, client_id);
- DCHECK(native_pixmaps_.find(key) == native_pixmaps_.end())
- << "pixmap with this key must not exist";
- native_pixmaps_[key] = pixmap;
gfx::GpuMemoryBufferHandle handle;
handle.type = gfx::OZONE_NATIVE_PIXMAP;
handle.id = id;
+
+ if (usage == gfx::BufferUsage::MAP &&
reveman 2015/08/05 04:18:00 Can you remove the MAP check from here and not fai
spang 2015/08/05 13:26:15 Done.. now it imports scanout as well. It is not
+ !pixmap->ExportHandle(&handle.native_pixmap_handle))
+ return gfx::GpuMemoryBufferHandle();
+
+ {
+ base::AutoLock lock(native_pixmaps_lock_);
+ NativePixmapMapKey key(id, client_id);
+ DCHECK(native_pixmaps_.find(key) == native_pixmaps_.end())
+ << "pixmap with this key must not exist";
+ native_pixmaps_[key] = pixmap;
+ }
+
return handle;
}

Powered by Google App Engine
This is Rietveld 408576698