| 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
|
|
|