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

Unified Diff: ui/gfx/native_pixmap_handle.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/native_pixmap_handle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/native_pixmap_handle.cc
diff --git a/ui/gfx/native_pixmap_handle.cc b/ui/gfx/native_pixmap_handle.cc
index f0144a84c02a2e4b0baf9b4b6b1ee28f620fdd4a..c58c38bdf099f58b575fa963b0c58f429097dbdd 100644
--- a/ui/gfx/native_pixmap_handle.cc
+++ b/ui/gfx/native_pixmap_handle.cc
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <stdint.h>
-
#include "ui/gfx/native_pixmap_handle.h"
+#if defined(USE_OZONE)
+#include "base/posix/eintr_wrapper.h"
+#endif
+
namespace gfx {
NativePixmapPlane::NativePixmapPlane()
@@ -27,4 +29,23 @@ NativePixmapHandle::NativePixmapHandle(const NativePixmapHandle& other) =
NativePixmapHandle::~NativePixmapHandle() {}
+#if defined(USE_OZONE)
+NativePixmapHandle CloneHandleForIPC(const NativePixmapHandle& handle) {
+ NativePixmapHandle clone;
+ std::vector<base::ScopedFD> scoped_fds;
+ for (auto& fd : handle.fds) {
+ base::ScopedFD scoped_fd(HANDLE_EINTR(dup(fd.fd)));
+ if (!scoped_fd.is_valid()) {
+ PLOG(ERROR) << "dup";
+ return NativePixmapHandle();
+ }
+ scoped_fds.emplace_back(std::move(scoped_fd));
+ }
+ for (auto& scoped_fd : scoped_fds)
+ clone.fds.emplace_back(scoped_fd.release(), true /* auto_close */);
+ clone.planes = handle.planes;
+ return clone;
+}
+#endif // defined(USE_OZONE)
+
} // namespace gfx
« no previous file with comments | « ui/gfx/native_pixmap_handle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698