[arch-commits] Commit in chromium/repos/staging-x86_64 (13 files)
Evangelos Foutras
foutrelis at gemini.archlinux.org
Tue Feb 1 23:17:43 UTC 2022
Date: Tuesday, February 1, 2022 @ 23:17:43
Author: foutrelis
Revision: 435736
archrelease: copy trunk to staging-x86_64
Added:
chromium/repos/staging-x86_64/PKGBUILD
(from rev 435735, chromium/trunk/PKGBUILD)
chromium/repos/staging-x86_64/chromium-93-ffmpeg-4.4.patch
(from rev 435735, chromium/trunk/chromium-93-ffmpeg-4.4.patch)
chromium/repos/staging-x86_64/downgrade-duplicate-peer-error-to-dvlog.patch
(from rev 435735, chromium/trunk/downgrade-duplicate-peer-error-to-dvlog.patch)
chromium/repos/staging-x86_64/fix-build-break-with-system-libdrm.patch
(from rev 435735, chromium/trunk/fix-build-break-with-system-libdrm.patch)
chromium/repos/staging-x86_64/sql-make-VirtualCursor-standard-layout-type.patch
(from rev 435735, chromium/trunk/sql-make-VirtualCursor-standard-layout-type.patch)
chromium/repos/staging-x86_64/unbundle-ffmpeg-av_stream_get_first_dts.patch
(from rev 435735, chromium/trunk/unbundle-ffmpeg-av_stream_get_first_dts.patch)
chromium/repos/staging-x86_64/use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch
(from rev 435735, chromium/trunk/use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch)
chromium/repos/staging-x86_64/use-oauth2-client-switches-as-default.patch
(from rev 435735, chromium/trunk/use-oauth2-client-switches-as-default.patch)
Deleted:
chromium/repos/staging-x86_64/PKGBUILD
chromium/repos/staging-x86_64/sql-make-VirtualCursor-standard-layout-type.patch
chromium/repos/staging-x86_64/unexpire-accelerated-video-decode-flag.patch
chromium/repos/staging-x86_64/use-oauth2-client-switches-as-default.patch
chromium/repos/staging-x86_64/wayland-fix-binding-to-wrong-version.patch
-----------------------------------------------------+
PKGBUILD | 544 +++++++-------
chromium-93-ffmpeg-4.4.patch | 36
downgrade-duplicate-peer-error-to-dvlog.patch | 33
fix-build-break-with-system-libdrm.patch | 62 +
sql-make-VirtualCursor-standard-layout-type.patch | 476 ++++++------
unbundle-ffmpeg-av_stream_get_first_dts.patch | 12
unexpire-accelerated-video-decode-flag.patch | 11
use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch | 72 +
use-oauth2-client-switches-as-default.patch | 34
wayland-fix-binding-to-wrong-version.patch | 683 ------------------
10 files changed, 752 insertions(+), 1211 deletions(-)
Deleted: PKGBUILD
===================================================================
--- PKGBUILD 2022-02-01 23:17:33 UTC (rev 435735)
+++ PKGBUILD 2022-02-01 23:17:43 UTC (rev 435736)
@@ -1,262 +0,0 @@
-# Maintainer: Evangelos Foutras <evangelos at foutrelis.com>
-# Contributor: Pierre Schmitz <pierre at archlinux.de>
-# Contributor: Jan "heftig" Steffens <jan.steffens at gmail.com>
-# Contributor: Daniel J Griffiths <ghost1227 at archlinux.us>
-
-pkgname=chromium
-pkgver=97.0.4692.99
-pkgrel=3
-_launcher_ver=8
-_gcc_patchset=4
-pkgdesc="A web browser built for speed, simplicity, and security"
-arch=('x86_64')
-url="https://www.chromium.org/Home"
-license=('BSD')
-depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt'
- 'ttf-liberation' 'systemd' 'dbus' 'libpulse' 'pciutils' 'libva'
- 'desktop-file-utils' 'hicolor-icon-theme')
-makedepends=('python' 'gn' 'ninja' 'clang' 'lld' 'gperf' 'nodejs' 'pipewire'
- 'java-runtime-headless')
-optdepends=('pipewire: WebRTC desktop sharing under Wayland'
- 'kdialog: support for native dialogs in Plasma'
- 'org.freedesktop.secrets: password storage backend on GNOME / Xfce'
- 'kwallet: support for storing passwords in KWallet on Plasma')
-options=('!lto') # Chromium adds its own flags for ThinLTO
-source=(https://commondatastorage.googleapis.com/chromium-browser-official/$pkgname-$pkgver.tar.xz
- https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver/chromium-launcher-$_launcher_ver.tar.gz
- https://github.com/stha09/chromium-patches/releases/download/chromium-${pkgver%%.*}-patchset-$_gcc_patchset/chromium-${pkgver%%.*}-patchset-$_gcc_patchset.tar.xz
- wayland-fix-binding-to-wrong-version.patch
- sql-make-VirtualCursor-standard-layout-type.patch
- unexpire-accelerated-video-decode-flag.patch
- use-oauth2-client-switches-as-default.patch)
-sha256sums=('c91bae205705b367f2cfc1f72ce1ee99b2ceb5edfc584e15c60a6ab5ff01ecba'
- '213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a'
- '7af5c0a55a20c0fb496b2f4448d89203a83bb1914754d864460e55e68731ef0b'
- '29541840921302060f712838ba460cd7e988148af3ce3c9dc45437fc78442a67'
- 'dd317f85e5abfdcfc89c6f23f4c8edbcdebdd5e083dcec770e5da49ee647d150'
- '2a97b26c3d6821b15ef4ef1369905c6fa3e9c8da4877eb9af4361452a425290b'
- 'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711')
-
-# Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
-# Keys are the names in the above script; values are the dependencies in Arch
-declare -gA _system_libs=(
- [ffmpeg]=ffmpeg
- [flac]=flac
- [fontconfig]=fontconfig
- [freetype]=freetype2
- [harfbuzz-ng]=harfbuzz
- [icu]=icu
- [libdrm]=
- [libjpeg]=libjpeg
- [libpng]=libpng
- #[libvpx]=libvpx
- [libwebp]=libwebp
- [libxml]=libxml2
- [libxslt]=libxslt
- [opus]=opus
- [re2]=re2
- [snappy]=snappy
- [zlib]=minizip
-)
-_unwanted_bundled_libs=(
- $(printf "%s\n" ${!_system_libs[@]} | sed 's/^libjpeg$/&_turbo/')
-)
-depends+=(${_system_libs[@]})
-
-# Google API keys (see https://www.chromium.org/developers/how-tos/api-keys)
-# Note: These are for Arch Linux use ONLY. For your own distribution, please
-# get your own set of keys.
-#
-# Starting with Chromium 89 (2021-03-02) the OAuth2 credentials have been left
-# out: https://archlinux.org/news/chromium-losing-sync-support-in-early-march/
-_google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM
-
-prepare() {
- cd "$srcdir/$pkgname-$pkgver"
-
- # Allow building against system libraries in official builds
- sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
- tools/generate_shim_headers/generate_shim_headers.py
-
- # https://crbug.com/893950
- sed -i -e 's/\<xmlMalloc\>/malloc/' -e 's/\<xmlFree\>/free/' \
- third_party/blink/renderer/core/xml/*.cc \
- third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
- third_party/libxml/chromium/*.cc \
- third_party/maldoca/src/maldoca/ole/oss_utils.h
-
- # Use the --oauth2-client-id= and --oauth2-client-secret= switches for
- # setting GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET at
- # runtime -- this allows signing into Chromium without baked-in values
- patch -Np1 -i ../use-oauth2-client-switches-as-default.patch
-
- # https://crbug.com/1207478
- patch -Np0 -i ../unexpire-accelerated-video-decode-flag.patch
-
- # Upstream fixes
- patch -Np1 -i ../wayland-fix-binding-to-wrong-version.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/
-
- # Link to system tools required by the build
- mkdir -p third_party/node/linux/node-linux-x64/bin
- ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
- ln -s /usr/bin/java third_party/jdk/current/bin/
-
- # Remove bundled libraries for which we will use the system copies; this
- # *should* do what the remove_bundled_libraries.py script does, with the
- # added benefit of not having to list all the remaining libraries
- local _lib
- for _lib in ${_unwanted_bundled_libs[@]}; do
- find "third_party/$_lib" -type f \
- \! -path "third_party/$_lib/chromium/*" \
- \! -path "third_party/$_lib/google/*" \
- \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
- \! -regex '.*\.\(gn\|gni\|isolate\)' \
- -delete
- done
-
- ./build/linux/unbundle/replace_gn_files.py \
- --system-libraries "${!_system_libs[@]}"
-}
-
-build() {
- make -C chromium-launcher-$_launcher_ver
-
- cd "$srcdir/$pkgname-$pkgver"
-
- export CC=clang
- export CXX=clang++
- export AR=ar
- export NM=nm
-
- local _flags=(
- 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
- 'host_toolchain="//build/toolchain/linux/unbundle:default"'
- 'clang_use_chrome_plugins=false'
- 'is_official_build=true' # implies is_cfi=true on x86_64
- 'treat_warnings_as_errors=false'
- 'disable_fieldtrial_testing_config=true'
- 'blink_enable_generated_code_formatting=false'
- 'ffmpeg_branding="Chrome"'
- 'proprietary_codecs=true'
- 'rtc_use_pipewire=true'
- 'link_pulseaudio=true'
- 'use_gnome_keyring=false'
- 'use_sysroot=false'
- 'use_custom_libcxx=false'
- 'enable_hangout_services_extension=true'
- 'enable_widevine=true'
- 'enable_nacl=false'
- "google_api_key=\"$_google_api_key\""
- )
-
- if [[ -n ${_system_libs[icu]+set} ]]; then
- _flags+=('icu_use_data_file=false')
- fi
-
- if check_option strip y; then
- _flags+=('symbol_level=0')
- fi
-
- # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
- CFLAGS+=' -Wno-builtin-macro-redefined'
- CXXFLAGS+=' -Wno-builtin-macro-redefined'
- CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
-
- # Do not warn about unknown warning options
- CFLAGS+=' -Wno-unknown-warning-option'
- CXXFLAGS+=' -Wno-unknown-warning-option'
-
- # https://github.com/ungoogled-software/ungoogled-chromium-archlinux/issues/123
- CFLAGS=${CFLAGS/-fexceptions}
- CFLAGS=${CFLAGS/-fcf-protection}
- CXXFLAGS=${CXXFLAGS/-fexceptions}
- CXXFLAGS=${CXXFLAGS/-fcf-protection}
-
- # This appears to cause random segfaults
- CFLAGS=${CFLAGS/-fstack-clash-protection}
- CXXFLAGS=${CXXFLAGS/-fstack-clash-protection}
-
- # https://crbug.com/957519#c122
- CXXFLAGS=${CXXFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS}
-
- gn gen out/Release --args="${_flags[*]}"
- ninja -C out/Release chrome chrome_sandbox chromedriver
-}
-
-package() {
- cd chromium-launcher-$_launcher_ver
- make PREFIX=/usr DESTDIR="$pkgdir" install
- install -Dm644 LICENSE \
- "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
-
- cd "$srcdir/$pkgname-$pkgver"
-
- install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium"
- install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
- ln -s /usr/lib/chromium/chromedriver "$pkgdir/usr/bin/chromedriver"
-
- install -Dm644 chrome/installer/linux/common/desktop.template \
- "$pkgdir/usr/share/applications/chromium.desktop"
- install -Dm644 chrome/app/resources/manpage.1.in \
- "$pkgdir/usr/share/man/man1/chromium.1"
- sed -i \
- -e 's/@@MENUNAME@@/Chromium/g' \
- -e 's/@@PACKAGE@@/chromium/g' \
- -e 's/@@USR_BIN_SYMLINK_NAME@@/chromium/g' \
- "$pkgdir/usr/share/applications/chromium.desktop" \
- "$pkgdir/usr/share/man/man1/chromium.1"
-
- install -Dm644 chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml \
- "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
- sed -ni \
- -e 's/chromium-browser\.desktop/chromium.desktop/' \
- -e '/<update_contact>/d' \
- -e '/<p>/N;/<p>\n.*\(We invite\|Chromium supports Vorbis\)/,/<\/p>/d' \
- -e '/^<?xml/,$p' \
- "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
-
- local toplevel_files=(
- chrome_100_percent.pak
- chrome_200_percent.pak
- chrome_crashpad_handler
- chromedriver
- resources.pak
- v8_context_snapshot.bin
-
- # ANGLE
- libEGL.so
- libGLESv2.so
-
- # SwiftShader ICD
- libvk_swiftshader.so
- vk_swiftshader_icd.json
- )
-
- if [[ -z ${_system_libs[icu]+set} ]]; then
- toplevel_files+=(icudtl.dat)
- fi
-
- cp "${toplevel_files[@]/#/out/Release/}" "$pkgdir/usr/lib/chromium/"
- install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Release/locales/*.pak
- install -Dm755 -t "$pkgdir/usr/lib/chromium/swiftshader" out/Release/swiftshader/*.so
-
- for size in 24 48 64 128 256; do
- install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
- "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
- done
-
- for size in 16 32; do
- install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
- "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
- done
-
- install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
-}
-
-# vim:set ts=2 sw=2 et:
Copied: chromium/repos/staging-x86_64/PKGBUILD (from rev 435735, chromium/trunk/PKGBUILD)
===================================================================
--- PKGBUILD (rev 0)
+++ PKGBUILD 2022-02-01 23:17:43 UTC (rev 435736)
@@ -0,0 +1,282 @@
+# Maintainer: Evangelos Foutras <evangelos at foutrelis.com>
+# Contributor: Pierre Schmitz <pierre at archlinux.de>
+# Contributor: Jan "heftig" Steffens <jan.steffens at gmail.com>
+# Contributor: Daniel J Griffiths <ghost1227 at archlinux.us>
+
+pkgname=chromium
+pkgver=98.0.4758.80
+pkgrel=2
+_launcher_ver=8
+_gcc_patchset=5
+pkgdesc="A web browser built for speed, simplicity, and security"
+arch=('x86_64')
+url="https://www.chromium.org/Home"
+license=('BSD')
+depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt'
+ 'ttf-liberation' 'systemd' 'dbus' 'libpulse' 'pciutils' 'libva'
+ 'desktop-file-utils' 'hicolor-icon-theme')
+makedepends=('python' 'gn' 'ninja' 'clang' 'lld' 'gperf' 'nodejs' 'pipewire'
+ 'java-runtime-headless')
+optdepends=('pipewire: WebRTC desktop sharing under Wayland'
+ 'kdialog: support for native dialogs in Plasma'
+ 'org.freedesktop.secrets: password storage backend on GNOME / Xfce'
+ 'kwallet: support for storing passwords in KWallet on Plasma')
+options=('debug' '!lto') # Chromium adds its own flags for ThinLTO
+source=(https://commondatastorage.googleapis.com/chromium-browser-official/$pkgname-$pkgver.tar.xz
+ https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver/chromium-launcher-$_launcher_ver.tar.gz
+ https://github.com/stha09/chromium-patches/releases/download/chromium-${pkgver%%.*}-patchset-$_gcc_patchset/chromium-${pkgver%%.*}-patchset-$_gcc_patchset.tar.xz
+ downgrade-duplicate-peer-error-to-dvlog.patch
+ fix-build-break-with-system-libdrm.patch
+ use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch
+ sql-make-VirtualCursor-standard-layout-type.patch
+ chromium-93-ffmpeg-4.4.patch
+ unbundle-ffmpeg-av_stream_get_first_dts.patch
+ use-oauth2-client-switches-as-default.patch)
+sha256sums=('c87266e20f860a32c48affc70a769368d1b876dbad768e3aa93ee3c335944171'
+ '213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a'
+ 'f561145514e9d30a696a82f6a6a4eca06e664b58d7cda30dad9afb2cef341a4d'
+ '291c6a6ad44c06ae8d1b13433f0c4e37d280c70fb06eaa97a1cc9b0dcc122aaa'
+ 'edf4d973ff197409d319bb6fbbaa529e53bc62347d26b0733c45a116a1b23f37'
+ '9c9c280be968f06d269167943680fb72a26fbb05d8c15f60507e316e8a9075d5'
+ 'b94b2e88f63cfb7087486508b8139599c89f96d7a4181c61fec4b4e250ca327a'
+ '1a9e074f417f8ffd78bcd6874d8e2e74a239905bf662f76a7755fa40dc476b57'
+ '1f0c1a7a1eb67d91765c9f28df815f58e1c6dc7b37d0acd4d68cac8e5515786c'
+ 'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711')
+
+# Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
+# Keys are the names in the above script; values are the dependencies in Arch
+declare -gA _system_libs=(
+ [ffmpeg]=ffmpeg
+ [flac]=flac
+ [fontconfig]=fontconfig
+ [freetype]=freetype2
+ [harfbuzz-ng]=harfbuzz
+ [icu]=icu
+ [libdrm]=
+ [libjpeg]=libjpeg
+ [libpng]=libpng
+ #[libvpx]=libvpx
+ [libwebp]=libwebp
+ [libxml]=libxml2
+ [libxslt]=libxslt
+ [opus]=opus
+ [re2]=re2
+ [snappy]=snappy
+ [zlib]=minizip
+)
+_unwanted_bundled_libs=(
+ $(printf "%s\n" ${!_system_libs[@]} | sed 's/^libjpeg$/&_turbo/')
+)
+depends+=(${_system_libs[@]})
+
+# Google API keys (see https://www.chromium.org/developers/how-tos/api-keys)
+# Note: These are for Arch Linux use ONLY. For your own distribution, please
+# get your own set of keys.
+#
+# Starting with Chromium 89 (2021-03-02) the OAuth2 credentials have been left
+# out: https://archlinux.org/news/chromium-losing-sync-support-in-early-march/
+_google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM
+
+prepare() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ # Allow building against system libraries in official builds
+ sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
+ tools/generate_shim_headers/generate_shim_headers.py
+
+ # https://crbug.com/893950
+ sed -i -e 's/\<xmlMalloc\>/malloc/' -e 's/\<xmlFree\>/free/' \
+ third_party/blink/renderer/core/xml/*.cc \
+ third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
+ third_party/libxml/chromium/*.cc \
+ third_party/maldoca/src/maldoca/ole/oss_utils.h
+
+ # Use the --oauth2-client-id= and --oauth2-client-secret= switches for
+ # setting GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET at
+ # runtime -- this allows signing into Chromium without baked-in values
+ patch -Np1 -i ../use-oauth2-client-switches-as-default.patch
+
+ # Patches to build with ffmpeg 4.4; remove when ffmpeg 5.0 moves to stable
+ if ! pkg-config --atleast-version 59 libavformat; then
+ # Fix build with older ffmpeg
+ patch -Np1 -i ../chromium-93-ffmpeg-4.4.patch
+
+ # Substitute the custom function 'av_stream_get_first_dts' for ffmpeg 4.4;
+ # drop this for ffmpeg 5.0 which is patched to include the above function.
+ # https://crbug.com/1251779
+ patch -Np1 -i ../unbundle-ffmpeg-av_stream_get_first_dts.patch
+ fi
+
+ # 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 -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/
+
+ # Link to system tools required by the build
+ mkdir -p third_party/node/linux/node-linux-x64/bin
+ ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
+ ln -s /usr/bin/java third_party/jdk/current/bin/
+
+ # Remove bundled libraries for which we will use the system copies; this
+ # *should* do what the remove_bundled_libraries.py script does, with the
+ # added benefit of not having to list all the remaining libraries
+ local _lib
+ for _lib in ${_unwanted_bundled_libs[@]}; do
+ find "third_party/$_lib" -type f \
+ \! -path "third_party/$_lib/chromium/*" \
+ \! -path "third_party/$_lib/google/*" \
+ \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
+ \! -regex '.*\.\(gn\|gni\|isolate\)' \
+ -delete
+ done
+
+ ./build/linux/unbundle/replace_gn_files.py \
+ --system-libraries "${!_system_libs[@]}"
+}
+
+build() {
+ make -C chromium-launcher-$_launcher_ver
+
+ cd "$srcdir/$pkgname-$pkgver"
+
+ export CC=clang
+ export CXX=clang++
+ export AR=ar
+ export NM=nm
+
+ local _flags=(
+ 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+ 'host_toolchain="//build/toolchain/linux/unbundle:default"'
+ 'clang_use_chrome_plugins=false'
+ 'is_official_build=true' # implies is_cfi=true on x86_64
+ 'symbol_level=0' # sufficient for backtraces on x86(_64)
+ 'treat_warnings_as_errors=false'
+ 'disable_fieldtrial_testing_config=true'
+ 'blink_enable_generated_code_formatting=false'
+ 'ffmpeg_branding="Chrome"'
+ 'proprietary_codecs=true'
+ 'rtc_use_pipewire=true'
+ 'link_pulseaudio=true'
+ 'use_gnome_keyring=false'
+ 'use_sysroot=false'
+ 'use_custom_libcxx=false'
+ 'enable_hangout_services_extension=true'
+ 'enable_widevine=true'
+ 'enable_nacl=false'
+ "google_api_key=\"$_google_api_key\""
+ )
+
+ if [[ -n ${_system_libs[icu]+set} ]]; then
+ _flags+=('icu_use_data_file=false')
+ fi
+
+ # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
+ CFLAGS+=' -Wno-builtin-macro-redefined'
+ CXXFLAGS+=' -Wno-builtin-macro-redefined'
+ CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
+
+ # Do not warn about unknown warning options
+ CFLAGS+=' -Wno-unknown-warning-option'
+ CXXFLAGS+=' -Wno-unknown-warning-option'
+
+ # Let Chromium set its own symbol level
+ CFLAGS=${CFLAGS/-g }
+ CXXFLAGS=${CXXFLAGS/-g }
+ # -fvar-tracking-assignments is not recognized by clang
+ CFLAGS=${CFLAGS/-fvar-tracking-assignments}
+ CXXFLAGS=${CXXFLAGS/-fvar-tracking-assignments}
+
+ # https://github.com/ungoogled-software/ungoogled-chromium-archlinux/issues/123
+ CFLAGS=${CFLAGS/-fexceptions}
+ CFLAGS=${CFLAGS/-fcf-protection}
+ CXXFLAGS=${CXXFLAGS/-fexceptions}
+ CXXFLAGS=${CXXFLAGS/-fcf-protection}
+
+ # This appears to cause random segfaults when combined with ThinLTO
+ # https://bugs.archlinux.org/task/73518
+ CFLAGS=${CFLAGS/-fstack-clash-protection}
+ CXXFLAGS=${CXXFLAGS/-fstack-clash-protection}
+
+ # https://crbug.com/957519#c122
+ CXXFLAGS=${CXXFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS}
+
+ gn gen out/Release --args="${_flags[*]}"
+ ninja -C out/Release chrome chrome_sandbox chromedriver.unstripped
+}
+
+package() {
+ cd chromium-launcher-$_launcher_ver
+ make PREFIX=/usr DESTDIR="$pkgdir" install
+ install -Dm644 LICENSE \
+ "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
+
+ cd "$srcdir/$pkgname-$pkgver"
+
+ install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium"
+ install -D out/Release/chromedriver.unstripped "$pkgdir/usr/bin/chromedriver"
+ install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
+
+ install -Dm644 chrome/installer/linux/common/desktop.template \
+ "$pkgdir/usr/share/applications/chromium.desktop"
+ install -Dm644 chrome/app/resources/manpage.1.in \
+ "$pkgdir/usr/share/man/man1/chromium.1"
+ sed -i \
+ -e 's/@@MENUNAME@@/Chromium/g' \
+ -e 's/@@PACKAGE@@/chromium/g' \
+ -e 's/@@USR_BIN_SYMLINK_NAME@@/chromium/g' \
+ "$pkgdir/usr/share/applications/chromium.desktop" \
+ "$pkgdir/usr/share/man/man1/chromium.1"
+
+ install -Dm644 chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml \
+ "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
+ sed -ni \
+ -e 's/chromium-browser\.desktop/chromium.desktop/' \
+ -e '/<update_contact>/d' \
+ -e '/<p>/N;/<p>\n.*\(We invite\|Chromium supports Vorbis\)/,/<\/p>/d' \
+ -e '/^<?xml/,$p' \
+ "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
+
+ local toplevel_files=(
+ chrome_100_percent.pak
+ chrome_200_percent.pak
+ chrome_crashpad_handler
+ resources.pak
+ v8_context_snapshot.bin
+
+ # ANGLE
+ libEGL.so
+ libGLESv2.so
+
+ # SwiftShader ICD
+ libvk_swiftshader.so
+ vk_swiftshader_icd.json
+ )
+
+ if [[ -z ${_system_libs[icu]+set} ]]; then
+ toplevel_files+=(icudtl.dat)
+ fi
+
+ cp "${toplevel_files[@]/#/out/Release/}" "$pkgdir/usr/lib/chromium/"
+ install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Release/locales/*.pak
+ install -Dm755 -t "$pkgdir/usr/lib/chromium/swiftshader" out/Release/swiftshader/*.so
+
+ for size in 24 48 64 128 256; do
+ install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
+ "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
+ done
+
+ for size in 16 32; do
+ install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
+ "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
+ done
+
+ install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
+}
+
+# vim:set ts=2 sw=2 et:
Copied: chromium/repos/staging-x86_64/chromium-93-ffmpeg-4.4.patch (from rev 435735, chromium/trunk/chromium-93-ffmpeg-4.4.patch)
===================================================================
--- chromium-93-ffmpeg-4.4.patch (rev 0)
+++ chromium-93-ffmpeg-4.4.patch 2022-02-01 23:17:43 UTC (rev 435736)
@@ -0,0 +1,36 @@
+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));
Copied: chromium/repos/staging-x86_64/downgrade-duplicate-peer-error-to-dvlog.patch (from rev 435735, chromium/trunk/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-01 23:17:43 UTC (rev 435736)
@@ -0,0 +1,33 @@
+From 00604ca8ed6d669fb6cb3ae8bacd6028d5ef10ac Mon Sep 17 00:00:00 2001
+From: Stephen Roettger <sroettger at 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 <rockot at google.com>
+Commit-Queue: Stephen Röttger <sroettger at 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;
+ }
+
Copied: chromium/repos/staging-x86_64/fix-build-break-with-system-libdrm.patch (from rev 435735, chromium/trunk/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-01 23:17:43 UTC (rev 435736)
@@ -0,0 +1,62 @@
+From 5b287e0be8d8d8475ec6ef81b16eaa61e19db078 Mon Sep 17 00:00:00 2001
+From: "Steinar H. Gunderson" <sesse at 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
+<dilinger at 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 <andrescj at chromium.org>
+Commit-Queue: Steinar H Gunderson <sesse at chromium.org>
+Auto-Submit: Steinar H Gunderson <sesse at 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 <andreas at apap04.com>
+ Andrei Borza <andrei.borza at gmail.com>
+ Andrei Parvu <andrei.prv at gmail.com>
+ Andrei Parvu <parvu at adobe.com>
++Andres Salomon <dilinger at queued.net>
+ Andreu Botella <andreu at andreubotella.com>
+ Andrew Boyarshin <andrew.boyarshin at gmail.com>
+ Andrew Brampton <me at 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
Deleted: sql-make-VirtualCursor-standard-layout-type.patch
===================================================================
--- sql-make-VirtualCursor-standard-layout-type.patch 2022-02-01 23:17:33 UTC (rev 435735)
+++ sql-make-VirtualCursor-standard-layout-type.patch 2022-02-01 23:17:43 UTC (rev 435736)
@@ -1,238 +0,0 @@
-From 80368f8ba7a8bab13440463a254888311efe3986 Mon Sep 17 00:00:00 2001
-From: Stephan Hartmann <stha09 at googlemail.com>
-Date: Tue, 4 May 2021 15:00:19 +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.
-
-Bug: 1189788
-Change-Id: Ia6dc388cc5ef1c0f2afc75f8ca45b9f12687ca9c
----
- sql/recover_module/btree.cc | 21 +++++++++++++++------
- sql/recover_module/btree.h | 17 +++++++++++++----
- 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(-)
-
-diff --git a/sql/recover_module/btree.cc b/sql/recover_module/btree.cc
-index 9ecaafe8a3..839318abf9 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,
- "Move the destructor to the .cc file if it's non-trival");
- #endif // !DCHECK_IS_ON()
-
--LeafPageDecoder::LeafPageDecoder(DatabasePageReader* db_reader) noexcept
-- : page_id_(db_reader->page_id()),
-- db_reader_(db_reader),
-- cell_count_(ComputeCellCount(db_reader)),
-- next_read_index_(0),
-- last_record_size_(0) {
-+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(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() {
- 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
---- a/sql/recover_module/btree.h
-+++ b/sql/recover_module/btree.h
-@@ -102,7 +102,7 @@ class LeafPageDecoder {
- //
- // |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 = default;
-
- LeafPageDecoder(const LeafPageDecoder&) = delete;
-@@ -150,6 +150,15 @@ class LeafPageDecoder {
- // read as long as CanAdvance() returns true.
- bool TryAdvance();
-
-+ // Initialize with DatabasePageReader
-+ void Initialize(DatabasePageReader* db_reader);
-+
-+ // Reset internal DatabasePageReader
-+ void Reset();
-+
-+ // True if DatabasePageReader is valid
-+ bool IsValid() { return (db_reader_ != nullptr); }
-+
- // 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 {
- static int ComputeCellCount(DatabasePageReader* db_reader);
-
- // The number of the B-tree page this reader is reading.
-- const int64_t page_id_;
-+ int64_t page_id_;
- // Used to read the tree page.
- //
- // Raw pointer usage is acceptable because this instance's owner is expected
- // to ensure that the DatabasePageReader outlives this.
-- DatabasePageReader* const db_reader_;
-+ DatabasePageReader* db_reader_;
- // Caches the ComputeCellCount() value for this reader's page.
-- const int cell_count_ = ComputeCellCount(db_reader_);
-+ int cell_count_;
-
- // The reader's cursor state.
- //
-diff --git a/sql/recover_module/cursor.cc b/sql/recover_module/cursor.cc
-index 0029ff9295..42548bc4b5 100644
---- a/sql/recover_module/cursor.cc
-+++ b/sql/recover_module/cursor.cc
-@@ -26,7 +26,7 @@ VirtualCursor::~VirtualCursor() {
- int VirtualCursor::First() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- inner_decoders_.clear();
-- leaf_decoder_ = nullptr;
-+ leaf_decoder_.Reset();
-
- AppendPageDecoder(table_->root_page_id());
- return Next();
-@@ -36,18 +36,18 @@ int VirtualCursor::Next() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- record_reader_.Reset();
-
-- while (!inner_decoders_.empty() || leaf_decoder_.get()) {
-- if (leaf_decoder_.get()) {
-- if (!leaf_decoder_->CanAdvance()) {
-+ while (!inner_decoders_.empty() || leaf_decoder_.IsValid()) {
-+ if (leaf_decoder_.IsValid()) {
-+ if (!leaf_decoder_.CanAdvance()) {
- // The leaf has been exhausted. Remove it from the DFS stack.
-- leaf_decoder_ = nullptr;
-+ leaf_decoder_.Reset();
- continue;
- }
-- if (!leaf_decoder_->TryAdvance())
-+ if (!leaf_decoder_.TryAdvance())
- continue;
-
-- if (!payload_reader_.Initialize(leaf_decoder_->last_record_size(),
-- leaf_decoder_->last_record_offset())) {
-+ if (!payload_reader_.Initialize(leaf_decoder_.last_record_size(),
-+ leaf_decoder_.last_record_offset())) {
- continue;
- }
- if (!record_reader_.Initialize())
-@@ -99,13 +99,13 @@ int VirtualCursor::ReadColumn(int column_index,
- int64_t VirtualCursor::RowId() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- DCHECK(record_reader_.IsInitialized());
-- DCHECK(leaf_decoder_.get());
-- return leaf_decoder_->last_record_rowid();
-+ DCHECK(leaf_decoder_.IsValid());
-+ return leaf_decoder_.last_record_rowid();
- }
-
- void VirtualCursor::AppendPageDecoder(int page_id) {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
-- DCHECK(leaf_decoder_.get() == nullptr)
-+ DCHECK(!leaf_decoder_.IsValid())
- << __func__
- << " must only be called when the current path has no leaf decoder";
-
-@@ -113,7 +113,7 @@ void VirtualCursor::AppendPageDecoder(int page_id) {
- return;
-
- if (LeafPageDecoder::IsOnValidPage(&db_reader_)) {
-- leaf_decoder_ = std::make_unique<LeafPageDecoder>(&db_reader_);
-+ leaf_decoder_.Initialize(&db_reader_);
- return;
- }
-
-diff --git a/sql/recover_module/cursor.h b/sql/recover_module/cursor.h
-index afcd6900e1..b15c31d425 100644
---- a/sql/recover_module/cursor.h
-+++ b/sql/recover_module/cursor.h
-@@ -129,7 +129,7 @@ class VirtualCursor {
- std::vector<std::unique_ptr<InnerPageDecoder>> inner_decoders_;
-
- // Decodes the leaf page containing records.
-- std::unique_ptr<LeafPageDecoder> leaf_decoder_;
-+ LeafPageDecoder leaf_decoder_;
-
- SEQUENCE_CHECKER(sequence_checker_);
- };
-diff --git a/sql/recover_module/pager.cc b/sql/recover_module/pager.cc
-index 58e75de270..5fe96204e5 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(),
- "ints are not appropriate for representing page IDs");
-
- DatabasePageReader::DatabasePageReader(VirtualTable* table)
-- : page_data_(std::make_unique<uint8_t[]>(table->page_size())),
-- table_(table) {
-+ : page_data_(), 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(),
- "The |read_offset| computation above may overflow");
-
-- 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()));
-
- // |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
---- a/sql/recover_module/pager.h
-+++ b/sql/recover_module/pager.h
-@@ -5,6 +5,7 @@
- #ifndef SQL_RECOVER_MODULE_PAGER_H_
- #define SQL_RECOVER_MODULE_PAGER_H_
-
-+#include <array>
- #include <cstdint>
- #include <memory>
-
-@@ -70,7 +71,7 @@ class DatabasePageReader {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- DCHECK_NE(page_id_, kInvalidPageId)
- << "Successful ReadPage() required before accessing pager state";
-- return page_data_.get();
-+ return page_data_.data();
- }
-
- // The number of bytes in the page read by the last ReadPage() call.
-@@ -137,7 +138,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_;
- // Raw pointer usage is acceptable because this instance's owner is expected
- // to ensure that the VirtualTable outlives this.
- VirtualTable* const table_;
Copied: chromium/repos/staging-x86_64/sql-make-VirtualCursor-standard-layout-type.patch (from rev 435735, chromium/trunk/sql-make-VirtualCursor-standard-layout-type.patch)
===================================================================
--- sql-make-VirtualCursor-standard-layout-type.patch (rev 0)
+++ sql-make-VirtualCursor-standard-layout-type.patch 2022-02-01 23:17:43 UTC (rev 435736)
@@ -0,0 +1,238 @@
+From 144479ad7b4287bee4067f95e4218f614798a865 Mon Sep 17 00:00:00 2001
+From: Stephan Hartmann <stha09 at googlemail.com>
+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.
+
+Bug: 1189788
+Change-Id: Ia6dc388cc5ef1c0f2afc75f8ca45b9f12687ca9c
+---
+ 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 | 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 cc9420e5c05..f12d8fa32a2 100644
+--- a/sql/recover_module/btree.cc
++++ b/sql/recover_module/btree.cc
+@@ -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()
+
+-LeafPageDecoder::LeafPageDecoder(DatabasePageReader* db_reader) noexcept
+- : page_id_(db_reader->page_id()),
+- db_reader_(db_reader),
+- cell_count_(ComputeCellCount(db_reader)),
+- next_read_index_(0),
+- last_record_size_(0) {
++LeafPageDecoder::LeafPageDecoder() noexcept = default;
++
++void LeafPageDecoder::Initialize(DatabasePageReader* 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;
++}
++
+ bool LeafPageDecoder::TryAdvance() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(CanAdvance());
+diff --git a/sql/recover_module/btree.h b/sql/recover_module/btree.h
+index eaa087a5c52..df0e0c937c0 100644
+--- a/sql/recover_module/btree.h
++++ b/sql/recover_module/btree.h
+@@ -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.
+- explicit LeafPageDecoder(DatabasePageReader* db_reader) noexcept;
++ LeafPageDecoder() noexcept;
+ ~LeafPageDecoder() noexcept = default;
+
+ LeafPageDecoder(const LeafPageDecoder&) = delete;
+@@ -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
++ void Reset();
++
++ // True if DatabasePageReader is valid
++ bool IsValid() { return (db_reader_ != nullptr); }
++
+ // 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.
+@@ -164,14 +173,14 @@ class LeafPageDecoder {
+ static int ComputeCellCount(DatabasePageReader* db_reader);
+
+ // The number of the B-tree page this reader is reading.
+- const int64_t page_id_;
++ int64_t page_id_;
+ // Used to read the tree page.
+ //
+ // Raw pointer usage is acceptable because this instance's owner is expected
+ // to ensure that the DatabasePageReader outlives this.
+- DatabasePageReader* const db_reader_;
++ DatabasePageReader* db_reader_;
+ // Caches the ComputeCellCount() value for this reader's page.
+- const int cell_count_ = ComputeCellCount(db_reader_);
++ int cell_count_;
+
+ // The reader's cursor state.
+ //
+diff --git a/sql/recover_module/cursor.cc b/sql/recover_module/cursor.cc
+index 4f827edf1b4..240de4999fe 100644
+--- a/sql/recover_module/cursor.cc
++++ b/sql/recover_module/cursor.cc
+@@ -28,7 +28,7 @@ VirtualCursor::~VirtualCursor() {
+ int VirtualCursor::First() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ inner_decoders_.clear();
+- leaf_decoder_ = nullptr;
++ leaf_decoder_.Reset();
+
+ AppendPageDecoder(table_->root_page_id());
+ return Next();
+@@ -38,18 +38,18 @@ int VirtualCursor::Next() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ record_reader_.Reset();
+
+- while (!inner_decoders_.empty() || leaf_decoder_.get()) {
+- if (leaf_decoder_.get()) {
+- if (!leaf_decoder_->CanAdvance()) {
++ while (!inner_decoders_.empty() || leaf_decoder_.IsValid()) {
++ if (leaf_decoder_.IsValid()) {
++ if (!leaf_decoder_.CanAdvance()) {
+ // The leaf has been exhausted. Remove it from the DFS stack.
+- leaf_decoder_ = nullptr;
++ leaf_decoder_.Reset();
+ continue;
+ }
+- if (!leaf_decoder_->TryAdvance())
++ if (!leaf_decoder_.TryAdvance())
+ continue;
+
+- if (!payload_reader_.Initialize(leaf_decoder_->last_record_size(),
+- leaf_decoder_->last_record_offset())) {
++ if (!payload_reader_.Initialize(leaf_decoder_.last_record_size(),
++ leaf_decoder_.last_record_offset())) {
+ continue;
+ }
+ if (!record_reader_.Initialize())
+@@ -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());
+- DCHECK(leaf_decoder_.get());
+- return leaf_decoder_->last_record_rowid();
++ DCHECK(leaf_decoder_.IsValid());
++ return leaf_decoder_.last_record_rowid();
+ }
+
+ void VirtualCursor::AppendPageDecoder(int page_id) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+- DCHECK(leaf_decoder_.get() == nullptr)
++ DCHECK(!leaf_decoder_.IsValid())
+ << __func__
+ << " must only be called when the current path has no leaf decoder";
+
+@@ -115,7 +115,7 @@ void VirtualCursor::AppendPageDecoder(int page_id) {
+ return;
+
+ if (LeafPageDecoder::IsOnValidPage(&db_reader_)) {
+- leaf_decoder_ = std::make_unique<LeafPageDecoder>(&db_reader_);
++ leaf_decoder_.Initialize(&db_reader_);
+ return;
+ }
+
+diff --git a/sql/recover_module/cursor.h b/sql/recover_module/cursor.h
+index 845b7852648..cc4e85f83f9 100644
+--- a/sql/recover_module/cursor.h
++++ b/sql/recover_module/cursor.h
+@@ -130,7 +130,7 @@ class VirtualCursor {
+ std::vector<std::unique_ptr<InnerPageDecoder>> inner_decoders_;
+
+ // Decodes the leaf page containing records.
+- std::unique_ptr<LeafPageDecoder> leaf_decoder_;
++ LeafPageDecoder leaf_decoder_;
+
+ SEQUENCE_CHECKER(sequence_checker_);
+ };
+diff --git a/sql/recover_module/pager.cc b/sql/recover_module/pager.cc
+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(),
+ "ints are not appropriate for representing page IDs");
+
+ DatabasePageReader::DatabasePageReader(VirtualTable* table)
+- : page_data_(std::make_unique<uint8_t[]>(table->page_size())),
+- table_(table) {
++ : page_data_(table->page_size()), table_(table) {
+ DCHECK(table != nullptr);
+ DCHECK(IsValidPageSize(table->page_size()));
+ }
+@@ -58,7 +57,7 @@ int DatabasePageReader::ReadPage(int page_id) {
+ "The |read_offset| computation above may overflow");
+
+ int sqlite_status =
+- RawRead(sqlite_file, read_size, read_offset, page_data_.get());
++ 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 07cac3cb989..d08f0932fab 100644
+--- a/sql/recover_module/pager.h
++++ b/sql/recover_module/pager.h
+@@ -6,8 +6,8 @@
+ #define SQL_RECOVER_MODULE_PAGER_H_
+
+ #include <cstdint>
+-#include <memory>
+ #include <ostream>
++#include <vector>
+
+ #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";
+- return page_data_.get();
++ return page_data_.data();
+ }
+
+ // The number of bytes in the page read by the last ReadPage() call.
+@@ -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_;
++ 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.
+ const raw_ptr<VirtualTable> table_;
Copied: chromium/repos/staging-x86_64/unbundle-ffmpeg-av_stream_get_first_dts.patch (from rev 435735, chromium/trunk/unbundle-ffmpeg-av_stream_get_first_dts.patch)
===================================================================
--- unbundle-ffmpeg-av_stream_get_first_dts.patch (rev 0)
+++ unbundle-ffmpeg-av_stream_get_first_dts.patch 2022-02-01 23:17:43 UTC (rev 435736)
@@ -0,0 +1,12 @@
+diff --git a/build/linux/unbundle/ffmpeg.gn b/build/linux/unbundle/ffmpeg.gn
+index 16e20744706..6a079b32221 100644
+--- a/build/linux/unbundle/ffmpeg.gn
++++ b/build/linux/unbundle/ffmpeg.gn
+@@ -12,6 +12,7 @@ pkg_config("system_ffmpeg") {
+ "libavformat",
+ "libavutil",
+ ]
++ defines = [ "av_stream_get_first_dts(stream)=stream->first_dts" ]
+ }
+
+ buildflag_header("ffmpeg_features") {
Deleted: unexpire-accelerated-video-decode-flag.patch
===================================================================
--- unexpire-accelerated-video-decode-flag.patch 2022-02-01 23:17:33 UTC (rev 435735)
+++ unexpire-accelerated-video-decode-flag.patch 2022-02-01 23:17:43 UTC (rev 435736)
@@ -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-dev at chromium.org" ],
-- "expiry_milestone": 93
-+ "expiry_milestone": 99
- },
- {
- "name": "enable-accessibility-live-caption",
Copied: chromium/repos/staging-x86_64/use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch (from rev 435735, chromium/trunk/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-01 23:17:43 UTC (rev 435736)
@@ -0,0 +1,72 @@
+From cb0aad687f34629a42053d600cf2947282cea2c0 Mon Sep 17 00:00:00 2001
+From: Lei Zhang <thestig at 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 <nigi at chromium.org>
+Commit-Queue: Lei Zhang <thestig at 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: use-oauth2-client-switches-as-default.patch
===================================================================
--- use-oauth2-client-switches-as-default.patch 2022-02-01 23:17:33 UTC (rev 435735)
+++ use-oauth2-client-switches-as-default.patch 2022-02-01 23:17:43 UTC (rev 435736)
@@ -1,17 +0,0 @@
-diff -upr chromium-89.0.4389.58.orig/google_apis/google_api_keys.cc chromium-89.0.4389.58/google_apis/google_api_keys.cc
---- chromium-89.0.4389.58.orig/google_apis/google_api_keys.cc 2021-02-24 22:37:18.494007649 +0000
-+++ chromium-89.0.4389.58/google_apis/google_api_keys.cc 2021-02-24 22:35:00.865777600 +0000
-@@ -154,11 +154,11 @@ class APIKeyCache {
-
- std::string default_client_id = CalculateKeyValue(
- GOOGLE_DEFAULT_CLIENT_ID,
-- STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID), nullptr,
-+ STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID), ::switches::kOAuth2ClientID,
- std::string(), environment.get(), command_line, gaia_config);
- std::string default_client_secret = CalculateKeyValue(
- GOOGLE_DEFAULT_CLIENT_SECRET,
-- STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET), nullptr,
-+ STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET), ::switches::kOAuth2ClientSecret,
- std::string(), environment.get(), command_line, gaia_config);
-
- // We currently only allow overriding the baked-in values for the
Copied: chromium/repos/staging-x86_64/use-oauth2-client-switches-as-default.patch (from rev 435735, chromium/trunk/use-oauth2-client-switches-as-default.patch)
===================================================================
--- use-oauth2-client-switches-as-default.patch (rev 0)
+++ use-oauth2-client-switches-as-default.patch 2022-02-01 23:17:43 UTC (rev 435736)
@@ -0,0 +1,17 @@
+diff -upr chromium-89.0.4389.58.orig/google_apis/google_api_keys.cc chromium-89.0.4389.58/google_apis/google_api_keys.cc
+--- chromium-89.0.4389.58.orig/google_apis/google_api_keys.cc 2021-02-24 22:37:18.494007649 +0000
++++ chromium-89.0.4389.58/google_apis/google_api_keys.cc 2021-02-24 22:35:00.865777600 +0000
+@@ -154,11 +154,11 @@ class APIKeyCache {
+
+ std::string default_client_id = CalculateKeyValue(
+ GOOGLE_DEFAULT_CLIENT_ID,
+- STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID), nullptr,
++ STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID), ::switches::kOAuth2ClientID,
+ std::string(), environment.get(), command_line, gaia_config);
+ std::string default_client_secret = CalculateKeyValue(
+ GOOGLE_DEFAULT_CLIENT_SECRET,
+- STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET), nullptr,
++ STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET), ::switches::kOAuth2ClientSecret,
+ std::string(), environment.get(), command_line, gaia_config);
+
+ // We currently only allow overriding the baked-in values for the
Deleted: wayland-fix-binding-to-wrong-version.patch
===================================================================
--- wayland-fix-binding-to-wrong-version.patch 2022-02-01 23:17:33 UTC (rev 435735)
+++ wayland-fix-binding-to-wrong-version.patch 2022-02-01 23:17:43 UTC (rev 435736)
@@ -1,683 +0,0 @@
-From 5e3ed3d015d0ddae5e4d813204616d89d2f859c7 Mon Sep 17 00:00:00 2001
-From: Alexander Dunaev <adunaev at 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 <msisov at igalia.com>
-Commit-Queue: Alexander Dunaev <adunaev at 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 ++++----
- .../wayland/host/surface_augmenter.cc | 11 ++++++----
- .../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 ++++----
- 20 files changed, 131 insertions(+), 69 deletions(-)
-
-diff --git a/ui/ozone/platform/wayland/common/wayland_object.cc b/ui/ozone/platform/wayland/common/wayland_object.cc
-index 0374cb9d874..8faa648120d 100644
---- a/ui/ozone/platform/wayland/common/wayland_object.cc
-+++ b/ui/ozone/platform/wayland/common/wayland_object.cc
-@@ -35,6 +35,8 @@
- #include <xdg-shell-client-protocol.h>
- #include <xdg-shell-unstable-v6-client-protocol.h>
-
-+#include "base/logging.h"
-+
- namespace wl {
- namespace {
-
-@@ -77,6 +79,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 3a8bb9e494d..ce787bf8805 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/surface_augmenter.cc b/ui/ozone/platform/wayland/host/surface_augmenter.cc
-index 8294897bcd5..0589076bcf5 100644
---- a/ui/ozone/platform/wayland/host/surface_augmenter.cc
-+++ b/ui/ozone/platform/wayland/host/surface_augmenter.cc
-@@ -13,7 +13,8 @@
- namespace ui {
-
- namespace {
--constexpr uint32_t kMaxSurfaceAugmenterVersion = 1;
-+constexpr uint32_t kMinVersion = 1;
-+constexpr uint32_t kMaxVersion = 1;
- }
-
- // static
-@@ -27,11 +28,13 @@ void SurfaceAugmenter::Instantiate(WaylandConnection* connection,
- uint32_t version) {
- DCHECK_EQ(interface, kInterfaceName);
-
-- if (connection->surface_augmenter_)
-+ if (connection->surface_augmenter_ ||
-+ !wl::CanBind(interface, version, kMinVersion, kMaxVersion)) {
- return;
-+ }
-
-- auto augmenter = wl::Bind<surface_augmenter>(
-- registry, name, std::min(version, kMaxSurfaceAugmenterVersion));
-+ auto augmenter = wl::Bind<surface_augmenter>(registry, name,
-+ std::min(version, kMaxVersion));
- if (!augmenter) {
- 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 2d481d1167e..13e2b2ea685 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 b1ae436db08..1b5585f7c18 100644
---- a/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc
-+++ b/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc
-@@ -19,7 +19,8 @@
- namespace ui {
-
- namespace {
--constexpr uint32_t kMaxAuraShellVersion = 28;
-+constexpr uint32_t kMinVersion = 1;
-+constexpr uint32_t kMaxVersion = 28;
- }
-
- // static
-@@ -33,11 +34,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 cd9eae3117ccc930f0cfae6d24bba1d6d66d769c Mon Sep 17 00:00:00 2001
-From: Alexander Dunaev <adunaev at 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 <tonikitoo at igalia.com>
-Commit-Queue: Alexander Dunaev <adunaev at igalia.com>
-Auto-Submit: Alexander Dunaev <adunaev at 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;
- }
-
More information about the arch-commits
mailing list