Date: Friday, July 1, 2022 @ 16:21:08 Author: tensor5 Revision: 1243214
archrelease: copy trunk to community-x86_64 Added: electron17/repos/community-x86_64/PKGBUILD (from rev 1243213, electron17/trunk/PKGBUILD) electron17/repos/community-x86_64/breakpad-fix-for-non-constant-SIGSTKSZ.patch (from rev 1243213, electron17/trunk/breakpad-fix-for-non-constant-SIGSTKSZ.patch) electron17/repos/community-x86_64/cppgc-fix-include.patch (from rev 1243213, electron17/trunk/cppgc-fix-include.patch) electron17/repos/community-x86_64/default_app-icon.patch (from rev 1243213, electron17/trunk/default_app-icon.patch) electron17/repos/community-x86_64/downgrade-duplicate-peer-error-to-dvlog.patch (from rev 1243213, electron17/trunk/downgrade-duplicate-peer-error-to-dvlog.patch) electron17/repos/community-x86_64/electron-launcher.sh (from rev 1243213, electron17/trunk/electron-launcher.sh) electron17/repos/community-x86_64/electron.desktop (from rev 1243213, electron17/trunk/electron.desktop) electron17/repos/community-x86_64/fix-build-break-with-system-libdrm.patch (from rev 1243213, electron17/trunk/fix-build-break-with-system-libdrm.patch) electron17/repos/community-x86_64/iwyu-add-utility-for-std-exchange.patch (from rev 1243213, electron17/trunk/iwyu-add-utility-for-std-exchange.patch) electron17/repos/community-x86_64/jinja-python-3.10.patch (from rev 1243213, electron17/trunk/jinja-python-3.10.patch) electron17/repos/community-x86_64/sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch (from rev 1243213, electron17/trunk/sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch) electron17/repos/community-x86_64/sql-make-VirtualCursor-standard-layout-type.patch (from rev 1243213, electron17/trunk/sql-make-VirtualCursor-standard-layout-type.patch) electron17/repos/community-x86_64/std-vector-non-const.patch (from rev 1243213, electron17/trunk/std-vector-non-const.patch) electron17/repos/community-x86_64/use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch (from rev 1243213, electron17/trunk/use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch) electron17/repos/community-x86_64/use-system-libraries-in-node.patch (from rev 1243213, electron17/trunk/use-system-libraries-in-node.patch) Deleted: electron17/repos/community-x86_64/PKGBUILD electron17/repos/community-x86_64/breakpad-fix-for-non-constant-SIGSTKSZ.patch electron17/repos/community-x86_64/default_app-icon.patch electron17/repos/community-x86_64/downgrade-duplicate-peer-error-to-dvlog.patch electron17/repos/community-x86_64/electron-launcher.sh electron17/repos/community-x86_64/electron.desktop electron17/repos/community-x86_64/fix-build-break-with-system-libdrm.patch electron17/repos/community-x86_64/jinja-python-3.10.patch electron17/repos/community-x86_64/sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch electron17/repos/community-x86_64/sql-make-VirtualCursor-standard-layout-type.patch electron17/repos/community-x86_64/std-vector-non-const.patch electron17/repos/community-x86_64/use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch electron17/repos/community-x86_64/use-system-libraries-in-node.patch ------------------------------------------------------------+ PKGBUILD | 570 +++++------ breakpad-fix-for-non-constant-SIGSTKSZ.patch | 70 - cppgc-fix-include.patch | 28 default_app-icon.patch | 42 downgrade-duplicate-peer-error-to-dvlog.patch | 66 - electron-launcher.sh | 40 electron.desktop | 14 fix-build-break-with-system-libdrm.patch | 124 +- iwyu-add-utility-for-std-exchange.patch | 27 jinja-python-3.10.patch | 44 sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch | 78 - sql-make-VirtualCursor-standard-layout-type.patch | 476 ++++----- std-vector-non-const.patch | 230 ++-- use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch | 144 +- use-system-libraries-in-node.patch | 106 +- 15 files changed, 1060 insertions(+), 999 deletions(-) Deleted: PKGBUILD =================================================================== --- PKGBUILD 2022-07-01 16:20:43 UTC (rev 1243213) +++ PKGBUILD 2022-07-01 16:21:08 UTC (rev 1243214) @@ -1,282 +0,0 @@ -# Maintainer: Nicola Squartini <tens...@gmail.com> - -_use_suffix=1 -pkgver=17.4.3 -_commit=322f1c3f8907f2592eef5b5e03a97045e30df9e3 -_chromiumver=98.0.4758.141 -_gcc_patchset=5 -# shellcheck disable=SC2034 -pkgrel=1 - -_major_ver=${pkgver%%.*} -if [[ ${_use_suffix} != 0 ]]; then - pkgname="electron${_major_ver}" -else - pkgname=electron -fi -# shellcheck disable=SC2034 -pkgdesc='Build cross platform desktop apps with web technologies' -# shellcheck disable=SC2034 -arch=('x86_64') -# shellcheck disable=SC2034 -url='https://electronjs.org/' -# shellcheck disable=SC2034 -license=('MIT' 'custom') -# shellcheck disable=SC2034 -depends=('c-ares' 'ffmpeg' 'gtk3' 'libevent' 'libxslt' 'minizip' 'nss' 're2' - 'snappy') -# shellcheck disable=SC2034 -makedepends=('clang' 'git' 'gn' 'gperf' 'harfbuzz-icu' 'http-parser' - 'java-runtime-headless' 'jsoncpp' 'libnotify' 'lld' 'llvm' 'ninja' - 'npm' 'pciutils' 'pipewire' 'python' 'python-httplib2' - 'python-pyparsing' 'python-six' 'wget' 'yarn') -# shellcheck disable=SC2034 -optdepends=('kde-cli-tools: file deletion support (kioclient5)' - 'libappindicator-gtk3: StatusNotifierItem support' - 'pipewire: WebRTC desktop sharing under Wayland' - 'trash-cli: file deletion support (trash-put)' - "xdg-utils: open URLs with desktop's default (xdg-email, xdg-open)") -if [[ ${_use_suffix} == 0 ]]; then - # shellcheck disable=SC2034 - conflicts=("electron${_major_ver}") - # shellcheck disable=SC2034 - provides=("electron${_major_ver}") -fi -# shellcheck disable=SC2034 -options=('!lto') # Electron adds its own flags for ThinLTO -# shellcheck disable=SC2034 -source=('git+https://github.com/electron/electron.git' - 'git+https://chromium.googlesource.com/chromium/tools/depot_tools.git#branch=main' - "https://github.com/stha09/chromium-patches/releases/download/chromium-${_chromiumver%%.*}-patchset-${_gcc_patchset}/chromium-${_chromiumver%%.*}-patchset-${_gcc_patchset}.tar.xz" - "electron-launcher.sh" - "electron.desktop" - 'default_app-icon.patch' - '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' - ) -# shellcheck disable=SC2034 -sha256sums=('SKIP' - 'SKIP' - 'f561145514e9d30a696a82f6a6a4eca06e664b58d7cda30dad9afb2cef341a4d' - '3953f532a3ea5fce19ee33600c6ead89dcd066df6a01d3c3ab4c24f96e46fca2' - '4484200d90b76830b69eea3a471c103999a3ce86bb2c29e6c14c945bf4102bae' - '75bac9c4ad32ff9329399b8587f9772e208c009fd822cdfce61b2bd1ee9ac828' - '55dbe71dbc1f3ab60bf1fa79f7aea7ef1fe76436b1d7df48728a1f8227d2134e' - '4fbef42aaa7bf60d059f1a6b0a92dc997d475256110bd4df32c12de7f4f175a7' - 'c70652a8b24c237bcfd27469de32797a2cb46d9f0d63d897bb6418314a25644c' - '291c6a6ad44c06ae8d1b13433f0c4e37d280c70fb06eaa97a1cc9b0dcc122aaa' - 'edf4d973ff197409d319bb6fbbaa529e53bc62347d26b0733c45a116a1b23f37' - 'f910be9370c880de6e1d61cc30383c069e421d7acf406166e4fbfad324fc7d61' - 'b4d28867c1fabde6c50a2cfa3f784730446c4d86e5191e0f0000fbf7b0f91ecf' - '9c9c280be968f06d269167943680fb72a26fbb05d8c15f60507e316e8a9075d5' - 'b94b2e88f63cfb7087486508b8139599c89f96d7a4181c61fec4b4e250ca327a' - ) - -_system_libs=('ffmpeg' - 'flac' - 'fontconfig' - 'freetype' - 'harfbuzz-ng' - 'icu' - 'libdrm' - 'libevent' - 'libjpeg' - 'libpng' -# 'libvpx' - 'libwebp' - 'libxml' - 'libxslt' -# 'openh264' - 'opus' - 're2' - 'snappy' - 'zlib' - ) - -prepare() { - sed -i "s|@ELECTRON@|${pkgname}|" electron-launcher.sh - sed -i "s|@ELECTRON@|${pkgname}|" electron.desktop - if [[ ${_use_suffix} != 0 ]]; then - sed -i "s|@ELECTRON_NAME@|Electron ${_major_ver}|" electron.desktop - else - sed -i "s|@ELECTRON_NAME@|Electron|" electron.desktop - fi - - export PATH="${PATH}:${srcdir:?}/depot_tools" - - echo "Fetching chromium..." - git clone --branch=${_chromiumver} --depth=1 \ - https://chromium.googlesource.com/chromium/src.git - - echo "solutions = [ - { - \"name\": \"src/electron\", - \"url\": \"file://${srcdir}/electron@${_commit}\", - \"deps_file\": \"DEPS\", - \"managed\": False, - \"custom_deps\": { - \"src\": None, - }, - \"custom_vars\": {}, - }, -]" > .gclient - - python "${srcdir}/depot_tools/gclient.py" sync \ - --with_branch_heads \ - --with_tags \ - --nohooks - - ( - cd src/electron || exit - patch -Np1 -i ../../std-vector-non-const.patch - ) - - echo "Running hooks..." - # python "${srcdir}/depot_tools/gclient.py" runhooks - src/build/landmines.py - src/build/util/lastchange.py -o src/build/util/LASTCHANGE - src/build/util/lastchange.py -m GPU_LISTS_VERSION \ - --revision-id-only --header src/gpu/config/gpu_lists_version.h - src/build/util/lastchange.py -m SKIA_COMMIT_HASH \ - -s src/third_party/skia --header src/skia/ext/skia_commit_hash.h - # Create sysmlink to system clang-format - ln -s /usr/bin/clang-format src/buildtools/linux64 - # Create sysmlink to system Node.js - mkdir -p src/third_party/node/linux/node-linux-x64/bin - ln -sf /usr/bin/node src/third_party/node/linux/node-linux-x64/bin - 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 - 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 \ - --gs_url_base=chromeos-prebuilt/afdo-job/llvm - #vpython src/tools/update_pgo_profiles.py \ - # --target=linux \ - # update \ - # --gs-url-base=chromium-optimization-profiles/pgo_profiles - src/electron/script/apply_all_patches.py \ - src/electron/patches/config.json - cd src/electron || exit - yarn install --frozen-lockfile - 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/ - - # 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 - patch -Np1 -i ../default_app-icon.patch # Icon from .desktop file - - echo "Patching Chromium for using system libraries..." - sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \ - tools/generate_shim_headers/generate_shim_headers.py - for lib in $(printf "%s\n" "${_system_libs[@]}" | sed 's/^libjpeg$/&_turbo/'); do - third_party_dir="third_party/${lib}" - if [ ! -d "${third_party_dir}" ]; then - third_party_dir="base/${third_party_dir}" - fi - find "${third_party_dir}" -type f \ - \! -path "${third_party_dir}/chromium/*" \ - \! -path "${third_party_dir}/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() { - export CC=clang - export CXX=clang++ - export AR=ar - export NM=nm - - CFLAGS="${CFLAGS/-fexceptions/}" - CXXFLAGS="${CXXFLAGS/-fexceptions/}" - - # 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} - - # Do not warn about unknown warning options - CFLAGS+=' -Wno-unknown-warning-option' - CXXFLAGS+=' -Wno-unknown-warning-option' - - cd src || exit - export CHROMIUM_BUILDTOOLS_PATH="${PWD}/buildtools" - GN_EXTRA_ARGS=' - blink_symbol_level = 0 - chrome_pgo_phase = 0 - clang_use_chrome_plugins = false - custom_toolchain = "//build/toolchain/linux/unbundle:default" - host_toolchain = "//build/toolchain/linux/unbundle:default" - icu_use_data_file = false - is_component_ffmpeg = false - link_pulseaudio = true - rtc_use_pipewire = true - treat_warnings_as_errors = false - use_custom_libcxx = false - use_gnome_keyring = false - use_sysroot = false - ' - gn gen out/Release \ - --args="import(\"//electron/build/args/release.gn\") ${GN_EXTRA_ARGS}" - ninja -C out/Release electron - # Strip before zip to avoid - # zipfile.LargeZipFile: Filesize would require ZIP64 extensions - strip -s out/Release/electron - ninja -C out/Release electron_dist_zip - # ninja -C out/Release third_party/electron_node:headers -} - -package() { - install -dm755 "${pkgdir:?}/usr/lib/${pkgname}" - bsdtar -xf src/out/Release/dist.zip -C "${pkgdir}/usr/lib/${pkgname}" - - chmod u+s "${pkgdir}/usr/lib/${pkgname}/chrome-sandbox" - - install -dm755 "${pkgdir}/usr/share/licenses/${pkgname}" - for l in "${pkgdir}/usr/lib/${pkgname}"/{LICENSE,LICENSES.chromium.html}; do - ln -s \ - "$(realpath --relative-to="${pkgdir}/usr/share/licenses/${pkgname}" "${l}")" \ - "${pkgdir}/usr/share/licenses/${pkgname}" - done - - install -Dm755 "${srcdir}/electron-launcher.sh" \ - "${pkgdir}/usr/bin/${pkgname}" - if [[ "${_use_suffix}" == 0 ]]; then - ln "${pkgdir}/usr/bin/${pkgname}" \ - "${pkgdir}/usr/bin/${pkgname}${_major_ver}" - fi - - # Install .desktop and icon file (see default_app-icon.patch) - install -Dm644 electron.desktop \ - "${pkgdir}/usr/share/applications/${pkgname}.desktop" - install -Dm644 src/electron/default_app/icon.png \ - "${pkgdir}/usr/share/pixmaps/${pkgname}.png" # hicolor has no 1024x1024 -} Copied: electron17/repos/community-x86_64/PKGBUILD (from rev 1243213, electron17/trunk/PKGBUILD) =================================================================== --- PKGBUILD (rev 0) +++ PKGBUILD 2022-07-01 16:21:08 UTC (rev 1243214) @@ -0,0 +1,288 @@ +# Maintainer: Nicola Squartini <tens...@gmail.com> + +_use_suffix=1 +pkgver=17.4.9 +_commit=4a9890d3a43b8730bae7f7c2caedffe20bc13bef +_chromiumver=98.0.4758.141 +_gcc_patchset=5 +# shellcheck disable=SC2034 +pkgrel=1 + +_major_ver=${pkgver%%.*} +if [[ ${_use_suffix} != 0 ]]; then + pkgname="electron${_major_ver}" +else + pkgname=electron +fi +# shellcheck disable=SC2034 +pkgdesc='Build cross platform desktop apps with web technologies' +# shellcheck disable=SC2034 +arch=('x86_64') +# shellcheck disable=SC2034 +url='https://electronjs.org/' +# shellcheck disable=SC2034 +license=('MIT' 'custom') +# shellcheck disable=SC2034 +depends=('c-ares' 'ffmpeg' 'gtk3' 'libevent' 'libxslt' 'minizip' 'nss' 're2' + 'snappy') +# shellcheck disable=SC2034 +makedepends=('clang' 'git' 'gn' 'gperf' 'harfbuzz-icu' 'http-parser' + 'java-runtime-headless' 'jsoncpp' 'libnotify' 'lld' 'llvm' 'ninja' + 'npm' 'pciutils' 'pipewire' 'python' 'python-httplib2' + 'python-pyparsing' 'python-six' 'wget' 'yarn') +# shellcheck disable=SC2034 +optdepends=('kde-cli-tools: file deletion support (kioclient5)' + 'libappindicator-gtk3: StatusNotifierItem support' + 'pipewire: WebRTC desktop sharing under Wayland' + 'trash-cli: file deletion support (trash-put)' + "xdg-utils: open URLs with desktop's default (xdg-email, xdg-open)") +if [[ ${_use_suffix} == 0 ]]; then + # shellcheck disable=SC2034 + conflicts=("electron${_major_ver}") + # shellcheck disable=SC2034 + provides=("electron${_major_ver}") +fi +# shellcheck disable=SC2034 +options=('!lto') # Electron adds its own flags for ThinLTO +# shellcheck disable=SC2034 +source=('git+https://github.com/electron/electron.git' + 'git+https://chromium.googlesource.com/chromium/tools/depot_tools.git#branch=main' + "https://github.com/stha09/chromium-patches/releases/download/chromium-${_chromiumver%%.*}-patchset-${_gcc_patchset}/chromium-${_chromiumver%%.*}-patchset-${_gcc_patchset}.tar.xz" + "electron-launcher.sh" + "electron.desktop" + 'default_app-icon.patch' + 'jinja-python-3.10.patch' + 'std-vector-non-const.patch' + 'use-system-libraries-in-node.patch' + 'cppgc-fix-include.patch' + 'iwyu-add-utility-for-std-exchange.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' + ) +# shellcheck disable=SC2034 +sha256sums=('SKIP' + 'SKIP' + 'f561145514e9d30a696a82f6a6a4eca06e664b58d7cda30dad9afb2cef341a4d' + '3953f532a3ea5fce19ee33600c6ead89dcd066df6a01d3c3ab4c24f96e46fca2' + '4484200d90b76830b69eea3a471c103999a3ce86bb2c29e6c14c945bf4102bae' + '75bac9c4ad32ff9329399b8587f9772e208c009fd822cdfce61b2bd1ee9ac828' + '55dbe71dbc1f3ab60bf1fa79f7aea7ef1fe76436b1d7df48728a1f8227d2134e' + '4fbef42aaa7bf60d059f1a6b0a92dc997d475256110bd4df32c12de7f4f175a7' + 'c70652a8b24c237bcfd27469de32797a2cb46d9f0d63d897bb6418314a25644c' + '7987b106dbb35b74d6ff28dc8cf2c897647d5ce59d5d6dbe36b2f72542e713b6' + '6f666ef0acb08704ca58cc0d5e97e7ce64d8fea51042e593adae1ce15a61231c' + '291c6a6ad44c06ae8d1b13433f0c4e37d280c70fb06eaa97a1cc9b0dcc122aaa' + 'edf4d973ff197409d319bb6fbbaa529e53bc62347d26b0733c45a116a1b23f37' + 'f910be9370c880de6e1d61cc30383c069e421d7acf406166e4fbfad324fc7d61' + 'b4d28867c1fabde6c50a2cfa3f784730446c4d86e5191e0f0000fbf7b0f91ecf' + '9c9c280be968f06d269167943680fb72a26fbb05d8c15f60507e316e8a9075d5' + 'b94b2e88f63cfb7087486508b8139599c89f96d7a4181c61fec4b4e250ca327a' + ) + +_system_libs=('ffmpeg' + 'flac' + 'fontconfig' + 'freetype' + 'harfbuzz-ng' + 'icu' + 'libdrm' + 'libevent' + 'libjpeg' + 'libpng' +# 'libvpx' + 'libwebp' + 'libxml' + 'libxslt' +# 'openh264' + 'opus' + 're2' + 'snappy' + 'zlib' + ) + +prepare() { + sed -i "s|@ELECTRON@|${pkgname}|" electron-launcher.sh + sed -i "s|@ELECTRON@|${pkgname}|" electron.desktop + if [[ ${_use_suffix} != 0 ]]; then + sed -i "s|@ELECTRON_NAME@|Electron ${_major_ver}|" electron.desktop + else + sed -i "s|@ELECTRON_NAME@|Electron|" electron.desktop + fi + + export PATH="${PATH}:${srcdir:?}/depot_tools" + + echo "Fetching chromium..." + git clone --branch=${_chromiumver} --depth=1 \ + https://chromium.googlesource.com/chromium/src.git + + echo "solutions = [ + { + \"name\": \"src/electron\", + \"url\": \"file://${srcdir}/electron@${_commit}\", + \"deps_file\": \"DEPS\", + \"managed\": False, + \"custom_deps\": { + \"src\": None, + }, + \"custom_vars\": {}, + }, +]" > .gclient + + python "${srcdir}/depot_tools/gclient.py" sync \ + --with_branch_heads \ + --with_tags \ + --nohooks + + ( + cd src/electron || exit + patch -Np1 -i ../../std-vector-non-const.patch + ) + + echo "Running hooks..." + # python "${srcdir}/depot_tools/gclient.py" runhooks + src/build/landmines.py + src/build/util/lastchange.py -o src/build/util/LASTCHANGE + src/build/util/lastchange.py -m GPU_LISTS_VERSION \ + --revision-id-only --header src/gpu/config/gpu_lists_version.h + src/build/util/lastchange.py -m SKIA_COMMIT_HASH \ + -s src/third_party/skia --header src/skia/ext/skia_commit_hash.h + # Create sysmlink to system clang-format + ln -s /usr/bin/clang-format src/buildtools/linux64 + # Create sysmlink to system Node.js + mkdir -p src/third_party/node/linux/node-linux-x64/bin + ln -sf /usr/bin/node src/third_party/node/linux/node-linux-x64/bin + 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 + 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 \ + --gs_url_base=chromeos-prebuilt/afdo-job/llvm + #vpython src/tools/update_pgo_profiles.py \ + # --target=linux \ + # update \ + # --gs-url-base=chromium-optimization-profiles/pgo_profiles + src/electron/script/apply_all_patches.py \ + src/electron/patches/config.json + cd src/electron || exit + yarn install --frozen-lockfile + cd .. + + echo "Applying local patches..." + # Upstream fixes + patch -Np1 -d v8 < ../cppgc-fix-include.patch + patch -Np1 -i ../iwyu-add-utility-for-std-exchange.patch + 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/ + + # 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 + patch -Np1 -i ../default_app-icon.patch # Icon from .desktop file + + echo "Patching Chromium for using system libraries..." + sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \ + tools/generate_shim_headers/generate_shim_headers.py + for lib in $(printf "%s\n" "${_system_libs[@]}" | sed 's/^libjpeg$/&_turbo/'); do + third_party_dir="third_party/${lib}" + if [ ! -d "${third_party_dir}" ]; then + third_party_dir="base/${third_party_dir}" + fi + find "${third_party_dir}" -type f \ + \! -path "${third_party_dir}/chromium/*" \ + \! -path "${third_party_dir}/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() { + export CC=clang + export CXX=clang++ + export AR=ar + export NM=nm + + CFLAGS="${CFLAGS/-fexceptions/}" + CXXFLAGS="${CXXFLAGS/-fexceptions/}" + + # 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} + + # Do not warn about unknown warning options + CFLAGS+=' -Wno-unknown-warning-option' + CXXFLAGS+=' -Wno-unknown-warning-option' + + cd src || exit + export CHROMIUM_BUILDTOOLS_PATH="${PWD}/buildtools" + GN_EXTRA_ARGS=' + blink_symbol_level = 0 + chrome_pgo_phase = 0 + clang_use_chrome_plugins = false + custom_toolchain = "//build/toolchain/linux/unbundle:default" + host_toolchain = "//build/toolchain/linux/unbundle:default" + icu_use_data_file = false + is_component_ffmpeg = false + link_pulseaudio = true + rtc_use_pipewire = true + treat_warnings_as_errors = false + use_custom_libcxx = false + use_gnome_keyring = false + use_sysroot = false + ' + gn gen out/Release \ + --args="import(\"//electron/build/args/release.gn\") ${GN_EXTRA_ARGS}" + ninja -C out/Release electron + # Strip before zip to avoid + # zipfile.LargeZipFile: Filesize would require ZIP64 extensions + strip -s out/Release/electron + ninja -C out/Release electron_dist_zip + # ninja -C out/Release third_party/electron_node:headers +} + +package() { + install -dm755 "${pkgdir:?}/usr/lib/${pkgname}" + bsdtar -xf src/out/Release/dist.zip -C "${pkgdir}/usr/lib/${pkgname}" + + chmod u+s "${pkgdir}/usr/lib/${pkgname}/chrome-sandbox" + + install -dm755 "${pkgdir}/usr/share/licenses/${pkgname}" + for l in "${pkgdir}/usr/lib/${pkgname}"/{LICENSE,LICENSES.chromium.html}; do + ln -s \ + "$(realpath --relative-to="${pkgdir}/usr/share/licenses/${pkgname}" "${l}")" \ + "${pkgdir}/usr/share/licenses/${pkgname}" + done + + install -Dm755 "${srcdir}/electron-launcher.sh" \ + "${pkgdir}/usr/bin/${pkgname}" + if [[ "${_use_suffix}" == 0 ]]; then + ln "${pkgdir}/usr/bin/${pkgname}" \ + "${pkgdir}/usr/bin/${pkgname}${_major_ver}" + fi + + # Install .desktop and icon file (see default_app-icon.patch) + install -Dm644 electron.desktop \ + "${pkgdir}/usr/share/applications/${pkgname}.desktop" + install -Dm644 src/electron/default_app/icon.png \ + "${pkgdir}/usr/share/pixmaps/${pkgname}.png" # hicolor has no 1024x1024 +} Deleted: breakpad-fix-for-non-constant-SIGSTKSZ.patch =================================================================== --- breakpad-fix-for-non-constant-SIGSTKSZ.patch 2022-07-01 16:20:43 UTC (rev 1243213) +++ breakpad-fix-for-non-constant-SIGSTKSZ.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -1,35 +0,0 @@ -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. Copied: electron17/repos/community-x86_64/breakpad-fix-for-non-constant-SIGSTKSZ.patch (from rev 1243213, electron17/trunk/breakpad-fix-for-non-constant-SIGSTKSZ.patch) =================================================================== --- breakpad-fix-for-non-constant-SIGSTKSZ.patch (rev 0) +++ breakpad-fix-for-non-constant-SIGSTKSZ.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -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. Copied: electron17/repos/community-x86_64/cppgc-fix-include.patch (from rev 1243213, electron17/trunk/cppgc-fix-include.patch) =================================================================== --- cppgc-fix-include.patch (rev 0) +++ cppgc-fix-include.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -0,0 +1,28 @@ +From 84cf3230a9680aac3b73c410c2b758760b6d3066 Mon Sep 17 00:00:00 2001 +From: Michael Lippautz <mlippa...@chromium.org> +Date: Thu, 27 Jan 2022 14:14:11 +0100 +Subject: [PATCH] cppgc: Fix include + +Add <utility> to cover for std::exchange. + +Bug: v8:12585 +Change-Id: Ida65144e93e466be8914527d0e646f348c136bcb +Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3420309 +Auto-Submit: Michael Lippautz <mlippa...@chromium.org> +Reviewed-by: Omer Katz <omerk...@chromium.org> +Commit-Queue: Michael Lippautz <mlippa...@chromium.org> +Cr-Commit-Position: refs/heads/main@{#78820} +--- + +diff --git a/src/heap/cppgc/prefinalizer-handler.h b/src/heap/cppgc/prefinalizer-handler.h +index bc17c99..c82c91f 100644 +--- a/src/heap/cppgc/prefinalizer-handler.h ++++ b/src/heap/cppgc/prefinalizer-handler.h +@@ -5,6 +5,7 @@ + #ifndef V8_HEAP_CPPGC_PREFINALIZER_HANDLER_H_ + #define V8_HEAP_CPPGC_PREFINALIZER_HANDLER_H_ + ++#include <utility> + #include <vector> + + #include "include/cppgc/prefinalizer.h" Deleted: default_app-icon.patch =================================================================== --- default_app-icon.patch 2022-07-01 16:20:43 UTC (rev 1243213) +++ default_app-icon.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -1,21 +0,0 @@ ---- a/electron/default_app/default_app.ts -+++ b/electron/default_app/default_app.ts -@@ -59,7 +59,7 @@ - }; - - if (process.platform === 'linux') { -- options.icon = path.join(__dirname, 'icon.png'); -+ options.icon = '/usr/share/pixmaps/electron.png'; - } - - mainWindow = new BrowserWindow(options); ---- a/electron/filenames.gni -+++ b/electron/filenames.gni -@@ -6,7 +6,6 @@ - ] - - default_app_static_sources = [ -- "default_app/icon.png", - "default_app/index.html", - "default_app/package.json", - "default_app/styles.css", Copied: electron17/repos/community-x86_64/default_app-icon.patch (from rev 1243213, electron17/trunk/default_app-icon.patch) =================================================================== --- default_app-icon.patch (rev 0) +++ default_app-icon.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -0,0 +1,21 @@ +--- a/electron/default_app/default_app.ts ++++ b/electron/default_app/default_app.ts +@@ -59,7 +59,7 @@ + }; + + if (process.platform === 'linux') { +- options.icon = path.join(__dirname, 'icon.png'); ++ options.icon = '/usr/share/pixmaps/electron.png'; + } + + mainWindow = new BrowserWindow(options); +--- a/electron/filenames.gni ++++ b/electron/filenames.gni +@@ -6,7 +6,6 @@ + ] + + default_app_static_sources = [ +- "default_app/icon.png", + "default_app/index.html", + "default_app/package.json", + "default_app/styles.css", Deleted: downgrade-duplicate-peer-error-to-dvlog.patch =================================================================== --- downgrade-duplicate-peer-error-to-dvlog.patch 2022-07-01 16:20:43 UTC (rev 1243213) +++ downgrade-duplicate-peer-error-to-dvlog.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -1,33 +0,0 @@ -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; - } - Copied: electron17/repos/community-x86_64/downgrade-duplicate-peer-error-to-dvlog.patch (from rev 1243213, electron17/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-07-01 16:21:08 UTC (rev 1243214) @@ -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; + } + Deleted: electron-launcher.sh =================================================================== --- electron-launcher.sh 2022-07-01 16:20:43 UTC (rev 1243213) +++ electron-launcher.sh 2022-07-01 16:21:08 UTC (rev 1243214) @@ -1,20 +0,0 @@ -#!/usr/bin/bash - -set -euo pipefail - -name=@ELECTRON@ -flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/${name}-flags.conf" - -declare -a flags - -if [[ -f "${flags_file}" ]]; then - mapfile -t < "${flags_file}" -fi - -for line in "${MAPFILE[@]}"; do - if [[ ! "${line}" =~ ^[[:space:]]*#.* ]]; then - flags+=("${line}") - fi -done - -exec /usr/lib/${name}/electron "$@" "${flags[@]}" Copied: electron17/repos/community-x86_64/electron-launcher.sh (from rev 1243213, electron17/trunk/electron-launcher.sh) =================================================================== --- electron-launcher.sh (rev 0) +++ electron-launcher.sh 2022-07-01 16:21:08 UTC (rev 1243214) @@ -0,0 +1,20 @@ +#!/usr/bin/bash + +set -euo pipefail + +name=@ELECTRON@ +flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/${name}-flags.conf" + +declare -a flags + +if [[ -f "${flags_file}" ]]; then + mapfile -t < "${flags_file}" +fi + +for line in "${MAPFILE[@]}"; do + if [[ ! "${line}" =~ ^[[:space:]]*#.* ]]; then + flags+=("${line}") + fi +done + +exec /usr/lib/${name}/electron "$@" "${flags[@]}" Deleted: electron.desktop =================================================================== --- electron.desktop 2022-07-01 16:20:43 UTC (rev 1243213) +++ electron.desktop 2022-07-01 16:21:08 UTC (rev 1243214) @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Application -Name=@ELECTRON_NAME@ -Icon=@ELECTRON@ -Exec=@ELECTRON@ %u -Categories=Development;GTK; -StartupNotify=true Copied: electron17/repos/community-x86_64/electron.desktop (from rev 1243213, electron17/trunk/electron.desktop) =================================================================== --- electron.desktop (rev 0) +++ electron.desktop 2022-07-01 16:21:08 UTC (rev 1243214) @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=@ELECTRON_NAME@ +Icon=@ELECTRON@ +Exec=@ELECTRON@ %u +Categories=Development;GTK; +StartupNotify=true Deleted: fix-build-break-with-system-libdrm.patch =================================================================== --- fix-build-break-with-system-libdrm.patch 2022-07-01 16:20:43 UTC (rev 1243213) +++ fix-build-break-with-system-libdrm.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -1,62 +0,0 @@ -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 Copied: electron17/repos/community-x86_64/fix-build-break-with-system-libdrm.patch (from rev 1243213, electron17/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-07-01 16:21:08 UTC (rev 1243214) @@ -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 Copied: electron17/repos/community-x86_64/iwyu-add-utility-for-std-exchange.patch (from rev 1243213, electron17/trunk/iwyu-add-utility-for-std-exchange.patch) =================================================================== --- iwyu-add-utility-for-std-exchange.patch (rev 0) +++ iwyu-add-utility-for-std-exchange.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -0,0 +1,27 @@ +From 9dd0503835dc875807ab63efb1f477bffed2a852 Mon Sep 17 00:00:00 2001 +From: Stephan Hartmann <sth...@googlemail.com> +Date: Mon, 25 Apr 2022 23:18:30 +0000 +Subject: [PATCH] IWYU: add utility for std::exchange + +Bug: 957519 +Change-Id: I307d520fdc34d2452018ed32a505e7e519739410 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3604643 +Reviewed-by: Wez <w...@chromium.org> +Commit-Queue: Stephan Hartmann <sth...@googlemail.com> +Cr-Commit-Position: refs/heads/main@{#995855} +--- + base/third_party/symbolize/symbolize.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/base/third_party/symbolize/symbolize.h b/base/third_party/symbolize/symbolize.h +index 99029a968d5..278078f6071 100644 +--- a/base/third_party/symbolize/symbolize.h ++++ b/base/third_party/symbolize/symbolize.h +@@ -61,6 +61,7 @@ + #ifdef HAVE_SYMBOLIZE + + #include <algorithm> ++#include <utility> + + #if defined(__ELF__) // defined by gcc + #if defined(__OpenBSD__) Deleted: jinja-python-3.10.patch =================================================================== --- jinja-python-3.10.patch 2022-07-01 16:20:43 UTC (rev 1243213) +++ jinja-python-3.10.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -1,22 +0,0 @@ ---- a/runtime.py -+++ b/runtime.py -@@ -315,7 +315,7 @@ class Context(with_metaclass(ContextMeta - - # register the context as mapping if possible - try: -- from collections import Mapping -+ from collections.abc import Mapping - Mapping.register(Context) - except ImportError: - pass ---- a/sandbox.py -+++ b/sandbox.py -@@ -14,7 +14,7 @@ - """ - import types - import operator --from collections import Mapping -+from collections.abc import Mapping - from jinja2.environment import Environment - from jinja2.exceptions import SecurityError - from jinja2._compat import string_types, PY2 Copied: electron17/repos/community-x86_64/jinja-python-3.10.patch (from rev 1243213, electron17/trunk/jinja-python-3.10.patch) =================================================================== --- jinja-python-3.10.patch (rev 0) +++ jinja-python-3.10.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -0,0 +1,22 @@ +--- a/runtime.py ++++ b/runtime.py +@@ -315,7 +315,7 @@ class Context(with_metaclass(ContextMeta + + # register the context as mapping if possible + try: +- from collections import Mapping ++ from collections.abc import Mapping + Mapping.register(Context) + except ImportError: + pass +--- a/sandbox.py ++++ b/sandbox.py +@@ -14,7 +14,7 @@ + """ + import types + import operator +-from collections import Mapping ++from collections.abc import Mapping + from jinja2.environment import Environment + from jinja2.exceptions import SecurityError + from jinja2._compat import string_types, PY2 Deleted: sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch =================================================================== --- sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch 2022-07-01 16:20:43 UTC (rev 1243213) +++ sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -1,39 +0,0 @@ -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 - Copied: electron17/repos/community-x86_64/sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch (from rev 1243213, electron17/trunk/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-07-01 16:21:08 UTC (rev 1243214) @@ -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 + Deleted: sql-make-VirtualCursor-standard-layout-type.patch =================================================================== --- sql-make-VirtualCursor-standard-layout-type.patch 2022-07-01 16:20:43 UTC (rev 1243213) +++ sql-make-VirtualCursor-standard-layout-type.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -1,238 +0,0 @@ -From 144479ad7b4287bee4067f95e4218f614798a865 Mon Sep 17 00:00:00 2001 -From: Stephan Hartmann <sth...@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: electron17/repos/community-x86_64/sql-make-VirtualCursor-standard-layout-type.patch (from rev 1243213, electron17/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-07-01 16:21:08 UTC (rev 1243214) @@ -0,0 +1,238 @@ +From 144479ad7b4287bee4067f95e4218f614798a865 Mon Sep 17 00:00:00 2001 +From: Stephan Hartmann <sth...@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_; Deleted: std-vector-non-const.patch =================================================================== --- std-vector-non-const.patch 2022-07-01 16:20:43 UTC (rev 1243213) +++ std-vector-non-const.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -1,115 +0,0 @@ -diff --git a/patches/chromium/feat_add_data_parameter_to_processsingleton.patch b/patches/chromium/feat_add_data_parameter_to_processsingleton.patch -index 2bc279b5e..f15d952a2 100644 ---- a/patches/chromium/feat_add_data_parameter_to_processsingleton.patch -+++ b/patches/chromium/feat_add_data_parameter_to_processsingleton.patch -@@ -30,7 +30,7 @@ index eec994c4252f17d9c9c41e66d5dae6509ed98a18..e538c9b76da4d4435e10cd3848438446 - base::RepeatingCallback<bool(const base::CommandLine& command_line, - - const base::FilePath& current_directory)>; - + const base::FilePath& current_directory, --+ const std::vector<const uint8_t> additional_data)>; -++ const std::vector<uint8_t> additional_data)>; - - #if defined(OS_WIN) - ProcessSingleton(const std::string& program_name, -@@ -68,7 +68,7 @@ index a04d139f958a7aaef9b96e8c29317ccf7c97f009..e77cebd31967d28f3cb0db78e7360115 - // |reader| is for sending back ACK message. - void HandleMessage(const std::string& current_dir, - const std::vector<std::string>& argv, --+ const std::vector<const uint8_t> additional_data, -++ const std::vector<uint8_t> additional_data, - SocketReader* reader); - - private: -@@ -79,7 +79,7 @@ index a04d139f958a7aaef9b96e8c29317ccf7c97f009..e77cebd31967d28f3cb0db78e7360115 - - const std::string& current_dir, const std::vector<std::string>& argv, - + const std::string& current_dir, - + const std::vector<std::string>& argv, --+ const std::vector<const uint8_t> additional_data, -++ const std::vector<uint8_t> additional_data, - SocketReader* reader) { - DCHECK(ui_task_runner_->BelongsToCurrentThread()); - DCHECK(reader); -@@ -109,7 +109,7 @@ index a04d139f958a7aaef9b96e8c29317ccf7c97f009..e77cebd31967d28f3cb0db78e7360115 - + base::StringToSizeT(tokens[0], &num_args); - + std::vector<std::string> command_line(tokens.begin() + 1, tokens.begin() + 1 + num_args); - + --+ std::vector<const uint8_t> additional_data; -++ std::vector<uint8_t> additional_data; - + if (tokens.size() >= 3 + num_args) { - + size_t additional_data_size; - + base::StringToSizeT(tokens[1 + num_args], &additional_data_size); -@@ -118,7 +118,7 @@ index a04d139f958a7aaef9b96e8c29317ccf7c97f009..e77cebd31967d28f3cb0db78e7360115 - + std::string(1, kTokenDelimiter)); - + const uint8_t* additional_data_bits = - + reinterpret_cast<const uint8_t*>(remaining_args.c_str()); --+ additional_data = std::vector<const uint8_t>( -++ additional_data = std::vector<uint8_t>( - + additional_data_bits, additional_data_bits + additional_data_size); - + } - + -@@ -184,7 +184,7 @@ index 19d5659d665321da54e05cee01be7da02e0c283b..600ff701b025ba190d05bc30994e3d3e - base::CommandLine* parsed_command_line, - - base::FilePath* current_directory) { - + base::FilePath* current_directory, --+ std::vector<const uint8_t>* parsed_additional_data) { -++ std::vector<uint8_t>* parsed_additional_data) { - // We should have enough room for the shortest command (min_message_size) - // and also be a multiple of wchar_t bytes. The shortest command - - // possible is L"START\0\0" (empty current directory and command line). -@@ -225,7 +225,7 @@ index 19d5659d665321da54e05cee01be7da02e0c283b..600ff701b025ba190d05bc30994e3d3e - + msg.substr(fourth_null + 1, fifth_null - fourth_null); - + const uint8_t* additional_data_bytes = - + reinterpret_cast<const uint8_t*>(additional_data.c_str()); --+ *parsed_additional_data = std::vector<const uint8_t>(additional_data_bytes, -++ *parsed_additional_data = std::vector<uint8_t>(additional_data_bytes, - + additional_data_bytes + additional_data_length); - + - return true; -@@ -239,7 +239,7 @@ index 19d5659d665321da54e05cee01be7da02e0c283b..600ff701b025ba190d05bc30994e3d3e - base::CommandLine parsed_command_line(base::CommandLine::NO_PROGRAM); - base::FilePath current_directory; - - if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory)) { --+ std::vector<const uint8_t> additional_data; -++ std::vector<uint8_t> additional_data; - + if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory, &additional_data)) { - *result = TRUE; - return true; -diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc -index 7328cedf9..9945a04b2 100644 ---- a/shell/browser/api/electron_api_app.cc -+++ b/shell/browser/api/electron_api_app.cc -@@ -517,10 +517,10 @@ bool NotificationCallbackWrapper( - const base::RepeatingCallback< - void(const base::CommandLine& command_line, - const base::FilePath& current_directory, -- const std::vector<const uint8_t> additional_data)>& callback, -+ const std::vector<uint8_t> additional_data)>& callback, - const base::CommandLine& cmd, - const base::FilePath& cwd, -- const std::vector<const uint8_t> additional_data) { -+ const std::vector<uint8_t> additional_data) { - // Make sure the callback is called after app gets ready. - if (Browser::Get()->is_ready()) { - callback.Run(cmd, cwd, std::move(additional_data)); -@@ -1081,7 +1081,7 @@ std::string App::GetLocaleCountryCode() { - - void App::OnSecondInstance(const base::CommandLine& cmd, - const base::FilePath& cwd, -- const std::vector<const uint8_t> additional_data) { -+ const std::vector<uint8_t> additional_data) { - v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); - v8::Locker locker(isolate); - v8::HandleScope handle_scope(isolate); -diff --git a/shell/browser/api/electron_api_app.h b/shell/browser/api/electron_api_app.h -index fd644ed95..838366041 100644 ---- a/shell/browser/api/electron_api_app.h -+++ b/shell/browser/api/electron_api_app.h -@@ -190,7 +190,7 @@ class App : public ElectronBrowserClient::Delegate, - std::string GetLocaleCountryCode(); - void OnSecondInstance(const base::CommandLine& cmd, - const base::FilePath& cwd, -- const std::vector<const uint8_t> additional_data); -+ const std::vector<uint8_t> additional_data); - bool HasSingleInstanceLock() const; - bool RequestSingleInstanceLock(gin::Arguments* args); - void ReleaseSingleInstanceLock(); Copied: electron17/repos/community-x86_64/std-vector-non-const.patch (from rev 1243213, electron17/trunk/std-vector-non-const.patch) =================================================================== --- std-vector-non-const.patch (rev 0) +++ std-vector-non-const.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -0,0 +1,115 @@ +diff --git a/patches/chromium/feat_add_data_parameter_to_processsingleton.patch b/patches/chromium/feat_add_data_parameter_to_processsingleton.patch +index 2bc279b5e..f15d952a2 100644 +--- a/patches/chromium/feat_add_data_parameter_to_processsingleton.patch ++++ b/patches/chromium/feat_add_data_parameter_to_processsingleton.patch +@@ -30,7 +30,7 @@ index eec994c4252f17d9c9c41e66d5dae6509ed98a18..e538c9b76da4d4435e10cd3848438446 + base::RepeatingCallback<bool(const base::CommandLine& command_line, + - const base::FilePath& current_directory)>; + + const base::FilePath& current_directory, +-+ const std::vector<const uint8_t> additional_data)>; +++ const std::vector<uint8_t> additional_data)>; + + #if defined(OS_WIN) + ProcessSingleton(const std::string& program_name, +@@ -68,7 +68,7 @@ index a04d139f958a7aaef9b96e8c29317ccf7c97f009..e77cebd31967d28f3cb0db78e7360115 + // |reader| is for sending back ACK message. + void HandleMessage(const std::string& current_dir, + const std::vector<std::string>& argv, +-+ const std::vector<const uint8_t> additional_data, +++ const std::vector<uint8_t> additional_data, + SocketReader* reader); + + private: +@@ -79,7 +79,7 @@ index a04d139f958a7aaef9b96e8c29317ccf7c97f009..e77cebd31967d28f3cb0db78e7360115 + - const std::string& current_dir, const std::vector<std::string>& argv, + + const std::string& current_dir, + + const std::vector<std::string>& argv, +-+ const std::vector<const uint8_t> additional_data, +++ const std::vector<uint8_t> additional_data, + SocketReader* reader) { + DCHECK(ui_task_runner_->BelongsToCurrentThread()); + DCHECK(reader); +@@ -109,7 +109,7 @@ index a04d139f958a7aaef9b96e8c29317ccf7c97f009..e77cebd31967d28f3cb0db78e7360115 + + base::StringToSizeT(tokens[0], &num_args); + + std::vector<std::string> command_line(tokens.begin() + 1, tokens.begin() + 1 + num_args); + + +-+ std::vector<const uint8_t> additional_data; +++ std::vector<uint8_t> additional_data; + + if (tokens.size() >= 3 + num_args) { + + size_t additional_data_size; + + base::StringToSizeT(tokens[1 + num_args], &additional_data_size); +@@ -118,7 +118,7 @@ index a04d139f958a7aaef9b96e8c29317ccf7c97f009..e77cebd31967d28f3cb0db78e7360115 + + std::string(1, kTokenDelimiter)); + + const uint8_t* additional_data_bits = + + reinterpret_cast<const uint8_t*>(remaining_args.c_str()); +-+ additional_data = std::vector<const uint8_t>( +++ additional_data = std::vector<uint8_t>( + + additional_data_bits, additional_data_bits + additional_data_size); + + } + + +@@ -184,7 +184,7 @@ index 19d5659d665321da54e05cee01be7da02e0c283b..600ff701b025ba190d05bc30994e3d3e + base::CommandLine* parsed_command_line, + - base::FilePath* current_directory) { + + base::FilePath* current_directory, +-+ std::vector<const uint8_t>* parsed_additional_data) { +++ std::vector<uint8_t>* parsed_additional_data) { + // We should have enough room for the shortest command (min_message_size) + // and also be a multiple of wchar_t bytes. The shortest command + - // possible is L"START\0\0" (empty current directory and command line). +@@ -225,7 +225,7 @@ index 19d5659d665321da54e05cee01be7da02e0c283b..600ff701b025ba190d05bc30994e3d3e + + msg.substr(fourth_null + 1, fifth_null - fourth_null); + + const uint8_t* additional_data_bytes = + + reinterpret_cast<const uint8_t*>(additional_data.c_str()); +-+ *parsed_additional_data = std::vector<const uint8_t>(additional_data_bytes, +++ *parsed_additional_data = std::vector<uint8_t>(additional_data_bytes, + + additional_data_bytes + additional_data_length); + + + return true; +@@ -239,7 +239,7 @@ index 19d5659d665321da54e05cee01be7da02e0c283b..600ff701b025ba190d05bc30994e3d3e + base::CommandLine parsed_command_line(base::CommandLine::NO_PROGRAM); + base::FilePath current_directory; + - if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory)) { +-+ std::vector<const uint8_t> additional_data; +++ std::vector<uint8_t> additional_data; + + if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory, &additional_data)) { + *result = TRUE; + return true; +diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc +index 7328cedf9..9945a04b2 100644 +--- a/shell/browser/api/electron_api_app.cc ++++ b/shell/browser/api/electron_api_app.cc +@@ -517,10 +517,10 @@ bool NotificationCallbackWrapper( + const base::RepeatingCallback< + void(const base::CommandLine& command_line, + const base::FilePath& current_directory, +- const std::vector<const uint8_t> additional_data)>& callback, ++ const std::vector<uint8_t> additional_data)>& callback, + const base::CommandLine& cmd, + const base::FilePath& cwd, +- const std::vector<const uint8_t> additional_data) { ++ const std::vector<uint8_t> additional_data) { + // Make sure the callback is called after app gets ready. + if (Browser::Get()->is_ready()) { + callback.Run(cmd, cwd, std::move(additional_data)); +@@ -1081,7 +1081,7 @@ std::string App::GetLocaleCountryCode() { + + void App::OnSecondInstance(const base::CommandLine& cmd, + const base::FilePath& cwd, +- const std::vector<const uint8_t> additional_data) { ++ const std::vector<uint8_t> additional_data) { + v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); + v8::Locker locker(isolate); + v8::HandleScope handle_scope(isolate); +diff --git a/shell/browser/api/electron_api_app.h b/shell/browser/api/electron_api_app.h +index fd644ed95..838366041 100644 +--- a/shell/browser/api/electron_api_app.h ++++ b/shell/browser/api/electron_api_app.h +@@ -190,7 +190,7 @@ class App : public ElectronBrowserClient::Delegate, + std::string GetLocaleCountryCode(); + void OnSecondInstance(const base::CommandLine& cmd, + const base::FilePath& cwd, +- const std::vector<const uint8_t> additional_data); ++ const std::vector<uint8_t> additional_data); + bool HasSingleInstanceLock() const; + bool RequestSingleInstanceLock(gin::Arguments* args); + void ReleaseSingleInstanceLock(); Deleted: use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch =================================================================== --- use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch 2022-07-01 16:20:43 UTC (rev 1243213) +++ use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -1,72 +0,0 @@ -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); - } - Copied: electron17/repos/community-x86_64/use-FT_Done_MM_Var-in-CFX_Font-AdjustMMParams.patch (from rev 1243213, electron17/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-07-01 16:21:08 UTC (rev 1243214) @@ -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: use-system-libraries-in-node.patch =================================================================== --- use-system-libraries-in-node.patch 2022-07-01 16:20:43 UTC (rev 1243213) +++ use-system-libraries-in-node.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -1,53 +0,0 @@ ---- a/third_party/electron_node/BUILD.gn -+++ b/third_party/electron_node/BUILD.gn -@@ -42,6 +42,18 @@ - node_module_version = "" - } - -+if (is_linux) { -+ import("//build/config/linux/pkg_config.gni") -+ -+ pkg_config("cares") { -+ packages = [ "libcares" ] -+ } -+ -+ pkg_config("nghttp2") { -+ packages = [ "libnghttp2" ] -+ } -+} -+ - assert(!node_use_dtrace, "node_use_dtrace not supported in GN") - assert(!node_use_etw, "node_use_etw not supported in GN") - -@@ -182,11 +194,9 @@ - component("node_lib") { - deps = [ - ":node_js2c", -- "deps/cares", - "deps/histogram", - "deps/googletest:gtest", - "deps/llhttp", -- "deps/nghttp2", - "deps/uvwasi", - "//third_party/zlib", - "//third_party/brotli:dec", -@@ -202,6 +212,19 @@ - public_configs = [ ":node_lib_config" ] - include_dirs = [ "src" ] - libs = [] -+ if (is_linux) { -+ configs += [ -+ ":cares", -+ ":nghttp2", -+ ] -+ libs += [ "http_parser" ] -+ } else { -+ deps += [ -+ "deps/cares", -+ "deps/http_parser", -+ "deps/nghttp2", -+ ] -+ } - frameworks = [] - cflags_cc = [ - "-Wno-deprecated-declarations", Copied: electron17/repos/community-x86_64/use-system-libraries-in-node.patch (from rev 1243213, electron17/trunk/use-system-libraries-in-node.patch) =================================================================== --- use-system-libraries-in-node.patch (rev 0) +++ use-system-libraries-in-node.patch 2022-07-01 16:21:08 UTC (rev 1243214) @@ -0,0 +1,53 @@ +--- a/third_party/electron_node/BUILD.gn ++++ b/third_party/electron_node/BUILD.gn +@@ -42,6 +42,18 @@ + node_module_version = "" + } + ++if (is_linux) { ++ import("//build/config/linux/pkg_config.gni") ++ ++ pkg_config("cares") { ++ packages = [ "libcares" ] ++ } ++ ++ pkg_config("nghttp2") { ++ packages = [ "libnghttp2" ] ++ } ++} ++ + assert(!node_use_dtrace, "node_use_dtrace not supported in GN") + assert(!node_use_etw, "node_use_etw not supported in GN") + +@@ -182,11 +194,9 @@ + component("node_lib") { + deps = [ + ":node_js2c", +- "deps/cares", + "deps/histogram", + "deps/googletest:gtest", + "deps/llhttp", +- "deps/nghttp2", + "deps/uvwasi", + "//third_party/zlib", + "//third_party/brotli:dec", +@@ -202,6 +212,19 @@ + public_configs = [ ":node_lib_config" ] + include_dirs = [ "src" ] + libs = [] ++ if (is_linux) { ++ configs += [ ++ ":cares", ++ ":nghttp2", ++ ] ++ libs += [ "http_parser" ] ++ } else { ++ deps += [ ++ "deps/cares", ++ "deps/http_parser", ++ "deps/nghttp2", ++ ] ++ } + frameworks = [] + cflags_cc = [ + "-Wno-deprecated-declarations",