diff --git a/DEPS b/DEPS index 8fed4b24..93c1ad06 100644 --- a/DEPS +++ b/DEPS
@@ -78,7 +78,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '0e3d6c55971ed18331dba0fdbb48bd084143066d', + 'v8_revision': '65cf9fda83625d96f0bd94497d4fdada6828ed11', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other.
diff --git a/third_party/WebKit/public/blink_typemaps.gni b/third_party/WebKit/public/blink_typemaps.gni index 199c8c1..535da553 100644 --- a/third_party/WebKit/public/blink_typemaps.gni +++ b/third_party/WebKit/public/blink_typemaps.gni
@@ -13,4 +13,5 @@ "//services/viz/public/cpp/compositing/surface_id.typemap", "//services/viz/public/cpp/compositing/surface_info.typemap", "//services/viz/public/cpp/compositing/surface_sequence.typemap", + "//ui/gfx/mojo/gpu_fence_handle_for_blink.typemap", ]
diff --git a/ui/gfx/mojo/BUILD.gn b/ui/gfx/mojo/BUILD.gn index 0e18fcc..2556944 100644 --- a/ui/gfx/mojo/BUILD.gn +++ b/ui/gfx/mojo/BUILD.gn
@@ -10,6 +10,7 @@ "buffer_types.mojom", "ca_layer_params.mojom", "color_space.mojom", + "gpu_fence_handle.mojom", "icc_profile.mojom", "overlay_transform.mojom", "selection_bound.mojom",
diff --git a/ui/gfx/mojo/gpu_fence_handle.mojom b/ui/gfx/mojo/gpu_fence_handle.mojom new file mode 100644 index 0000000..3b5807c9 --- /dev/null +++ b/ui/gfx/mojo/gpu_fence_handle.mojom
@@ -0,0 +1,16 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module gfx.mojom; + +// See ui/gfx/ipc/gpu_fence_handle.h +enum GpuFenceHandleType { + kEmpty, + kAndroidNativeFenceSync, +}; + +struct GpuFenceHandle { + GpuFenceHandleType type; + handle? native_fd; +};
diff --git a/ui/gfx/mojo/gpu_fence_handle.typemap b/ui/gfx/mojo/gpu_fence_handle.typemap new file mode 100644 index 0000000..82c9ac6 --- /dev/null +++ b/ui/gfx/mojo/gpu_fence_handle.typemap
@@ -0,0 +1,14 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +mojom = "//ui/gfx/mojo/gpu_fence_handle.mojom" +public_headers = [ "//ui/gfx/gpu_fence_handle.h" ] +traits_headers = [ "//ui/gfx/mojo/gpu_fence_handle_struct_traits.h" ] +sources = [ + "//ui/gfx/mojo/gpu_fence_handle_struct_traits.cc", +] +deps = [ + "//ui/gfx", +] +type_mappings = [ "gfx.mojom.GpuFenceHandle=::gfx::GpuFenceHandle" ]
diff --git a/ui/gfx/mojo/gpu_fence_handle_for_blink.typemap b/ui/gfx/mojo/gpu_fence_handle_for_blink.typemap new file mode 100644 index 0000000..5b4b4e3 --- /dev/null +++ b/ui/gfx/mojo/gpu_fence_handle_for_blink.typemap
@@ -0,0 +1,12 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +mojom = "//ui/gfx/mojo/gpu_fence_handle.mojom" +public_headers = [ "//ui/gfx/gpu_fence_handle.h" ] +traits_headers = [ "//ui/gfx/mojo/gpu_fence_handle_struct_traits.h" ] +public_deps = [ + "//mojo/public/cpp/bindings", + "//ui/gfx/mojo:mojo", +] +type_mappings = [ "gfx.mojom.GpuFenceHandle=::gfx::GpuFenceHandle" ]
diff --git a/ui/gfx/mojo/gpu_fence_handle_struct_traits.cc b/ui/gfx/mojo/gpu_fence_handle_struct_traits.cc new file mode 100644 index 0000000..876489ad --- /dev/null +++ b/ui/gfx/mojo/gpu_fence_handle_struct_traits.cc
@@ -0,0 +1,46 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/gfx/mojo/gpu_fence_handle_struct_traits.h" + +#include "build/build_config.h" +#include "mojo/public/cpp/system/platform_handle.h" + +namespace mojo { + +mojo::ScopedHandle 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); +#else + return mojo::ScopedHandle(); +#endif +} + +bool StructTraits<gfx::mojom::GpuFenceHandleDataView, gfx::GpuFenceHandle>:: + Read(gfx::mojom::GpuFenceHandleDataView data, gfx::GpuFenceHandle* out) { + if (!data.ReadType(&out->type)) + return false; + + 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); + return true; +#else + NOTREACHED(); + return false; +#endif + } + return true; +} + +} // namespace mojo
diff --git a/ui/gfx/mojo/gpu_fence_handle_struct_traits.h b/ui/gfx/mojo/gpu_fence_handle_struct_traits.h new file mode 100644 index 0000000..d7f37d0 --- /dev/null +++ b/ui/gfx/mojo/gpu_fence_handle_struct_traits.h
@@ -0,0 +1,52 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_GFX_MOJO_GPU_FENCE_HANDLE_STRUCT_TRAITS_H_ +#define UI_GFX_MOJO_GPU_FENCE_HANDLE_STRUCT_TRAITS_H_ + +#include "ui/gfx/gpu_fence_handle.h" +#include "ui/gfx/mojo/gpu_fence_handle.mojom.h" + +namespace mojo { + +template <> +struct EnumTraits<gfx::mojom::GpuFenceHandleType, gfx::GpuFenceHandleType> { + static gfx::mojom::GpuFenceHandleType ToMojom(gfx::GpuFenceHandleType type) { + switch (type) { + case gfx::GpuFenceHandleType::kEmpty: + return gfx::mojom::GpuFenceHandleType::kEmpty; + case gfx::GpuFenceHandleType::kAndroidNativeFenceSync: + return gfx::mojom::GpuFenceHandleType::kAndroidNativeFenceSync; + } + NOTREACHED(); + return gfx::mojom::GpuFenceHandleType::kEmpty; + } + + static bool FromMojom(gfx::mojom::GpuFenceHandleType input, + gfx::GpuFenceHandleType* out) { + switch (input) { + case gfx::mojom::GpuFenceHandleType::kEmpty: + *out = gfx::GpuFenceHandleType::kEmpty; + return true; + case gfx::mojom::GpuFenceHandleType::kAndroidNativeFenceSync: + *out = gfx::GpuFenceHandleType::kAndroidNativeFenceSync; + return true; + } + return false; + } +}; + +template <> +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 bool Read(gfx::mojom::GpuFenceHandleDataView data, + gfx::GpuFenceHandle* handle); +}; + +} // namespace mojo + +#endif // UI_GFX_MOJO_GPU_FENCE_HANDLE_STRUCT_TRAITS_H_
diff --git a/ui/gfx/typemaps.gni b/ui/gfx/typemaps.gni index bc301d9..07e2267c 100644 --- a/ui/gfx/typemaps.gni +++ b/ui/gfx/typemaps.gni
@@ -9,6 +9,7 @@ "//ui/gfx/mojo/buffer_types.typemap", "//ui/gfx/mojo/ca_layer_params.typemap", "//ui/gfx/mojo/color_space.typemap", + "//ui/gfx/mojo/gpu_fence_handle.typemap", "//ui/gfx/mojo/icc_profile.typemap", "//ui/gfx/mojo/overlay_transform.typemap", "//ui/gfx/mojo/selection_bound.typemap",