Date: Sunday, February 27, 2022 @ 12:44:34 Author: tensor5 Revision: 1137578
upgpkg: electron 17.1.0-1 Added: electron/trunk/breakpad-fix-for-non-constant-SIGSTKSZ.patch electron/trunk/downgrade-duplicate-peer-error-to-dvlog.patch electron/trunk/fix-build-break-with-system-libdrm.patch electron/trunk/sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch electron/trunk/use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch Modified: electron/trunk/PKGBUILD electron/trunk/jinja-python-3.10.patch electron/trunk/sql-make-VirtualCursor-standard-layout-type.patch Deleted: electron/trunk/chromium-93-ffmpeg-4.4.patch electron/trunk/chromium-94-ffmpeg-roll.patch electron/trunk/unbundle-fix-visibility-of-build-config-freetype.patch electron/trunk/unexpire-accelerated-video-decode-flag.patch electron/trunk/wayland-fix-binding-to-wrong-version.patch ------------------------------------------------------------+ PKGBUILD | 64 - breakpad-fix-for-non-constant-SIGSTKSZ.patch | 35 chromium-93-ffmpeg-4.4.patch | 36 chromium-94-ffmpeg-roll.patch | 49 downgrade-duplicate-peer-error-to-dvlog.patch | 33 fix-build-break-with-system-libdrm.patch | 62 + jinja-python-3.10.patch | 11 sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch | 39 sql-make-VirtualCursor-standard-layout-type.patch | 94 - unbundle-fix-visibility-of-build-config-freetype.patch | 31 unexpire-accelerated-video-decode-flag.patch | 11 use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch | 72 + wayland-fix-binding-to-wrong-version.patch | 651 ----------- 13 files changed, 319 insertions(+), 869 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2022-02-27 12:24:57 UTC (rev 1137577) +++ PKGBUILD 2022-02-27 12:44:34 UTC (rev 1137578) @@ -1,12 +1,12 @@ # Maintainer: Nicola Squartini <tens...@gmail.com> _use_suffix=0 -pkgver=16.0.8 -_commit=b1ffac5969d0533a479794b909cab7429299bf00 -_chromiumver=96.0.4664.110 -_gcc_patchset=4 +pkgver=17.1.0 +_commit=08efa9a9b92ae67b0ae5c88de5b4699b20bc5d84 +_chromiumver=98.0.4758.102 +_gcc_patchset=5 # shellcheck disable=SC2034 -pkgrel=2 +pkgrel=1 _major_ver=${pkgver%%.*} if [[ ${_use_suffix} != 0 ]]; then @@ -53,29 +53,29 @@ 'jinja-python-3.10.patch' 'std-vector-non-const.patch' 'use-system-libraries-in-node.patch' + 'downgrade-duplicate-peer-error-to-dvlog.patch' + 'fix-build-break-with-system-libdrm.patch' + 'sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch' + 'breakpad-fix-for-non-constant-SIGSTKSZ.patch' + 'use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch' 'sql-make-VirtualCursor-standard-layout-type.patch' - 'wayland-fix-binding-to-wrong-version.patch' - 'unbundle-fix-visibility-of-build-config-freetype.patch' - 'chromium-93-ffmpeg-4.4.patch' - 'chromium-94-ffmpeg-roll.patch' - 'unexpire-accelerated-video-decode-flag.patch' ) # shellcheck disable=SC2034 sha256sums=('SKIP' 'SKIP' - '090af7eab39aade15a1786273f2497d6b4abfaef24279fbf97ce0dd1c38c69aa' + 'f561145514e9d30a696a82f6a6a4eca06e664b58d7cda30dad9afb2cef341a4d' '3953f532a3ea5fce19ee33600c6ead89dcd066df6a01d3c3ab4c24f96e46fca2' '4484200d90b76830b69eea3a471c103999a3ce86bb2c29e6c14c945bf4102bae' '75bac9c4ad32ff9329399b8587f9772e208c009fd822cdfce61b2bd1ee9ac828' - '09de0ebb4002be7fb4ede63d3977e4f1235637750169c9e71bfdbd75bf750f7a' + '55dbe71dbc1f3ab60bf1fa79f7aea7ef1fe76436b1d7df48728a1f8227d2134e' '4fbef42aaa7bf60d059f1a6b0a92dc997d475256110bd4df32c12de7f4f175a7' 'c70652a8b24c237bcfd27469de32797a2cb46d9f0d63d897bb6418314a25644c' - 'dd317f85e5abfdcfc89c6f23f4c8edbcdebdd5e083dcec770e5da49ee647d150' - 'fc2be146412d117869368f8559afef76ad39a3442ace16e5c7000bd45aa56b27' - 'd0b17162211dd49e3a58c16d1697e7d8c322dcfd3b7890f0c2f920b711f52293' - '1a9e074f417f8ffd78bcd6874d8e2e74a239905bf662f76a7755fa40dc476b57' - '56acb6e743d2ab1ed9f3eb01700ade02521769978d03ac43226dec94659b3ace' - '2a97b26c3d6821b15ef4ef1369905c6fa3e9c8da4877eb9af4361452a425290b' + '291c6a6ad44c06ae8d1b13433f0c4e37d280c70fb06eaa97a1cc9b0dcc122aaa' + 'edf4d973ff197409d319bb6fbbaa529e53bc62347d26b0733c45a116a1b23f37' + 'f910be9370c880de6e1d61cc30383c069e421d7acf406166e4fbfad324fc7d61' + 'b4d28867c1fabde6c50a2cfa3f784730446c4d86e5191e0f0000fbf7b0f91ecf' + '9c9c280be968f06d269167943680fb72a26fbb05d8c15f60507e316e8a9075d5' + 'b94b2e88f63cfb7087486508b8139599c89f96d7a4181c61fec4b4e250ca327a' ) _system_libs=('ffmpeg' @@ -153,7 +153,7 @@ src/third_party/depot_tools/download_from_google_storage.py \ --no_resume --extract --no_auth --bucket chromium-nodejs \ -s src/third_party/node/node_modules.tar.gz.sha1 - vpython src/tools/download_optimization_profile.py \ + python src/tools/download_optimization_profile.py \ --newest_state=src/chrome/android/profiles/newest.txt \ --local_state=src/chrome/android/profiles/local.txt \ --output_name=src/chrome/android/profiles/afdo.prof \ @@ -169,22 +169,20 @@ cd .. echo "Applying local patches..." + # Upstream fixes + patch -Np1 -F3 -i ../downgrade-duplicate-peer-error-to-dvlog.patch + patch -Np1 -i ../fix-build-break-with-system-libdrm.patch + patch -Np1 -i ../sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch + patch -Np1 -d third_party//breakpad/breakpad <../breakpad-fix-for-non-constant-SIGSTKSZ.patch + patch -Np1 -d third_party/pdfium <../use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch + + # https://chromium-review.googlesource.com/c/chromium/src/+/2862724 + patch -Np1 -i ../sql-make-VirtualCursor-standard-layout-type.patch + # Fixes for building with libstdc++ instead of libc++ - patch -Np1 -i ../patches/chromium-96-CommandLine-include.patch - patch -Np1 -i ../patches/chromium-96-RestrictedCookieManager-tuple.patch - patch -Np1 -i ../patches/chromium-96-DrmRenderNodePathFinder-include.patch - patch -Np1 -i ../patches/chromium-96-CouponDB-include.patch + #patch -Np1 -i ../patches/ - # Patches to build with ffmpeg 4.4; remove when ffmpeg 5.0 moves to stable - if ! pkg-config --atleast-version 59 libavformat; then - patch -Np1 -i ../chromium-93-ffmpeg-4.4.patch - patch -Rp1 -i ../chromium-94-ffmpeg-roll.patch - fi - - patch -Np1 -i ../unbundle-fix-visibility-of-build-config-freetype.patch - patch -Np1 -i ../sql-make-VirtualCursor-standard-layout-type.patch - patch -Np1 -i ../wayland-fix-binding-to-wrong-version.patch - patch -Np0 -i ../unexpire-accelerated-video-decode-flag.patch + # Electron specific fixes patch -d third_party/electron_node/tools/inspector_protocol/jinja2 \ -Np1 -i ../../../../../../jinja-python-3.10.patch patch -Np1 -i ../use-system-libraries-in-node.patch Added: breakpad-fix-for-non-constant-SIGSTKSZ.patch =================================================================== --- breakpad-fix-for-non-constant-SIGSTKSZ.patch (rev 0) +++ breakpad-fix-for-non-constant-SIGSTKSZ.patch 2022-02-27 12:44:34 UTC (rev 1137578) @@ -0,0 +1,35 @@ +From 605c51ed96ad44b34c457bbca320e74e194c317e Mon Sep 17 00:00:00 2001 +From: David Faure <david.fa...@kdab.com> +Date: Wed, 15 Dec 2021 22:26:40 +0100 +Subject: [PATCH] Fix for non-constant SIGSTKSZ + +On glibc > 2.33, `SIGSTKSZ` might not be constant (in which case +it expands to a call to `sysconf` which returns a `long int`); see +https://sourceware.org/pipermail/libc-alpha/2020-October/118513.html + +Pass unsigned explicitly to std::max, to avoid relying on template +argument deduction. This works both with the old-style constant +`SIGSTKSZ` and the new configurable one. + +Initially based on https://chromium-review.googlesource.com/c/2776379 + +Change-Id: I9fc95337f973e871b84735ce822b5e11ba73ea8c +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3340721 +Reviewed-by: Mark Mentovai <m...@chromium.org> +--- + src/client/linux/handler/exception_handler.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc +index ca353c40..499be0a9 100644 +--- a/src/client/linux/handler/exception_handler.cc ++++ b/src/client/linux/handler/exception_handler.cc +@@ -138,7 +138,7 @@ void InstallAlternateStackLocked() { + // SIGSTKSZ may be too small to prevent the signal handlers from overrunning + // the alternative stack. Ensure that the size of the alternative stack is + // large enough. +- static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ); ++ const unsigned kSigStackSize = std::max<unsigned>(16384, SIGSTKSZ); + + // Only set an alternative stack if there isn't already one, or if the current + // one is too small. Deleted: chromium-93-ffmpeg-4.4.patch =================================================================== --- chromium-93-ffmpeg-4.4.patch 2022-02-27 12:24:57 UTC (rev 1137577) +++ chromium-93-ffmpeg-4.4.patch 2022-02-27 12:44:34 UTC (rev 1137578) @@ -1,36 +0,0 @@ -diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc -index ac4713b07268..492a9a37d096 100644 ---- a/media/filters/ffmpeg_demuxer.cc -+++ b/media/filters/ffmpeg_demuxer.cc -@@ -427,11 +427,11 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) { - scoped_refptr<DecoderBuffer> buffer; - - if (type() == DemuxerStream::TEXT) { -- size_t id_size = 0; -+ int id_size = 0; - uint8_t* id_data = av_packet_get_side_data( - packet.get(), AV_PKT_DATA_WEBVTT_IDENTIFIER, &id_size); - -- size_t settings_size = 0; -+ int settings_size = 0; - uint8_t* settings_data = av_packet_get_side_data( - packet.get(), AV_PKT_DATA_WEBVTT_SETTINGS, &settings_size); - -@@ -443,7 +443,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) { - buffer = DecoderBuffer::CopyFrom(packet->data, packet->size, - side_data.data(), side_data.size()); - } else { -- size_t side_data_size = 0; -+ int side_data_size = 0; - uint8_t* side_data = av_packet_get_side_data( - packet.get(), AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, &side_data_size); - -@@ -504,7 +504,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) { - packet->size - data_offset); - } - -- size_t skip_samples_size = 0; -+ int skip_samples_size = 0; - const uint32_t* skip_samples_ptr = - reinterpret_cast<const uint32_t*>(av_packet_get_side_data( - packet.get(), AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size)); Deleted: chromium-94-ffmpeg-roll.patch =================================================================== --- chromium-94-ffmpeg-roll.patch 2022-02-27 12:24:57 UTC (rev 1137577) +++ chromium-94-ffmpeg-roll.patch 2022-02-27 12:44:34 UTC (rev 1137578) @@ -1,49 +0,0 @@ -From b94755e4633045be96ab5e0bdde0db7e16a804bd Mon Sep 17 00:00:00 2001 -From: "liber...@chromium.org" <liber...@chromium.org> -Date: Fri, 6 Aug 2021 04:25:31 +0000 -Subject: [PATCH] FFmpeg M94 roll. - -Contains DEPS update + chromium-side fixes. - -Bug: 1227259 -Change-Id: I61c5eaa789ea12c17d0cbcbf837435b9cf32479b -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3011889 -Reviewed-by: Thomas Guilbert <tguilb...@chromium.org> -Commit-Queue: Frank Liberato <liber...@chromium.org> -Cr-Commit-Position: refs/heads/master@{#909174} ---- - media/ffmpeg/ffmpeg_common.h | 1 + - media/filters/ffmpeg_demuxer.cc | 4 ++-- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/media/ffmpeg/ffmpeg_common.h b/media/ffmpeg/ffmpeg_common.h -index cede8ac5a7..97d6307e28 100644 ---- a/media/ffmpeg/ffmpeg_common.h -+++ b/media/ffmpeg/ffmpeg_common.h -@@ -29,6 +29,7 @@ extern "C" { - #include <libavformat/avformat.h> - #include <libavformat/avio.h> - #include <libavutil/avutil.h> -+#include <libavutil/channel_layout.h> - #include <libavutil/imgutils.h> - #include <libavutil/log.h> - #include <libavutil/mastering_display_metadata.h> -diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc -index ac4713b072..605001d935 100644 ---- a/media/filters/ffmpeg_demuxer.cc -+++ b/media/filters/ffmpeg_demuxer.cc -@@ -106,12 +106,12 @@ static base::TimeDelta ExtractStartTime(AVStream* stream) { - - // Next try to use the first DTS value, for codecs where we know PTS == DTS - // (excludes all H26x codecs). The start time must be returned in PTS. -- if (stream->first_dts != kNoFFmpegTimestamp && -+ if (av_stream_get_first_dts(stream) != kNoFFmpegTimestamp && - stream->codecpar->codec_id != AV_CODEC_ID_HEVC && - stream->codecpar->codec_id != AV_CODEC_ID_H264 && - stream->codecpar->codec_id != AV_CODEC_ID_MPEG4) { - const base::TimeDelta first_pts = -- ConvertFromTimeBase(stream->time_base, stream->first_dts); -+ ConvertFromTimeBase(stream->time_base, av_stream_get_first_dts(stream)); - if (first_pts < start_time) - start_time = first_pts; - } Added: downgrade-duplicate-peer-error-to-dvlog.patch =================================================================== --- downgrade-duplicate-peer-error-to-dvlog.patch (rev 0) +++ downgrade-duplicate-peer-error-to-dvlog.patch 2022-02-27 12:44:34 UTC (rev 1137578) @@ -0,0 +1,33 @@ +From 00604ca8ed6d669fb6cb3ae8bacd6028d5ef10ac Mon Sep 17 00:00:00 2001 +From: Stephen Roettger <sroett...@google.com> +Date: Thu, 20 Jan 2022 10:04:04 +0000 +Subject: [PATCH] Downgrade duplicate peer error to dvlog +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Downgrading since this case can happen in non-error situations. There can be +duplicate introductions in flight in which case we simply drop the second one. + +Change-Id: I2c51b177913ccd9634e9bb6343d468101d9735ed +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3398794 +Reviewed-by: Ken Rockot <roc...@google.com> +Commit-Queue: Stephen Röttger <sroett...@google.com> +Cr-Commit-Position: refs/heads/main@{#961389} +--- + mojo/core/node_controller.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mojo/core/node_controller.cc b/mojo/core/node_controller.cc +index 7cde7719687..81712676733 100644 +--- a/mojo/core/node_controller.cc ++++ b/mojo/core/node_controller.cc +@@ -594,7 +594,7 @@ void NodeController::AddPeer(const ports::NodeName& name, + } + + if (dropped_peers_.Contains(name)) { +- LOG(ERROR) << "Trying to re-add dropped peer " << name; ++ DVLOG(1) << "Trying to re-add dropped peer " << name; + return; + } + Added: fix-build-break-with-system-libdrm.patch =================================================================== --- fix-build-break-with-system-libdrm.patch (rev 0) +++ fix-build-break-with-system-libdrm.patch 2022-02-27 12:44:34 UTC (rev 1137578) @@ -0,0 +1,62 @@ +From 5b287e0be8d8d8475ec6ef81b16eaa61e19db078 Mon Sep 17 00:00:00 2001 +From: "Steinar H. Gunderson" <se...@chromium.org> +Date: Tue, 25 Jan 2022 19:14:53 +0000 +Subject: [PATCH] Fix build break with system libdrm. + +This patch is submitted on behalf of Andres Salomon +<dilin...@queued.net> (on Cc). Also adding him to src/AUTHORS +per policy, as he has signed the CLA. + +Original patch: +https://salsa.debian.org/dilinger/chromium/-/commit/2333c2fb985ac1ef3d7331776a7833d965c63302 + +Change-Id: I18bd60e2e80f2b9181e74ee7972c3f457ab33b10 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3401704 +Reviewed-by: Andres Calderon Jaramillo <andre...@chromium.org> +Commit-Queue: Steinar H Gunderson <se...@chromium.org> +Auto-Submit: Steinar H Gunderson <se...@chromium.org> +Cr-Commit-Position: refs/heads/main@{#963119} +--- + AUTHORS | 1 + + media/gpu/chromeos/BUILD.gn | 1 + + media/gpu/chromeos/video_decoder_pipeline.cc | 2 +- + 3 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/AUTHORS b/AUTHORS +index 0eba3de5065..50edd3f6b38 100644 +--- a/AUTHORS ++++ b/AUTHORS +@@ -93,6 +93,7 @@ Andreas Papacharalampous <andr...@apap04.com> + Andrei Borza <andrei.bo...@gmail.com> + Andrei Parvu <andrei....@gmail.com> + Andrei Parvu <pa...@adobe.com> ++Andres Salomon <dilin...@queued.net> + Andreu Botella <and...@andreubotella.com> + Andrew Boyarshin <andrew.boyars...@gmail.com> + Andrew Brampton <m...@bramp.net> +diff --git a/media/gpu/chromeos/BUILD.gn b/media/gpu/chromeos/BUILD.gn +index 7cb4c3ea39a..6fe21c15ecc 100644 +--- a/media/gpu/chromeos/BUILD.gn ++++ b/media/gpu/chromeos/BUILD.gn +@@ -25,6 +25,7 @@ source_set("chromeos") { + + deps = [ + "//base", ++ "//build/config/linux/libdrm", + "//media", + "//media/gpu:buildflags", + "//media/gpu:command_buffer_helper", +diff --git a/media/gpu/chromeos/video_decoder_pipeline.cc b/media/gpu/chromeos/video_decoder_pipeline.cc +index d2f154ea0d8..416b9434a8d 100644 +--- a/media/gpu/chromeos/video_decoder_pipeline.cc ++++ b/media/gpu/chromeos/video_decoder_pipeline.cc +@@ -28,8 +28,8 @@ + #include "third_party/abseil-cpp/absl/types/optional.h" + + #if BUILDFLAG(USE_VAAPI) ++#include <drm_fourcc.h> + #include "media/gpu/vaapi/vaapi_video_decoder.h" +-#include "third_party/libdrm/src/include/drm/drm_fourcc.h" + #elif BUILDFLAG(USE_V4L2_CODEC) + #include "media/gpu/v4l2/v4l2_video_decoder.h" + #else Modified: jinja-python-3.10.patch =================================================================== --- jinja-python-3.10.patch 2022-02-27 12:24:57 UTC (rev 1137577) +++ jinja-python-3.10.patch 2022-02-27 12:44:34 UTC (rev 1137578) @@ -20,14 +20,3 @@ from jinja2.environment import Environment from jinja2.exceptions import SecurityError from jinja2._compat import string_types, PY2 ---- a/tests.py -+++ b/tests.py -@@ -10,7 +10,7 @@ - """ - import operator - import re --from collections import Mapping -+from collections.abc import Mapping - from jinja2.runtime import Undefined - from jinja2._compat import text_type, string_types, integer_types - import decimal Added: sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch =================================================================== --- sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch (rev 0) +++ sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch 2022-02-27 12:44:34 UTC (rev 1137578) @@ -0,0 +1,39 @@ +From 28ac6a15411d01301e171b8a8b0019abd57589b9 Mon Sep 17 00:00:00 2001 +From: Stephan Hartmann <sth...@googlemail.com> +Date: Mon, 7 Feb 2022 20:09:57 +0000 +Subject: [PATCH] sandbox: build if glibc 2.34+ dynamic stack size is enabled +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Compilation of sandbox fails when using dynamic stack size in glibc +2.34 or newer. This is because the value is not a literal anymore but +obtained through sysconf. + +To avoid this, use memset to put zeros in the buffer. + +Change-Id: Ia479e0f799b77a10a00197aaaa0500e62546f458 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3436947 +Reviewed-by: Jorge Lucangeli Obes <jorg...@chromium.org> +Commit-Queue: José Dapena Paz <jdap...@igalia.com> +Cr-Commit-Position: refs/heads/main@{#967943} +--- + sandbox/linux/services/credentials.cc | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc +index ca6b5954798..c933eafd163 100644 +--- a/sandbox/linux/services/credentials.cc ++++ b/sandbox/linux/services/credentials.cc +@@ -100,7 +100,10 @@ bool ChrootToSafeEmptyDir() { + // TODO(crbug.com/1247458) Broken in MSan builds after LLVM f1bb30a4956f. + clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS; + +- char tls_buf[PTHREAD_STACK_MIN] = {0}; ++ // PTHREAD_STACK_MIN can be dynamic in glibc2.34+, so it is not possible to ++ // zeroify tls_buf assigning { 0 } ++ char tls_buf[PTHREAD_STACK_MIN]; ++ memset(tls_buf, 0, PTHREAD_STACK_MIN); + tls = tls_buf; + #endif + Modified: sql-make-VirtualCursor-standard-layout-type.patch =================================================================== --- sql-make-VirtualCursor-standard-layout-type.patch 2022-02-27 12:24:57 UTC (rev 1137577) +++ sql-make-VirtualCursor-standard-layout-type.patch 2022-02-27 12:44:34 UTC (rev 1137578) @@ -1,30 +1,29 @@ -From 80368f8ba7a8bab13440463a254888311efe3986 Mon Sep 17 00:00:00 2001 +From 144479ad7b4287bee4067f95e4218f614798a865 Mon Sep 17 00:00:00 2001 From: Stephan Hartmann <sth...@googlemail.com> -Date: Tue, 4 May 2021 15:00:19 +0000 +Date: Sun, 16 Jan 2022 19:15:26 +0000 Subject: [PATCH] sql: make VirtualCursor standard layout type sql::recover::VirtualCursor needs to be a standard layout type, but has members of type std::unique_ptr. However, std::unique_ptr is not guaranteed to be standard layout. Compiling with clang combined with -gcc-11 libstdc++ fails because of this. Replace std::unique_ptr with -raw pointers. +gcc-11 libstdc++ fails because of this. Bug: 1189788 Change-Id: Ia6dc388cc5ef1c0f2afc75f8ca45b9f12687ca9c --- - sql/recover_module/btree.cc | 21 +++++++++++++++------ - sql/recover_module/btree.h | 17 +++++++++++++---- + sql/recover_module/btree.cc | 18 ++++++++++++------ + sql/recover_module/btree.h | 21 +++++++++++++++------ sql/recover_module/cursor.cc | 24 ++++++++++++------------ sql/recover_module/cursor.h | 2 +- - sql/recover_module/pager.cc | 7 +++---- - sql/recover_module/pager.h | 5 +++-- - 6 files changed, 47 insertions(+), 29 deletions(-) + sql/recover_module/pager.cc | 5 ++--- + sql/recover_module/pager.h | 6 +++--- + 6 files changed, 45 insertions(+), 31 deletions(-) diff --git a/sql/recover_module/btree.cc b/sql/recover_module/btree.cc -index 9ecaafe8a3..839318abf9 100644 +index cc9420e5c05..f12d8fa32a2 100644 --- a/sql/recover_module/btree.cc +++ b/sql/recover_module/btree.cc -@@ -135,16 +135,25 @@ static_assert(std::is_trivially_destructible<LeafPageDecoder>::value, +@@ -136,16 +136,22 @@ static_assert(std::is_trivially_destructible<LeafPageDecoder>::value, "Move the destructor to the .cc file if it's non-trival"); #endif // !DCHECK_IS_ON() @@ -34,23 +33,20 @@ - cell_count_(ComputeCellCount(db_reader)), - next_read_index_(0), - last_record_size_(0) { ++LeafPageDecoder::LeafPageDecoder() noexcept = default; ++ +void LeafPageDecoder::Initialize(DatabasePageReader* db_reader) { -+ DCHECK(db_reader); - DCHECK(IsOnValidPage(db_reader)); + page_id_ = db_reader->page_id(); + db_reader_ = db_reader; + cell_count_ = ComputeCellCount(db_reader); + next_read_index_ = 0; + last_record_size_ = 0; + DCHECK(IsOnValidPage(db_reader)); DCHECK(DatabasePageReader::IsValidPageId(page_id_)); } +void LeafPageDecoder::Reset() { + db_reader_ = nullptr; -+ page_id_ = 0; -+ cell_count_ = 0; -+ next_read_index_ = 0; -+ last_record_size_ = 0; +} + bool LeafPageDecoder::TryAdvance() { @@ -57,23 +53,27 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(CanAdvance()); diff --git a/sql/recover_module/btree.h b/sql/recover_module/btree.h -index d76d076bf6..33114b01fa 100644 +index eaa087a5c52..df0e0c937c0 100644 --- a/sql/recover_module/btree.h +++ b/sql/recover_module/btree.h -@@ -102,7 +102,7 @@ class LeafPageDecoder { +@@ -101,9 +101,7 @@ class LeafPageDecoder { + public: + // Creates a decoder for a DatabasePageReader's last read page. // - // |db_reader| must have been used to read an inner page of a table B-tree. - // |db_reader| must outlive this instance. +- // |db_reader| must have been used to read an inner page of a table B-tree. +- // |db_reader| must outlive this instance. - explicit LeafPageDecoder(DatabasePageReader* db_reader) noexcept; -+ explicit LeafPageDecoder() noexcept = default; ++ LeafPageDecoder() noexcept; ~LeafPageDecoder() noexcept = default; LeafPageDecoder(const LeafPageDecoder&) = delete; -@@ -150,6 +150,15 @@ class LeafPageDecoder { +@@ -151,6 +149,17 @@ class LeafPageDecoder { // read as long as CanAdvance() returns true. bool TryAdvance(); + // Initialize with DatabasePageReader ++ // |db_reader| must have been used to read an inner page of a table B-tree. ++ // |db_reader| must outlive this instance. + void Initialize(DatabasePageReader* db_reader); + + // Reset internal DatabasePageReader @@ -85,7 +85,7 @@ // True if the given reader may point to an inner page in a table B-tree. // // The last ReadPage() call on |db_reader| must have succeeded. -@@ -163,14 +172,14 @@ class LeafPageDecoder { +@@ -164,14 +173,14 @@ class LeafPageDecoder { static int ComputeCellCount(DatabasePageReader* db_reader); // The number of the B-tree page this reader is reading. @@ -104,10 +104,10 @@ // The reader's cursor state. // diff --git a/sql/recover_module/cursor.cc b/sql/recover_module/cursor.cc -index 0029ff9295..42548bc4b5 100644 +index 4f827edf1b4..240de4999fe 100644 --- a/sql/recover_module/cursor.cc +++ b/sql/recover_module/cursor.cc -@@ -26,7 +26,7 @@ VirtualCursor::~VirtualCursor() { +@@ -28,7 +28,7 @@ VirtualCursor::~VirtualCursor() { int VirtualCursor::First() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); inner_decoders_.clear(); @@ -116,7 +116,7 @@ AppendPageDecoder(table_->root_page_id()); return Next(); -@@ -36,18 +36,18 @@ int VirtualCursor::Next() { +@@ -38,18 +38,18 @@ int VirtualCursor::Next() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); record_reader_.Reset(); @@ -142,7 +142,7 @@ continue; } if (!record_reader_.Initialize()) -@@ -99,13 +99,13 @@ int VirtualCursor::ReadColumn(int column_index, +@@ -101,13 +101,13 @@ int VirtualCursor::ReadColumn(int column_index, int64_t VirtualCursor::RowId() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(record_reader_.IsInitialized()); @@ -159,7 +159,7 @@ << __func__ << " must only be called when the current path has no leaf decoder"; -@@ -113,7 +113,7 @@ void VirtualCursor::AppendPageDecoder(int page_id) { +@@ -115,7 +115,7 @@ void VirtualCursor::AppendPageDecoder(int page_id) { return; if (LeafPageDecoder::IsOnValidPage(&db_reader_)) { @@ -169,10 +169,10 @@ } diff --git a/sql/recover_module/cursor.h b/sql/recover_module/cursor.h -index afcd6900e1..b15c31d425 100644 +index 845b7852648..cc4e85f83f9 100644 --- a/sql/recover_module/cursor.h +++ b/sql/recover_module/cursor.h -@@ -129,7 +129,7 @@ class VirtualCursor { +@@ -130,7 +130,7 @@ class VirtualCursor { std::vector<std::unique_ptr<InnerPageDecoder>> inner_decoders_; // Decodes the leaf page containing records. @@ -182,7 +182,7 @@ SEQUENCE_CHECKER(sequence_checker_); }; diff --git a/sql/recover_module/pager.cc b/sql/recover_module/pager.cc -index 58e75de270..5fe96204e5 100644 +index 58e75de2704..69d98cef98d 100644 --- a/sql/recover_module/pager.cc +++ b/sql/recover_module/pager.cc @@ -23,8 +23,7 @@ static_assert(DatabasePageReader::kMaxPageId <= std::numeric_limits<int>::max(), @@ -191,34 +191,34 @@ DatabasePageReader::DatabasePageReader(VirtualTable* table) - : page_data_(std::make_unique<uint8_t[]>(table->page_size())), - table_(table) { -+ : page_data_(), table_(table) { ++ : page_data_(table->page_size()), table_(table) { DCHECK(table != nullptr); DCHECK(IsValidPageSize(table->page_size())); } -@@ -57,8 +56,8 @@ int DatabasePageReader::ReadPage(int page_id) { - std::numeric_limits<int64_t>::max(), +@@ -58,7 +57,7 @@ int DatabasePageReader::ReadPage(int page_id) { "The |read_offset| computation above may overflow"); -- int sqlite_status = + int sqlite_status = - RawRead(sqlite_file, read_size, read_offset, page_data_.get()); -+ int sqlite_status = RawRead(sqlite_file, read_size, read_offset, -+ const_cast<uint8_t*>(page_data_.data())); ++ RawRead(sqlite_file, read_size, read_offset, page_data_.data()); // |page_id_| needs to be set to kInvalidPageId if the read failed. // Otherwise, future ReadPage() calls with the previous |page_id_| value diff --git a/sql/recover_module/pager.h b/sql/recover_module/pager.h -index 0e388ddc3b..99314e30ff 100644 +index 07cac3cb989..d08f0932fab 100644 --- a/sql/recover_module/pager.h +++ b/sql/recover_module/pager.h -@@ -5,6 +5,7 @@ - #ifndef SQL_RECOVER_MODULE_PAGER_H_ +@@ -6,8 +6,8 @@ #define SQL_RECOVER_MODULE_PAGER_H_ -+#include <array> #include <cstdint> - #include <memory> +-#include <memory> + #include <ostream> ++#include <vector> -@@ -70,7 +71,7 @@ class DatabasePageReader { + #include "base/check_op.h" + #include "base/memory/raw_ptr.h" +@@ -72,7 +72,7 @@ class DatabasePageReader { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_NE(page_id_, kInvalidPageId) << "Successful ReadPage() required before accessing pager state"; @@ -227,12 +227,12 @@ } // The number of bytes in the page read by the last ReadPage() call. -@@ -137,7 +138,7 @@ class DatabasePageReader { +@@ -139,7 +139,7 @@ class DatabasePageReader { int page_id_ = kInvalidPageId; // Stores the bytes of the last page successfully read by ReadPage(). // The content is undefined if the last call to ReadPage() did not succeed. - const std::unique_ptr<uint8_t[]> page_data_; -+ const std::array<uint8_t, kMaxPageSize> page_data_; ++ std::vector<uint8_t> page_data_; // Raw pointer usage is acceptable because this instance's owner is expected // to ensure that the VirtualTable outlives this. - VirtualTable* const table_; + const raw_ptr<VirtualTable> table_; Deleted: unbundle-fix-visibility-of-build-config-freetype.patch =================================================================== --- unbundle-fix-visibility-of-build-config-freetype.patch 2022-02-27 12:24:57 UTC (rev 1137577) +++ unbundle-fix-visibility-of-build-config-freetype.patch 2022-02-27 12:44:34 UTC (rev 1137578) @@ -1,31 +0,0 @@ -From 271e45339b7b969e98ccef7837cb1b15480b07fc Mon Sep 17 00:00:00 2001 -From: Stephan Hartmann <sth...@googlemail.com> -Date: Thu, 4 Nov 2021 18:58:34 +0000 -Subject: [PATCH] unbundle: fix visibility of //build/config/freetype - -For system freetype //build/linux:freetype_from_pkgconfig is restricted -to //third_party:freetype_harfbuzz and //third_party/harfbuzz-ng:harfbuzz_source. -However //build/config/freetype:freetype is accessing it too. - -Bug: None -Change-Id: Ic4a37b01e4ae221372a9220cbad04c598b844c21 -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3259304 -Commit-Queue: Thomas Anderson <thomasander...@chromium.org> -Reviewed-by: Thomas Anderson <thomasander...@chromium.org> -Cr-Commit-Position: refs/heads/main@{#938388} ---- - build/linux/BUILD.gn | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/build/linux/BUILD.gn b/build/linux/BUILD.gn -index 54314c7687..cd49e3d524 100644 ---- a/build/linux/BUILD.gn -+++ b/build/linux/BUILD.gn -@@ -23,6 +23,7 @@ if (use_system_freetype) { - # the system, use with caution,for details see build/config/freetype/BUILD.gn. - pkg_config("freetype_from_pkgconfig") { - visibility = [ -+ "//build/config/freetype:freetype", - "//third_party:freetype_harfbuzz", - "//third_party/harfbuzz-ng:harfbuzz_source", - ] Deleted: unexpire-accelerated-video-decode-flag.patch =================================================================== --- unexpire-accelerated-video-decode-flag.patch 2022-02-27 12:24:57 UTC (rev 1137577) +++ unexpire-accelerated-video-decode-flag.patch 2022-02-27 12:44:34 UTC (rev 1137578) @@ -1,11 +0,0 @@ ---- chrome/browser/flag-metadata.json.orig 2021-09-21 18:34:38.740426608 +0000 -+++ chrome/browser/flag-metadata.json 2021-09-21 18:35:09.392000797 +0000 -@@ -1285,7 +1285,7 @@ - { - "name": "enable-accelerated-video-decode", - "owners": [ "media-...@chromium.org" ], -- "expiry_milestone": 93 -+ "expiry_milestone": 99 - }, - { - "name": "enable-accessibility-live-caption", Added: use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch =================================================================== --- use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch (rev 0) +++ use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch 2022-02-27 12:44:34 UTC (rev 1137578) @@ -0,0 +1,72 @@ +From cb0aad687f34629a42053d600cf2947282cea2c0 Mon Sep 17 00:00:00 2001 +From: Lei Zhang <thes...@chromium.org> +Date: Mon, 31 Jan 2022 22:42:35 +0000 +Subject: [PATCH] Use FT_Done_MM_Var() in CFX_Font::AdjustMMParams() when + possible. + +When FreeType has FT_Done_MM_Var(), use that to free memory in +CFX_Font::AdjustMMParams() to avoid mismatched alloc/free functions. + +Bug: pdfium:1400 +Change-Id: I044540893103921fc64cdd53fcd628cfebf2c9db +Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/90130 +Reviewed-by: Nigi <n...@chromium.org> +Commit-Queue: Lei Zhang <thes...@chromium.org> + +(cherry picked from commit ffeb67faf715475f6e463d65c368f556780adf19) +--- + core/fxge/cfx_font.cpp | 28 ++++++++++++++++++++++++++-- + 1 file changed, 26 insertions(+), 2 deletions(-) + +diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp +index 7a4e8eb24..0ef421fe7 100644 +--- a/core/fxge/cfx_font.cpp ++++ b/core/fxge/cfx_font.cpp +@@ -43,6 +43,30 @@ struct OUTLINE_PARAMS { + float m_CoordUnit; + }; + ++// TODO(crbug.com/pdfium/1400): When FT_Done_MM_Var() is more likely to be ++// available to all users in the future, remove FreeMMVar() and use ++// FT_Done_MM_Var() directly. ++// ++// Use weak symbols to check if FT_Done_MM_Var() is available at runtime. ++#if !defined(OS_WIN) ++extern "C" __attribute__((weak)) decltype(FT_Done_MM_Var) FT_Done_MM_Var; ++#endif ++ ++void FreeMMVar(FXFT_FaceRec* rec, FXFT_MM_VarPtr variation_desc) { ++#if defined(OS_WIN) ++ // Assume `use_system_freetype` GN var is never set on Windows. ++ constexpr bool has_ft_done_mm_var_func = true; ++#else ++ static const bool has_ft_done_mm_var_func = !!FT_Done_MM_Var; ++#endif ++ if (has_ft_done_mm_var_func) { ++ FT_Done_MM_Var(CFX_GEModule::Get()->GetFontMgr()->GetFTLibrary(), ++ variation_desc); ++ } else { ++ FXFT_Free(rec, variation_desc); ++ } ++} ++ + #ifdef PDF_ENABLE_XFA + unsigned long FTStreamRead(FXFT_StreamRec* stream, + unsigned long offset, +@@ -640,14 +664,14 @@ void CFX_Font::AdjustMMParams(int glyph_index, + int max_width = FXFT_Get_Glyph_HoriAdvance(m_Face->GetRec()) * 1000 / + FXFT_Get_Face_UnitsPerEM(m_Face->GetRec()); + if (max_width == min_width) { +- FXFT_Free(m_Face->GetRec(), pMasters); ++ FreeMMVar(m_Face->GetRec(), pMasters); + return; + } + int param = min_param + (max_param - min_param) * (dest_width - min_width) / + (max_width - min_width); + coords[1] = param; + } +- FXFT_Free(m_Face->GetRec(), pMasters); ++ FreeMMVar(m_Face->GetRec(), pMasters); + FT_Set_MM_Design_Coordinates(m_Face->GetRec(), 2, coords); + } + Deleted: wayland-fix-binding-to-wrong-version.patch =================================================================== --- wayland-fix-binding-to-wrong-version.patch 2022-02-27 12:24:57 UTC (rev 1137577) +++ wayland-fix-binding-to-wrong-version.patch 2022-02-27 12:44:34 UTC (rev 1137578) @@ -1,651 +0,0 @@ -From 549451e06c2bc2cec76694b619e4adf3dff87242 Mon Sep 17 00:00:00 2001 -From: Alexander Dunaev <adun...@igalia.com> -Date: Tue, 14 Dec 2021 09:54:52 +0000 -Subject: [PATCH 1/2] [linux/wayland] Fixed terminate caused by binding to - wrong version. - -The Ozone/Wayland implementation had a few places where the Wayland -objects were bound without proper checking for their versions. That was -part of the technical debt not addressed before, and ended up causing -the issue explained in the linked crbug: the compositor terminates the -client that binds to the protocol that it does not actually support. - -This patch fixes the issue by adding the necessary checks in all places -where they were missing. Also a convenience macro for validating the -version is proposed. - -Bug: 1279574 -Change-Id: I74efa97f64b480bed47372d8d559593ae84eeb18 -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3337037 -Reviewed-by: Maksim Sisov <msi...@igalia.com> -Commit-Queue: Alexander Dunaev <adun...@igalia.com> -Cr-Commit-Position: refs/heads/main@{#951428} - -(cherry picked from commit dd4c3ddadbb9869f59cee201a38e9ca3b9154f4d) ---- - .../platform/wayland/common/wayland_object.cc | 21 +++++++++++++++++++ - .../platform/wayland/common/wayland_object.h | 11 ++++++++++ - .../gtk_primary_selection_device_manager.cc | 11 +++++----- - ui/ozone/platform/wayland/host/gtk_shell1.cc | 12 ++++++----- - .../wayland/host/org_kde_kwin_idle.cc | 9 ++++---- - .../wayland/host/overlay_prioritizer.cc | 9 ++++---- - .../host/wayland_data_device_manager.cc | 9 +++++--- - ui/ozone/platform/wayland/host/wayland_drm.cc | 6 ++++-- - .../platform/wayland/host/wayland_output.cc | 10 ++++----- - ui/ozone/platform/wayland/host/wayland_shm.cc | 9 ++++---- - .../wayland/host/wayland_zaura_shell.cc | 9 +++++--- - .../wayland/host/wayland_zcr_cursor_shapes.cc | 10 +++++---- - .../wayland/host/wayland_zwp_linux_dmabuf.cc | 9 +++++--- - .../host/wayland_zwp_pointer_constraints.cc | 6 +++--- - .../host/wayland_zwp_pointer_gestures.cc | 7 ++++--- - .../wayland_zwp_relative_pointer_manager.cc | 8 ++++--- - .../wayland/host/xdg_foreign_wrapper.cc | 14 ++++++++----- - .../wayland/host/zwp_idle_inhibit_manager.cc | 10 +++++---- - .../zwp_primary_selection_device_manager.cc | 9 ++++---- - 19 files changed, 124 insertions(+), 65 deletions(-) - -diff --git a/ui/ozone/platform/wayland/common/wayland_object.cc b/ui/ozone/platform/wayland/common/wayland_object.cc -index e97d5264e47..a6ba798e2bd 100644 ---- a/ui/ozone/platform/wayland/common/wayland_object.cc -+++ b/ui/ozone/platform/wayland/common/wayland_object.cc -@@ -34,6 +34,8 @@ - #include <xdg-shell-client-protocol.h> - #include <xdg-shell-unstable-v6-client-protocol.h> - -+#include "base/logging.h" -+ - namespace wl { - namespace { - -@@ -76,6 +78,25 @@ void delete_touch(wl_touch* touch) { - - } // namespace - -+bool CanBind(const std::string& interface, -+ uint32_t available_version, -+ uint32_t min_version, -+ uint32_t max_version) { -+ if (available_version < min_version) { -+ LOG(WARNING) << "Unable to bind to " << interface << " version " -+ << available_version << ". The minimum supported version is " -+ << min_version << "."; -+ return false; -+ } -+ -+ if (available_version > max_version) { -+ LOG(WARNING) << "Binding to " << interface << " version " << max_version -+ << " but version " << available_version << " is available."; -+ } -+ -+ return true; -+} -+ - void (*ObjectTraits<wl_cursor_theme>::deleter)(wl_cursor_theme*) = - &wl_cursor_theme_destroy; - -diff --git a/ui/ozone/platform/wayland/common/wayland_object.h b/ui/ozone/platform/wayland/common/wayland_object.h -index 145c0137b59..f929b6ecffe 100644 ---- a/ui/ozone/platform/wayland/common/wayland_object.h -+++ b/ui/ozone/platform/wayland/common/wayland_object.h -@@ -79,6 +79,17 @@ struct ObjectTraits<wl_proxy> { - static void (*deleter)(void*); - }; - -+// Checks the given |available_version| exposed by the server against -+// |min_version| and |max_version| supported by the client. -+// Returns false (with rendering a warning) if |available_version| is less than -+// the minimum supported version. -+// Returns true otherwise, renders an info message if |available_version| is -+// greater than the maximum supported one. -+bool CanBind(const std::string& interface, -+ uint32_t available_version, -+ uint32_t min_version, -+ uint32_t max_version); -+ - } // namespace wl - - // Puts the forward declaration for struct TYPE and declares the template -diff --git a/ui/ozone/platform/wayland/host/gtk_primary_selection_device_manager.cc b/ui/ozone/platform/wayland/host/gtk_primary_selection_device_manager.cc -index af3087d1891..2991233fe6e 100644 ---- a/ui/ozone/platform/wayland/host/gtk_primary_selection_device_manager.cc -+++ b/ui/ozone/platform/wayland/host/gtk_primary_selection_device_manager.cc -@@ -16,7 +16,7 @@ - namespace ui { - - namespace { --constexpr uint32_t kMaxGtkPrimarySelectionDeviceManagerVersion = 1; -+constexpr uint32_t kMinVersion = 1; - } - - // static -@@ -31,12 +31,13 @@ void GtkPrimarySelectionDeviceManager::Instantiate( - uint32_t version) { - DCHECK_EQ(interface, kInterfaceName); - -- if (connection->gtk_primary_selection_device_manager()) -+ if (connection->gtk_primary_selection_device_manager() || -+ !wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; -+ } - -- auto manager = wl::Bind<gtk_primary_selection_device_manager>( -- registry, name, -- std::min(version, kMaxGtkPrimarySelectionDeviceManagerVersion)); -+ auto manager = wl::Bind<gtk_primary_selection_device_manager>(registry, name, -+ kMinVersion); - if (!manager) { - LOG(ERROR) << "Failed to bind gtk_primary_selection_device_manager"; - return; -diff --git a/ui/ozone/platform/wayland/host/gtk_shell1.cc b/ui/ozone/platform/wayland/host/gtk_shell1.cc -index cb3b0c8fa02..26dfd7fbf3f 100644 ---- a/ui/ozone/platform/wayland/host/gtk_shell1.cc -+++ b/ui/ozone/platform/wayland/host/gtk_shell1.cc -@@ -17,8 +17,8 @@ namespace { - // gtk_shell1 exposes request_focus() since version 3. Below that, it is not - // interesting for us, although it provides some shell integration that might be - // useful. --constexpr uint32_t kMinGtkShell1Version = 3; --constexpr uint32_t kMaxGtkShell1Version = 4; -+constexpr uint32_t kMinVersion = 3; -+constexpr uint32_t kMaxVersion = 4; - } // namespace - - // static -@@ -32,11 +32,13 @@ void GtkShell1::Instantiate(WaylandConnection* connection, - uint32_t version) { - DCHECK_EQ(interface, kInterfaceName); - -- if (connection->gtk_shell1_ || version < kMinGtkShell1Version) -+ if (connection->gtk_shell1_ || -+ !wl::CanBind(interface, version, kMinVersion, kMaxVersion)) { - return; -+ } - -- auto gtk_shell1 = wl::Bind<::gtk_shell1>( -- registry, name, std::min(version, kMaxGtkShell1Version)); -+ auto gtk_shell1 = -+ wl::Bind<::gtk_shell1>(registry, name, std::min(version, kMaxVersion)); - if (!gtk_shell1) { - LOG(ERROR) << "Failed to bind gtk_shell1"; - return; -diff --git a/ui/ozone/platform/wayland/host/org_kde_kwin_idle.cc b/ui/ozone/platform/wayland/host/org_kde_kwin_idle.cc -index 4746aa798c0..8b7a7416d95 100644 ---- a/ui/ozone/platform/wayland/host/org_kde_kwin_idle.cc -+++ b/ui/ozone/platform/wayland/host/org_kde_kwin_idle.cc -@@ -13,7 +13,7 @@ namespace ui { - - namespace { - --constexpr uint32_t kMaxOrgKdeKwinIdleVersion = 1; -+constexpr uint32_t kMinVersion = 1; - - // After the system has gone idle, it will wait for this time before notifying - // us. This reduces "jitter" of the idle/active state, but also adds some lag -@@ -58,11 +58,12 @@ void OrgKdeKwinIdle::Instantiate(WaylandConnection* connection, - uint32_t version) { - DCHECK_EQ(interface, kInterfaceName); - -- if (connection->org_kde_kwin_idle_) -+ if (connection->org_kde_kwin_idle_ || -+ !wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; -+ } - -- auto idle = wl::Bind<struct org_kde_kwin_idle>( -- registry, name, std::min(version, kMaxOrgKdeKwinIdleVersion)); -+ auto idle = wl::Bind<struct org_kde_kwin_idle>(registry, name, kMinVersion); - if (!idle) { - LOG(ERROR) << "Failed to bind to org_kde_kwin_idle global"; - return; -diff --git a/ui/ozone/platform/wayland/host/overlay_prioritizer.cc b/ui/ozone/platform/wayland/host/overlay_prioritizer.cc -index e8aaf39a337..11496b52324 100644 ---- a/ui/ozone/platform/wayland/host/overlay_prioritizer.cc -+++ b/ui/ozone/platform/wayland/host/overlay_prioritizer.cc -@@ -12,7 +12,7 @@ - namespace ui { - - namespace { --constexpr uint32_t kMaxOverlayPrioritizerVersion = 1; -+constexpr uint32_t kMinVersion = 1; - } - - // static -@@ -26,11 +26,12 @@ void OverlayPrioritizer::Instantiate(WaylandConnection* connection, - uint32_t version) { - DCHECK_EQ(interface, kInterfaceName); - -- if (connection->overlay_prioritizer_) -+ if (connection->overlay_prioritizer_ || -+ !wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; -+ } - -- auto prioritizer = wl::Bind<overlay_prioritizer>( -- registry, name, std::min(version, kMaxOverlayPrioritizerVersion)); -+ auto prioritizer = wl::Bind<overlay_prioritizer>(registry, name, kMinVersion); - if (!prioritizer) { - LOG(ERROR) << "Failed to bind overlay_prioritizer"; - return; -diff --git a/ui/ozone/platform/wayland/host/wayland_data_device_manager.cc b/ui/ozone/platform/wayland/host/wayland_data_device_manager.cc -index 408cb1c72f4..0f03942e699 100644 ---- a/ui/ozone/platform/wayland/host/wayland_data_device_manager.cc -+++ b/ui/ozone/platform/wayland/host/wayland_data_device_manager.cc -@@ -14,7 +14,8 @@ - namespace ui { - - namespace { --constexpr uint32_t kMaxDeviceManagerVersion = 3; -+constexpr uint32_t kMinVersion = 1; -+constexpr uint32_t kMaxVersion = 3; - } - - // static -@@ -28,11 +29,13 @@ void WaylandDataDeviceManager::Instantiate(WaylandConnection* connection, - uint32_t version) { - DCHECK_EQ(interface, kInterfaceName); - -- if (connection->data_device_manager_) -+ if (connection->data_device_manager_ || -+ !wl::CanBind(interface, version, kMinVersion, kMaxVersion)) { - return; -+ } - - auto data_device_manager = wl::Bind<wl_data_device_manager>( -- registry, name, std::min(version, kMaxDeviceManagerVersion)); -+ registry, name, std::min(version, kMaxVersion)); - if (!data_device_manager) { - LOG(ERROR) << "Failed to bind to wl_data_device_manager global"; - return; -diff --git a/ui/ozone/platform/wayland/host/wayland_drm.cc b/ui/ozone/platform/wayland/host/wayland_drm.cc -index d806e8e9f5d..a7ed2e20ffe 100644 ---- a/ui/ozone/platform/wayland/host/wayland_drm.cc -+++ b/ui/ozone/platform/wayland/host/wayland_drm.cc -@@ -17,7 +17,7 @@ - namespace ui { - - namespace { --constexpr uint32_t kMinWlDrmVersion = 2; -+constexpr uint32_t kMinVersion = 2; - } - - // static -@@ -31,8 +31,10 @@ void WaylandDrm::Instantiate(WaylandConnection* connection, - uint32_t version) { - DCHECK_EQ(interface, kInterfaceName); - -- if (connection->drm_ || version < kMinWlDrmVersion) -+ if (connection->drm_ || -+ !!wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; -+ } - - auto wl_drm = wl::Bind<struct wl_drm>(registry, name, version); - if (!wl_drm) { -diff --git a/ui/ozone/platform/wayland/host/wayland_output.cc b/ui/ozone/platform/wayland/host/wayland_output.cc -index 7f5289197bc..fc41f9a12f5 100644 ---- a/ui/ozone/platform/wayland/host/wayland_output.cc -+++ b/ui/ozone/platform/wayland/host/wayland_output.cc -@@ -16,7 +16,8 @@ - namespace ui { - - namespace { --constexpr uint32_t kMinWlOutputVersion = 2; -+// TODO(crbug.com/1279681): support newer versions. -+constexpr uint32_t kMinVersion = 2; - } - - // static -@@ -30,14 +31,11 @@ void WaylandOutput::Instantiate(WaylandConnection* connection, - uint32_t version) { - DCHECK_EQ(interface, kInterfaceName); - -- if (version < kMinWlOutputVersion) { -- LOG(ERROR) -- << "Unable to bind to the unsupported wl_output object with version= " -- << version << ". Minimum supported version is " << kMinWlOutputVersion; -+ if (!wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; - } - -- auto output = wl::Bind<wl_output>(registry, name, version); -+ auto output = wl::Bind<wl_output>(registry, name, kMinVersion); - if (!output) { - LOG(ERROR) << "Failed to bind to wl_output global"; - return; -diff --git a/ui/ozone/platform/wayland/host/wayland_shm.cc b/ui/ozone/platform/wayland/host/wayland_shm.cc -index 7c6cd40569d..de97ad1c2b2 100644 ---- a/ui/ozone/platform/wayland/host/wayland_shm.cc -+++ b/ui/ozone/platform/wayland/host/wayland_shm.cc -@@ -10,7 +10,7 @@ - namespace ui { - - namespace { --constexpr uint32_t kMaxShmVersion = 1; -+constexpr uint32_t kMinVersion = 1; - constexpr uint32_t kShmFormat = WL_SHM_FORMAT_ARGB8888; - } // namespace - -@@ -25,11 +25,12 @@ void WaylandShm::Instantiate(WaylandConnection* connection, - uint32_t version) { - DCHECK_EQ(interface, kInterfaceName); - -- if (connection->shm_) -+ if (connection->shm_ || -+ !wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; -+ } - -- auto shm = -- wl::Bind<wl_shm>(registry, name, std::min(version, kMaxShmVersion)); -+ auto shm = wl::Bind<wl_shm>(registry, name, kMinVersion); - if (!shm) { - LOG(ERROR) << "Failed to bind to wl_shm global"; - return; -diff --git a/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc b/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc -index a9e72376987..9aaef1354f8 100644 ---- a/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc -+++ b/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc -@@ -18,7 +18,8 @@ - namespace ui { - - namespace { --constexpr uint32_t kMaxAuraShellVersion = 24; -+constexpr uint32_t kMinVersion = 1; -+constexpr uint32_t kMaxVersion = 24; - } - - // static -@@ -32,11 +33,13 @@ void WaylandZAuraShell::Instantiate(WaylandConnection* connection, - uint32_t version) { - DCHECK_EQ(interface, kInterfaceName); - -- if (connection->zaura_shell_) -+ if (connection->zaura_shell_ || -+ !wl::CanBind(interface, version, kMinVersion, kMaxVersion)) { - return; -+ } - - auto zaura_shell = wl::Bind<struct zaura_shell>( -- registry, name, std::min(version, kMaxAuraShellVersion)); -+ registry, name, std::min(version, kMaxVersion)); - if (!zaura_shell) { - LOG(ERROR) << "Failed to bind zaura_shell"; - return; -diff --git a/ui/ozone/platform/wayland/host/wayland_zcr_cursor_shapes.cc b/ui/ozone/platform/wayland/host/wayland_zcr_cursor_shapes.cc -index 094a2f98686..84d847eea16 100644 ---- a/ui/ozone/platform/wayland/host/wayland_zcr_cursor_shapes.cc -+++ b/ui/ozone/platform/wayland/host/wayland_zcr_cursor_shapes.cc -@@ -16,7 +16,7 @@ - namespace ui { - - namespace { --constexpr uint32_t kMaxCursorShapesVersion = 1; -+constexpr uint32_t kMinVersion = 1; - } - - using mojom::CursorType; -@@ -32,11 +32,13 @@ void WaylandZcrCursorShapes::Instantiate(WaylandConnection* connection, - uint32_t version) { - DCHECK_EQ(interface, kInterfaceName); - -- if (connection->zcr_cursor_shapes_) -+ if (connection->zcr_cursor_shapes_ || -+ !wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; -+ } - -- auto zcr_cursor_shapes = wl::Bind<zcr_cursor_shapes_v1>( -- registry, name, std::min(version, kMaxCursorShapesVersion)); -+ auto zcr_cursor_shapes = -+ wl::Bind<zcr_cursor_shapes_v1>(registry, name, kMinVersion); - if (!zcr_cursor_shapes) { - LOG(ERROR) << "Failed to bind zcr_cursor_shapes_v1"; - return; -diff --git a/ui/ozone/platform/wayland/host/wayland_zwp_linux_dmabuf.cc b/ui/ozone/platform/wayland/host/wayland_zwp_linux_dmabuf.cc -index 7035dc4ed26..cee793b9ae8 100644 ---- a/ui/ozone/platform/wayland/host/wayland_zwp_linux_dmabuf.cc -+++ b/ui/ozone/platform/wayland/host/wayland_zwp_linux_dmabuf.cc -@@ -14,7 +14,8 @@ - namespace ui { - - namespace { --constexpr uint32_t kMaxLinuxDmabufVersion = 3; -+constexpr uint32_t kMinVersion = 1; -+constexpr uint32_t kMaxVersion = 3; - } - - // static -@@ -28,11 +29,13 @@ void WaylandZwpLinuxDmabuf::Instantiate(WaylandConnection* connection, - uint32_t version) { - DCHECK_EQ(interface, kInterfaceName); - -- if (connection->zwp_dmabuf()) -+ if (connection->zwp_dmabuf() || -+ !wl::CanBind(interface, version, kMinVersion, kMaxVersion)) { - return; -+ } - - auto zwp_linux_dmabuf = wl::Bind<zwp_linux_dmabuf_v1>( -- registry, name, std::min(version, kMaxLinuxDmabufVersion)); -+ registry, name, std::min(version, kMaxVersion)); - if (!zwp_linux_dmabuf) { - LOG(ERROR) << "Failed to bind zwp_linux_dmabuf_v1"; - return; -diff --git a/ui/ozone/platform/wayland/host/wayland_zwp_pointer_constraints.cc b/ui/ozone/platform/wayland/host/wayland_zwp_pointer_constraints.cc -index 24e4dacc7ee..c1aca770ff5 100644 ---- a/ui/ozone/platform/wayland/host/wayland_zwp_pointer_constraints.cc -+++ b/ui/ozone/platform/wayland/host/wayland_zwp_pointer_constraints.cc -@@ -15,7 +15,7 @@ - namespace ui { - - namespace { --constexpr uint32_t kMinZwpPointerConstraintsVersion = 1; -+constexpr uint32_t kMinVersion = 1; - } - - // static -@@ -30,12 +30,12 @@ void WaylandZwpPointerConstraints::Instantiate(WaylandConnection* connection, - DCHECK_EQ(interface, kInterfaceName); - - if (connection->wayland_zwp_pointer_constraints_ || -- version < kMinZwpPointerConstraintsVersion) { -+ !wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; - } - - auto zwp_pointer_constraints_v1 = -- wl::Bind<struct zwp_pointer_constraints_v1>(registry, name, version); -+ wl::Bind<struct zwp_pointer_constraints_v1>(registry, name, kMinVersion); - if (!zwp_pointer_constraints_v1) { - LOG(ERROR) << "Failed to bind wp_pointer_constraints_v1"; - return; -diff --git a/ui/ozone/platform/wayland/host/wayland_zwp_pointer_gestures.cc b/ui/ozone/platform/wayland/host/wayland_zwp_pointer_gestures.cc -index 5d96c8923fd..31bffb726c6 100644 ---- a/ui/ozone/platform/wayland/host/wayland_zwp_pointer_gestures.cc -+++ b/ui/ozone/platform/wayland/host/wayland_zwp_pointer_gestures.cc -@@ -19,7 +19,7 @@ - namespace ui { - - namespace { --constexpr uint32_t kMinZwpPointerGesturesVersion = 1; -+constexpr uint32_t kMinVersion = 1; - } - - // static -@@ -34,11 +34,12 @@ void WaylandZwpPointerGestures::Instantiate(WaylandConnection* connection, - DCHECK_EQ(interface, kInterfaceName); - - if (connection->wayland_zwp_pointer_gestures_ || -- version < kMinZwpPointerGesturesVersion) -+ !wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; -+ } - - auto zwp_pointer_gestures_v1 = -- wl::Bind<struct zwp_pointer_gestures_v1>(registry, name, version); -+ wl::Bind<struct zwp_pointer_gestures_v1>(registry, name, kMinVersion); - if (!zwp_pointer_gestures_v1) { - LOG(ERROR) << "Failed to bind wp_pointer_gestures_v1"; - return; -diff --git a/ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.cc b/ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.cc -index 3a8ef4c7f96..c84a891dfe7 100644 ---- a/ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.cc -+++ b/ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.cc -@@ -14,7 +14,7 @@ - namespace ui { - - namespace { --constexpr uint32_t kMinZwpRelativePointerManagerVersion = 1; -+constexpr uint32_t kMinVersion = 1; - } - - // static -@@ -30,11 +30,13 @@ void WaylandZwpRelativePointerManager::Instantiate( - DCHECK_EQ(interface, kInterfaceName); - - if (connection->wayland_zwp_relative_pointer_manager_ || -- version < kMinZwpRelativePointerManagerVersion) -+ !wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; -+ } - - auto zwp_relative_pointer_manager_v1 = -- wl::Bind<struct zwp_relative_pointer_manager_v1>(registry, name, version); -+ wl::Bind<struct zwp_relative_pointer_manager_v1>(registry, name, -+ kMinVersion); - if (!zwp_relative_pointer_manager_v1) { - LOG(ERROR) << "Failed to bind zwp_relative_pointer_manager_v1"; - return; -diff --git a/ui/ozone/platform/wayland/host/xdg_foreign_wrapper.cc b/ui/ozone/platform/wayland/host/xdg_foreign_wrapper.cc -index a34b684d128..2586adf9b85 100644 ---- a/ui/ozone/platform/wayland/host/xdg_foreign_wrapper.cc -+++ b/ui/ozone/platform/wayland/host/xdg_foreign_wrapper.cc -@@ -19,6 +19,8 @@ constexpr char XdgForeignWrapper::kInterfaceNameV1[]; - // static - constexpr char XdgForeignWrapper::kInterfaceNameV2[]; - -+constexpr uint32_t kMinVersion = 1; -+ - using OnHandleExported = XdgForeignWrapper::OnHandleExported; - - namespace { -@@ -185,15 +187,17 @@ void XdgForeignWrapper::Instantiate(WaylandConnection* connection, - uint32_t name, - const std::string& interface, - uint32_t version) { -- if (connection->xdg_foreign_) -+ if (connection->xdg_foreign_ || -+ !wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; -+ } - - if (interface == kInterfaceNameV1) { -- connection->xdg_foreign_ = -- CreateWrapper<zxdg_exporter_v1>(connection, registry, name, version); -+ connection->xdg_foreign_ = CreateWrapper<zxdg_exporter_v1>( -+ connection, registry, name, kMinVersion); - } else if (interface == kInterfaceNameV2) { -- connection->xdg_foreign_ = -- CreateWrapper<zxdg_exporter_v2>(connection, registry, name, version); -+ connection->xdg_foreign_ = CreateWrapper<zxdg_exporter_v2>( -+ connection, registry, name, kMinVersion); - } else { - NOTREACHED() << " unexpected interface name: " << interface; - } -diff --git a/ui/ozone/platform/wayland/host/zwp_idle_inhibit_manager.cc b/ui/ozone/platform/wayland/host/zwp_idle_inhibit_manager.cc -index 47121293acb..fc05de68778 100644 ---- a/ui/ozone/platform/wayland/host/zwp_idle_inhibit_manager.cc -+++ b/ui/ozone/platform/wayland/host/zwp_idle_inhibit_manager.cc -@@ -12,7 +12,7 @@ - namespace ui { - - namespace { --constexpr uint32_t kMaxZwpIdleInhibitManagerVersion = 1; -+constexpr uint32_t kMinVersion = 1; - } - - // static -@@ -26,11 +26,13 @@ void ZwpIdleInhibitManager::Instantiate(WaylandConnection* connection, - uint32_t version) { - DCHECK_EQ(interface, kInterfaceName); - -- if (connection->zwp_idle_inhibit_manager_) -+ if (connection->zwp_idle_inhibit_manager_ || -+ !wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; -+ } - -- auto manager = wl::Bind<zwp_idle_inhibit_manager_v1>( -- registry, name, std::min(version, kMaxZwpIdleInhibitManagerVersion)); -+ auto manager = -+ wl::Bind<zwp_idle_inhibit_manager_v1>(registry, name, kMinVersion); - if (!manager) { - LOG(ERROR) << "Failed to bind zwp_idle_inhibit_manager_v1"; - return; -diff --git a/ui/ozone/platform/wayland/host/zwp_primary_selection_device_manager.cc b/ui/ozone/platform/wayland/host/zwp_primary_selection_device_manager.cc -index f6f9fd23c35..795a09c0565 100644 ---- a/ui/ozone/platform/wayland/host/zwp_primary_selection_device_manager.cc -+++ b/ui/ozone/platform/wayland/host/zwp_primary_selection_device_manager.cc -@@ -16,7 +16,7 @@ - namespace ui { - - namespace { --constexpr uint32_t kMaxGtkPrimarySelectionDeviceManagerVersion = 1; -+constexpr uint32_t kMinVersion = 1; - } // namespace - - // static -@@ -31,12 +31,13 @@ void ZwpPrimarySelectionDeviceManager::Instantiate( - uint32_t version) { - DCHECK_EQ(interface, kInterfaceName); - -- if (connection->zwp_primary_selection_device_manager_) -+ if (connection->zwp_primary_selection_device_manager_ || -+ !wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; -+ } - - auto manager = wl::Bind<zwp_primary_selection_device_manager_v1>( -- registry, name, -- std::min(version, kMaxGtkPrimarySelectionDeviceManagerVersion)); -+ registry, name, kMinVersion); - if (!manager) { - LOG(ERROR) << "Failed to bind zwp_primary_selection_device_manager_v1"; - return; - -From d7b8201c173e07b0e2bd1f9ad829c8f4fe81a7a3 Mon Sep 17 00:00:00 2001 -From: Alexander Dunaev <adun...@igalia.com> -Date: Tue, 28 Dec 2021 14:02:05 +0000 -Subject: [PATCH 2/2] [linux/wayland] Fixed terminate caused by binding to - wrong version. - -This is a fixup to [1] where a typo creeped in. - -[1] https://chromium-review.googlesource.com/c/chromium/src/+/3337037 - -Bug: 1279574 -Change-Id: If8f1a308ce8d27b51a9cd4d52ad8eec2e29edf95 -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3358254 -Reviewed-by: Antonio Gomes <toniki...@igalia.com> -Commit-Queue: Alexander Dunaev <adun...@igalia.com> -Auto-Submit: Alexander Dunaev <adun...@igalia.com> -Cr-Commit-Position: refs/heads/main@{#954286} - -(cherry picked from commit a84b79daa8897b822336b8f348ef4daaae07af37) ---- - ui/ozone/platform/wayland/host/wayland_drm.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ui/ozone/platform/wayland/host/wayland_drm.cc b/ui/ozone/platform/wayland/host/wayland_drm.cc -index a7ed2e20ffe..b10b79412e5 100644 ---- a/ui/ozone/platform/wayland/host/wayland_drm.cc -+++ b/ui/ozone/platform/wayland/host/wayland_drm.cc -@@ -32,7 +32,7 @@ void WaylandDrm::Instantiate(WaylandConnection* connection, - DCHECK_EQ(interface, kInterfaceName); - - if (connection->drm_ || -- !!wl::CanBind(interface, version, kMinVersion, kMinVersion)) { -+ !wl::CanBind(interface, version, kMinVersion, kMinVersion)) { - return; - } -