Commit 8db4aa72 authored by Robert Sesek's avatar Robert Sesek Committed by Commit Bot

Convert ui/gfx/mojom/gpu_fence_handle.mojom to handle<platform>

Bug: 710376
Change-Id: I555f26ba836a12ba59547e9bc8db8430fe2965e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2085116Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746956}
parent 522277b8
......@@ -12,5 +12,5 @@ enum GpuFenceHandleType {
struct GpuFenceHandle {
GpuFenceHandleType type;
handle? native_fd;
handle<platform>? native_fd;
};
......@@ -9,15 +9,15 @@
namespace mojo {
mojo::ScopedHandle StructTraits<
mojo::PlatformHandle StructTraits<
gfx::mojom::GpuFenceHandleDataView,
gfx::GpuFenceHandle>::native_fd(const gfx::GpuFenceHandle& handle) {
#if defined(OS_POSIX)
if (handle.type != gfx::GpuFenceHandleType::kAndroidNativeFenceSync)
return mojo::ScopedHandle();
return mojo::WrapPlatformFile(handle.native_fd.fd);
return mojo::PlatformHandle();
return mojo::PlatformHandle(base::ScopedFD(handle.native_fd.fd));
#else
return mojo::ScopedHandle();
return mojo::PlatformHandle();
#endif
}
......@@ -28,12 +28,9 @@ bool StructTraits<gfx::mojom::GpuFenceHandleDataView, gfx::GpuFenceHandle>::
if (out->type == gfx::GpuFenceHandleType::kAndroidNativeFenceSync) {
#if defined(OS_POSIX)
base::PlatformFile platform_file;
if (mojo::UnwrapPlatformFile(data.TakeNativeFd(), &platform_file) !=
MOJO_RESULT_OK)
return false;
constexpr bool auto_close = true;
out->native_fd = base::FileDescriptor(platform_file, auto_close);
out->native_fd =
base::FileDescriptor(data.TakeNativeFd().ReleaseFD(), auto_close);
return true;
#else
NOTREACHED();
......
......@@ -42,7 +42,7 @@ struct StructTraits<gfx::mojom::GpuFenceHandleDataView, gfx::GpuFenceHandle> {
static gfx::GpuFenceHandleType type(const gfx::GpuFenceHandle& handle) {
return handle.type;
}
static mojo::ScopedHandle native_fd(const gfx::GpuFenceHandle& handle);
static mojo::PlatformHandle native_fd(const gfx::GpuFenceHandle& handle);
static bool Read(gfx::mojom::GpuFenceHandleDataView data,
gfx::GpuFenceHandle* handle);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment