diff --git a/www/iridium/Makefile b/www/iridium/Makefile index 5721873952a6..d97ef304ab11 100644 --- a/www/iridium/Makefile +++ b/www/iridium/Makefile @@ -1,319 +1,319 @@ PORTNAME= iridium -PORTVERSION= 2022.04.100.0 -PORTREVISION= 6 +PORTVERSION= 2022.10.106 CATEGORIES= www wayland MASTER_SITES= https://downloads.iridiumbrowser.de/source/ PKGNAMESUFFIX= -browser DISTNAME= ${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION} MAINTAINER= chromium@FreeBSD.org COMMENT= Iridium browser WWW= https://iridiumbrowser.de/ LICENSE= BSD3CLAUSE LGPL21 MPL11 LICENSE_COMB= multi ONLY_FOR_ARCHS= aarch64 amd64 i386 +PATCH_SITES= https://raw.githubusercontent.com/ungoogled-software/ungoogled-chromium/master/patches/core/ungoogled-chromium/ +PATCHFILES+= disable-privacy-sandbox.patch:-p1 + BUILD_DEPENDS= bash:shells/bash \ ${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}ply>0:devel/py-ply@${PY_FLAVOR} \ gperf:devel/gperf \ flock:sysutils/flock \ node:www/node \ xcb-proto>0:x11/xcb-proto \ ${LOCALBASE}/include/linux/videodev2.h:multimedia/v4l_compat \ ${LOCALBASE}/share/usbids/usb.ids:misc/usbids \ ${PYTHON_PKGNAMEPREFIX}html5lib>0:www/py-html5lib@${PY_FLAVOR} \ ${LOCALBASE}/include/va/va.h:multimedia/libva \ ${LOCALBASE}/libdata/pkgconfig/dri.pc:graphics/mesa-dri LIB_DEPENDS= libatk-bridge-2.0.so:accessibility/at-spi2-atk \ libatspi.so:accessibility/at-spi2-core \ libspeechd.so:accessibility/speech-dispatcher \ libsnappy.so:archivers/snappy \ libFLAC.so:audio/flac \ libopus.so:audio/opus \ libspeex.so:audio/speex \ libdbus-1.so:devel/dbus \ libdbus-glib-1.so:devel/dbus-glib \ libevent.so:devel/libevent \ libicuuc.so:devel/icu \ libjsoncpp.so:devel/jsoncpp \ libpci.so:devel/libpci \ libnspr4.so:devel/nspr \ libre2.so:devel/re2 \ libcairo.so:graphics/cairo \ libdrm.so:graphics/libdrm \ libexif.so:graphics/libexif \ libpng.so:graphics/png \ libwebp.so:graphics/webp \ libopenh264.so:multimedia/openh264 \ libfreetype.so:print/freetype2 \ libharfbuzz.so:print/harfbuzz \ libharfbuzz-icu.so:print/harfbuzz-icu \ libgcrypt.so:security/libgcrypt \ libsecret-1.so:security/libsecret \ libnss3.so:security/nss \ libexpat.so:textproc/expat2 \ libfontconfig.so:x11-fonts/fontconfig \ libwayland-client.so:graphics/wayland \ libxkbcommon.so:x11/libxkbcommon \ libxshmfence.so:x11/libxshmfence RUN_DEPENDS= xdg-open:devel/xdg-utils \ noto-basic>0:x11-fonts/noto-basic -USES= bison compiler:c++17-lang cpe desktop-file-utils gl gnome jpeg localbase:ldflags \ - ninja perl5 pkgconfig python:3.7+,build shebangfix tar:xz xorg +USES= bison compiler:c++17-lang cpe desktop-file-utils gl gnome iconv jpeg \ + localbase:ldflags ninja perl5 pkgconfig python:3.7+,build shebangfix \ + tar:xz xorg CPE_VENDOR= google CPE_PRODUCT= chrome USE_GL= gbm gl USE_GNOME= atk dconf gdkpixbuf2 glib20 gtk30 libxml2 libxslt USE_LDCONFIG= ${DATADIR} USE_PERL5= build USE_XORG= x11 xcb xcomposite xcursor xext xdamage xfixes xi \ xorgproto xrandr xrender xscrnsaver xtst SHEBANG_FILES= chrome/tools/build/linux/chrome-wrapper buildtools/linux64/clang-format MAKE_ARGS= -C out/${BUILDTYPE} ALL_TARGET= chrome BINARY_ALIAS= python3=${PYTHON_CMD} # TODO bz@ : install libwidevinecdm.so (see third_party/widevine/cdm/BUILD.gn) # # Run "./out/${BUILDTYPE}/gn args out/${BUILDTYPE} --list" for all variables. # Some parts don't have use_system_* flag, and can be turned on/off by using # replace_gn_files.py script, some parts just turned on/off for target host # OS "target_os == is_bsd", like libusb, libpci. GN_ARGS+= clang_use_chrome_plugins=false \ + chrome_pgo_phase=0 \ enable_hangout_services_extension=true \ enable_js_type_check=false \ enable_nacl=false \ - enable_one_click_signin=true \ enable_remoting=false \ - enable_wmax_tokens=false \ fatal_linker_warnings=false \ + icu_use_data_file=false \ is_clang=true \ optimize_webui=true \ toolkit_views=true \ treat_warnings_as_errors=false \ use_allocator="none" \ use_allocator_shim=false \ use_aura=true \ use_custom_libcxx=false \ use_gnome_keyring=false \ use_lld=true \ use_sysroot=false \ use_system_freetype=false \ use_system_harfbuzz=true \ use_system_libjpeg=true \ + use_system_libwayland=true \ use_system_wayland_scanner=true \ use_udev=false \ extra_cxxflags="${CXXFLAGS}" \ extra_ldflags="${LDFLAGS}" # TODO: investigate building with these options: # use_system_minigbm GN_BOOTSTRAP_FLAGS= --no-clean --no-rebuild --skip-generate-buildfiles SUB_FILES= iridium-browser.desktop iridium SUB_LIST+= COMMENT="${COMMENT}" OPTIONS_DEFINE= CODECS CUPS DEBUG KERBEROS LTO OPTIONS_DEFAULT= CODECS CUPS KERBEROS SNDIO OPTIONS_EXCLUDE_aarch64=LTO OPTIONS_GROUP= AUDIO OPTIONS_GROUP_AUDIO= ALSA PULSEAUDIO SNDIO OPTIONS_RADIO= KERBEROS OPTIONS_RADIO_KERBEROS= HEIMDAL HEIMDAL_BASE MIT OPTIONS_SUB= yes CODECS_DESC= Compile and enable patented codecs like H.264 HEIMDAL_BASE_DESC= Heimdal Kerberos (base) HEIMDAL_DESC= Heimdal Kerberos (security/heimdal) MIT_DESC= MIT Kerberos (security/krb5) ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib ALSA_RUN_DEPENDS= ${LOCALBASE}/lib/alsa-lib/libasound_module_pcm_oss.so:audio/alsa-plugins \ alsa-lib>=1.1.1_1:audio/alsa-lib ALSA_VARS= GN_ARGS+=use_alsa=true ALSA_VARS_OFF= GN_ARGS+=use_alsa=false CODECS_VARS= GN_ARGS+=ffmpeg_branding="Chrome" \ GN_ARGS+=proprietary_codecs=true CODECS_VARS_OFF= GN_ARGS+=ffmpeg_branding="Chromium" \ GN_ARGS+=proprietary_codecs=false CUPS_LIB_DEPENDS= libcups.so:print/cups CUPS_VARS= GN_ARGS+=use_cups=true CUPS_VARS_OFF= GN_ARGS+=use_cups=false DEBUG_VARS= BUILDTYPE=Debug \ GN_ARGS+=is_debug=true \ GN_ARGS+=is_component_build=false \ GN_ARGS+=symbol_level=1 \ GN_BOOTSTRAP_FLAGS+=--debug \ WANTSPACE="21 GB" DEBUG_VARS_OFF= BUILDTYPE=Release \ GN_ARGS+=blink_symbol_level=0 \ GN_ARGS+=is_debug=false \ GN_ARGS+=is_official_build=true \ GN_ARGS+=symbol_level=0 \ WANTSPACE="14 GB" HEIMDAL_LIB_DEPENDS= libkrb.so.26:security/heimdal KERBEROS_VARS= GN_ARGS+=use_kerberos=true KERBEROS_VARS_OFF= GN_ARGS+=use_kerberos=false LTO_VARS= GN_ARGS+=use_thin_lto=true \ GN_ARGS+=thin_lto_enable_optimizations=true \ WANTSPACE="14 GB" LTO_VARS_OFF= GN_ARGS+=use_thin_lto=false MIT_LIB_DEPENDS= libkrb.so.3:security/krb5 PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio PULSEAUDIO_VARS= GN_ARGS+=use_pulseaudio=true PULSEAUDIO_VARS_OFF= GN_ARGS+=use_pulseaudio=false # With SNDIO=on we exclude audio_manager_linux from the build (see # media/audio/BUILD.gn) and use audio_manager_openbsd which does not # support falling back to ALSA or PulseAudio. SNDIO_PREVENTS= ALSA PULSEAUDIO SNDIO_LIB_DEPENDS= libsndio.so:audio/sndio SNDIO_VARS= GN_ARGS+=use_sndio=true SNDIO_VARS_OFF= GN_ARGS+=use_sndio=false .include .include .if ${PORT_OPTIONS:MHEIMDAL_BASE} && !exists(/usr/lib/libkrb5.so) IGNORE= you have selected HEIMDAL_BASE but do not have Heimdal installed in base .endif -.if ${COMPILER_VERSION} < 130 +.if ${COMPILER_VERSION} != 130 LLVM_DEFAULT= 13 BUILD_DEPENDS+= clang${LLVM_DEFAULT}:devel/llvm${LLVM_DEFAULT} BINARY_ALIAS+= cpp=${LOCALBASE}/bin/clang-cpp${LLVM_DEFAULT} \ cc=${LOCALBASE}/bin/clang${LLVM_DEFAULT} \ c++=${LOCALBASE}/bin/clang++${LLVM_DEFAULT} \ ar=${LOCALBASE}/bin/llvm-ar${LLVM_DEFAULT} \ nm=${LOCALBASE}/bin/llvm-nm${LLVM_DEFAULT} \ ld=${LOCALBASE}/bin/ld.lld${LLVM_DEFAULT} .else BINARY_ALIAS+= ar=/usr/bin/llvm-ar \ nm=/usr/bin/llvm-nm .endif # swiftshader/lib/{libEGL.so,libGLESv2.so} is x86 only .if ${ARCH} == aarch64 PLIST_SUB+= NOT_AARCH64="@comment " .else PLIST_SUB+= NOT_AARCH64="" .endif # Allow relocations against read-only segments (override lld default) LDFLAGS_i386= -Wl,-znotext # TODO: -isystem, would be just as ugly as this approach, but more reliably # build would fail without C_INCLUDE_PATH/CPLUS_INCLUDE_PATH env var set. MAKE_ENV+= C_INCLUDE_PATH=${LOCALBASE}/include \ CPLUS_INCLUDE_PATH=${LOCALBASE}/include pre-everything:: @${ECHO_MSG} @${ECHO_MSG} "To build Iridium, you should have around 2GB of memory" @${ECHO_MSG} "and around ${WANTSPACE} of free disk space." @${ECHO_MSG} pre-configure: # We used to remove bundled libraries to be sure that chromium uses # system libraries and not shipped ones. # cd ${WRKSRC} && ${PYTHON_CMD} \ #./build/linux/unbundle/remove_bundled_libraries.py [list of preserved] cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ${PYTHON_CMD} \ ./build/linux/unbundle/replace_gn_files.py --system-libraries \ - flac fontconfig freetype harfbuzz-ng libdrm libevent libpng \ + flac fontconfig freetype harfbuzz-ng icu libdrm libevent libpng \ libusb libwebp libxml libxslt openh264 opus snappy || ${FALSE} # Iridium uses an unreleased version of FFmpeg, so configure it .for brand in Chrome Chromium ${CP} -R \ ${WRKSRC}/third_party/ffmpeg/chromium/config/${brand}/linux/ \ ${WRKSRC}/third_party/ffmpeg/chromium/config/${brand}/freebsd .endfor do-configure: # GN generator bootstrapping and generating ninja files cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} CC=${CC} CXX=${CXX} LD=${CXX} \ READELF=${READELF} AR=${AR} NM=${NM} ${PYTHON_CMD} \ ./tools/gn/bootstrap/bootstrap.py ${GN_BOOTSTRAP_FLAGS} cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ./out/${BUILDTYPE}/gn \ gen --args='${GN_ARGS}' out/${BUILDTYPE} # Setup nodejs dependency @${MKDIR} ${WRKSRC}/third_party/node/freebsd/node-freebsd/bin ${LN} -sf ${LOCALBASE}/bin/node ${WRKSRC}/third_party/node/freebsd/node-freebsd/bin/node # Setup buildtools/freebsd @${MKDIR} ${WRKSRC}/buildtools/freebsd ${LN} -sf ${WRKSRC}/buildtools/linux64/clang-format ${WRKSRC}/buildtools/freebsd ${LN} -sf ${WRKSRC}/out/${BUILDTYPE}/gn ${WRKSRC}/buildtools/freebsd ${LN} -sf /usr/bin/strip ${WRKSRC}/buildtools/freebsd/strip do-install: @${MKDIR} ${STAGEDIR}${DATADIR} ${INSTALL_MAN} ${WRKSRC}/chrome/app/resources/manpage.1.in \ ${STAGEDIR}${MANPREFIX}/man/man1/iridium.1 @${SED} -i "" -e 's,\@\@PACKAGE\@\@,chromium,g;s,\@\@MENUNAME\@\@,Iridium Web Browser,g' \ ${STAGEDIR}${MANPREFIX}/man/man1/iridium.1 ${CP} ${WRKSRC}/chrome/app/theme/chromium/product_logo_22_mono.png ${WRKSRC}/chrome/app/theme/chromium/product_logo_22.png .for s in 22 24 48 64 128 256 @${MKDIR} ${STAGEDIR}${PREFIX}/share/icons/hicolor/${s}x${s}/apps ${INSTALL_DATA} ${WRKSRC}/chrome/app/theme/chromium/product_logo_${s}.png \ ${STAGEDIR}${PREFIX}/share/icons/hicolor/${s}x${s}/apps/iridium.png .endfor ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/*.png ${STAGEDIR}${DATADIR} ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/*.pak ${STAGEDIR}${DATADIR} .for d in protoc mksnapshot ${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/${d} ${STAGEDIR}${DATADIR} .endfor -.for d in icudtl.dat snapshot_blob.bin v8_context_snapshot.bin +.for d in snapshot_blob.bin v8_context_snapshot.bin ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/${d} ${STAGEDIR}${DATADIR} .endfor ${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/chrome \ ${STAGEDIR}${DATADIR}/iridium cd ${WRKSRC}/out/${BUILDTYPE} && \ ${COPYTREE_SHARE} "locales resources" ${STAGEDIR}${DATADIR} @${MKDIR} ${STAGEDIR}${DESKTOPDIR} ${INSTALL_DATA} ${WRKDIR}/iridium-browser.desktop \ ${STAGEDIR}${DESKTOPDIR} ${INSTALL_SCRIPT} ${WRKDIR}/iridium ${STAGEDIR}${PREFIX}/bin # ANGLE, EGL, Vk .for f in libEGL.so libGLESv2.so libVkICD_mock_icd.so ${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/${f} ${STAGEDIR}${DATADIR} .endfor ${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/libvulkan.so.1 \ ${STAGEDIR}${DATADIR}/libvulkan.so .if ${BUILDTYPE} == Debug ${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/libVkLayer_khronos_validation.so ${STAGEDIR}${DATADIR} .endif # SwiftShader .if ${ARCH} != aarch64 @${MKDIR} ${STAGEDIR}${DATADIR}/swiftshader ${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/libvk_swiftshader.so ${STAGEDIR}${DATADIR} -.for g in libEGL.so libGLESv2.so - ${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/swiftshader/${g} \ - ${STAGEDIR}${DATADIR}/swiftshader -.endfor .endif post-install-DEBUG-on: ${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/*.so \ ${STAGEDIR}${DATADIR} ${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/character_data_generator \ ${STAGEDIR}${DATADIR} .include diff --git a/www/iridium/distinfo b/www/iridium/distinfo index 4d2cc8c84a2b..2d60e811af31 100644 --- a/www/iridium/distinfo +++ b/www/iridium/distinfo @@ -1,3 +1,5 @@ -TIMESTAMP = 1648800090 -SHA256 (iridium-browser-2022.04.100.0.tar.xz) = 1a111c3ac3f50e81a3120a9936941682bb66bd5a5287d92a2ccf0158a0cf2b1e -SIZE (iridium-browser-2022.04.100.0.tar.xz) = 1323781188 +TIMESTAMP = 1664950159 +SHA256 (iridium-browser-2022.10.106.tar.xz) = ec141f4dad5b16ce8f8d30400673242932f2857d684fb67c956f10effedb1cfa +SIZE (iridium-browser-2022.10.106.tar.xz) = 1333488380 +SHA256 (disable-privacy-sandbox.patch) = 71196aab024da3db1c078e42599311e39f5e7760657461f07cc212bb17e0cd52 +SIZE (disable-privacy-sandbox.patch) = 4772 diff --git a/www/iridium/files/patch-BUILD.gn b/www/iridium/files/patch-BUILD.gn index b8f84eb80257..41a0ab1bfd11 100644 --- a/www/iridium/files/patch-BUILD.gn +++ b/www/iridium/files/patch-BUILD.gn @@ -1,72 +1,80 @@ ---- BUILD.gn.orig 2022-04-01 07:48:30 UTC +--- BUILD.gn.orig 2022-10-05 07:34:01 UTC +++ BUILD.gn @@ -53,7 +53,7 @@ declare_args() { root_extra_deps = [] } -if (is_official_build) { +if (is_official_build && !is_bsd) { # An official (maximally optimized!) component (optimized for build times) # build doesn't make sense and usually doesn't work. assert(!is_component_build) -@@ -452,7 +452,7 @@ group("gn_all") { +@@ -83,7 +83,6 @@ group("gn_all") { + "//codelabs", + "//components:components_unittests", + "//components/gwp_asan:gwp_asan_unittests", +- "//infra/orchestrator:orchestrator_all", + "//net:net_unittests", + "//sandbox:sandbox_unittests", + "//services:services_unittests", +@@ -441,7 +440,7 @@ group("gn_all") { ] } - if (is_linux || is_chromeos || is_android) { + if ((is_linux && !is_bsd) || is_chromeos || is_android) { deps += [ "//third_party/breakpad:breakpad_unittests", "//third_party/breakpad:core-2-minidump", -@@ -636,6 +636,15 @@ group("gn_all") { - } +@@ -642,6 +641,15 @@ group("gn_all") { + deps += [ "//gpu/tools/compositor_model_bench" ] } + if (is_bsd) { + deps -= [ + "//third_party/breakpad:dump_syms($host_toolchain)", + "//third_party/breakpad:microdump_stackwalk($host_toolchain)", + "//third_party/breakpad:minidump_dump($host_toolchain)", + "//third_party/breakpad:minidump_stackwalk($host_toolchain)", + ] + } + if (is_mac) { deps += [ "//third_party/breakpad:crash_inspector", -@@ -685,7 +694,7 @@ group("gn_all") { +@@ -690,7 +698,7 @@ group("gn_all") { host_os == "win") { deps += [ "//chrome/test/mini_installer:mini_installer_tests" ] } - } else if (!is_android && !is_ios && !is_fuchsia) { + } else if (!is_android && !is_ios && !is_fuchsia && !is_bsd) { deps += [ "//third_party/breakpad:symupload($host_toolchain)" ] } -@@ -1147,7 +1156,7 @@ if (!is_ios) { +@@ -1202,7 +1210,7 @@ if (!is_ios) { data_deps += [ "//content/web_test:web_test_common_mojom_js_data_deps" ] } - if (!is_win && !is_android) { + if (!is_win && !is_android && !is_bsd) { data_deps += [ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ] } -@@ -1156,7 +1165,7 @@ if (!is_ios) { +@@ -1211,7 +1219,7 @@ if (!is_ios) { data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ] } - if (is_linux || is_chromeos) { + if ((is_linux && !is_bsd) || is_chromeos) { data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ] } -@@ -1531,7 +1540,7 @@ group("chromium_builder_perf") { +@@ -1654,7 +1662,7 @@ group("chromium_builder_perf") { + data_deps += [ "//chrome/test:performance_browser_tests" ] + } - if (is_win) { - data_deps += [ "//chrome/installer/mini_installer:mini_installer" ] -- } else { -+ } else if (!is_bsd) { +- if (!is_win) { ++ if (!is_win && !is_bsd) { data_deps += [ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ] } diff --git a/www/iridium/files/patch-apps_ui_views_app__window__frame__view.cc b/www/iridium/files/patch-apps_ui_views_app__window__frame__view.cc index 0105a9cf775f..244858d6b195 100644 --- a/www/iridium/files/patch-apps_ui_views_app__window__frame__view.cc +++ b/www/iridium/files/patch-apps_ui_views_app__window__frame__view.cc @@ -1,11 +1,11 @@ ---- apps/ui/views/app_window_frame_view.cc.orig 2022-03-28 18:11:04 UTC +--- apps/ui/views/app_window_frame_view.cc.orig 2022-10-05 07:34:01 UTC +++ apps/ui/views/app_window_frame_view.cc -@@ -138,7 +138,7 @@ gfx::Rect AppWindowFrameView::GetWindowBoundsForClient +@@ -137,7 +137,7 @@ gfx::Rect AppWindowFrameView::GetWindowBoundsForClient gfx::Rect window_bounds = client_bounds; // TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is // complete. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) // Get the difference between the widget's client area bounds and window // bounds, and grow |window_bounds| by that amount. gfx::Insets native_frame_insets = diff --git a/www/iridium/files/patch-base_BUILD.gn b/www/iridium/files/patch-base_BUILD.gn index 4d25c3a44f39..ae3b1f61ce44 100644 --- a/www/iridium/files/patch-base_BUILD.gn +++ b/www/iridium/files/patch-base_BUILD.gn @@ -1,146 +1,164 @@ ---- base/BUILD.gn.orig 2022-04-01 07:48:30 UTC +--- base/BUILD.gn.orig 2022-10-05 07:34:01 UTC +++ base/BUILD.gn -@@ -999,7 +999,7 @@ mixed_component("base") { +@@ -162,7 +162,7 @@ buildflag_header("ios_cronet_buildflags") { + flags = [ "CRONET_BUILD=$is_cronet_build" ] + } + +-enable_message_pump_epoll = is_linux || is_chromeos || is_android ++enable_message_pump_epoll = (is_linux || is_chromeos || is_android) && !is_bsd + buildflag_header("message_pump_buildflags") { + header = "message_pump_buildflags.h" + header_dir = "base/message_loop" +@@ -1031,7 +1031,7 @@ mixed_component("base") { "timer/hi_res_timer_manager_posix.cc", ] - if (!is_nacl && !is_apple) { + if (!is_nacl && !is_apple && !is_bsd) { sources += [ - "cpu_affinity_posix.cc", - "cpu_affinity_posix.h", -@@ -1010,6 +1010,12 @@ mixed_component("base") { + "profiler/stack_copier_signal.cc", + "profiler/stack_copier_signal.h", +@@ -1040,6 +1040,12 @@ mixed_component("base") { "profiler/thread_delegate_posix.h", ] } + + if (is_bsd) { + sources += [ + "profiler/stack_sampler_posix.cc", + ] + } } if (is_win) { -@@ -1478,11 +1484,23 @@ mixed_component("base") { +@@ -1541,11 +1547,23 @@ mixed_component("base") { + # Needed for if using newer C++ library than sysroot, except if # building inside the cros_sdk environment - use host_toolchain as a # more robust check for this. - if (!use_sysroot && -- (is_android || ((is_linux || is_chromeos) && !is_chromecast)) && -+ (is_android || ((is_linux || is_chromeos) && !is_chromecast && !is_bsd)) && +- if (!use_sysroot && (is_android || is_chromeos || (is_linux && !is_castos)) && ++ if (!use_sysroot && (is_android || is_chromeos || (is_linux && !is_castos && !is_bsd)) && host_toolchain != "//build/toolchain/cros:host") { libs += [ "atomic" ] } + # *BSD needs libkvm + if (is_bsd) { + libs += [ "kvm" ] + } + + if (is_freebsd) { + libs += [ + "execinfo", + "util", + ] + } + if (use_allocator_shim) { sources += [ "allocator/allocator_shim.cc", -@@ -1506,7 +1524,7 @@ mixed_component("base") { +@@ -1573,7 +1591,7 @@ mixed_component("base") { ] configs += [ "//base/allocator:mac_no_default_new_delete_symbols" ] } - if (is_chromeos || is_linux) { + if (is_chromeos || (is_linux && !is_bsd)) { sources += [ "allocator/allocator_shim_override_cpp_symbols.h", "allocator/allocator_shim_override_glibc_weak_symbols.h", -@@ -1563,7 +1581,7 @@ mixed_component("base") { +@@ -1629,7 +1647,7 @@ mixed_component("base") { + # Allow more direct string conversions on platforms with native utf8 # strings - # TODO(crbug/1052397): Consider replacing is_ash with is_chromeos once lacros switches to target_os=chromeos -- if (is_apple || is_chromeos_ash || is_chromecast || is_fuchsia) { -+ if (is_apple || is_chromeos_ash || is_chromecast || is_fuchsia || is_bsd) { +- if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia) { ++ if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia || is_bsd) { defines += [ "SYSTEM_NATIVE_UTF8" ] } -@@ -2243,6 +2261,42 @@ mixed_component("base") { +@@ -2211,6 +2229,42 @@ mixed_component("base") { } } + if (is_bsd) { + sources -= [ -+ "files/file_path_watcher_linux.cc", ++ "files/file_path_watcher_inotify.cc", + "files/file_util_linux.cc", + "files/scoped_file_linux.cc", + "process/memory_linux.cc", + "process/process_linux.cc", + "system/sys_info_linux.cc", + "process/process_iterator_linux.cc", + "process/process_metrics_linux.cc", + "process/process_handle_linux.cc" + ] + sources += [ + "process/memory_stubs.cc", + "files/file_path_watcher_kqueue.cc", + "files/file_path_watcher_kqueue.h", + "files/file_path_watcher_bsd.cc", + ] + } + + if (is_openbsd) { + sources += [ + "process/process_handle_openbsd.cc", + "process/process_iterator_openbsd.cc", + "process/process_metrics_openbsd.cc", + "system/sys_info_openbsd.cc", + ] + } else if (is_freebsd) { + sources += [ + "process/process_handle_freebsd.cc", + "process/process_iterator_freebsd.cc", + "process/process_metrics_freebsd.cc", + "system/sys_info_freebsd.cc", + ] + } + # iOS if (is_ios) { sources -= [ -@@ -3495,7 +3549,7 @@ test("base_unittests") { +@@ -2310,7 +2364,7 @@ mixed_component("base") { + } + + if (dep_libevent) { +- deps += [ "//third_party/libevent" ] ++ public_deps += [ "//third_party/libevent" ] + } + + if (use_libevent) { +@@ -3545,7 +3599,7 @@ test("base_unittests") { } } - if (is_linux || is_chromeos) { + if ((is_linux || is_chromeos) && !is_bsd) { sources += [ "debug/proc_maps_linux_unittest.cc", "files/scoped_file_linux_unittest.cc", -@@ -3543,7 +3597,7 @@ test("base_unittests") { +@@ -3593,7 +3647,7 @@ test("base_unittests") { + "posix/file_descriptor_shuffle_unittest.cc", "posix/unix_domain_socket_unittest.cc", - "task/thread_pool/task_tracker_posix_unittest.cc", ] - if (!is_nacl && !is_apple) { + if (!is_nacl && !is_apple && !is_bsd) { sources += [ - "cpu_affinity_posix_unittest.cc", "profiler/stack_copier_signal_unittest.cc", -@@ -3555,7 +3609,7 @@ test("base_unittests") { + "profiler/thread_delegate_posix_unittest.cc", +@@ -3603,7 +3657,7 @@ test("base_unittests") { + # Allow more direct string conversions on platforms with native utf8 # strings - # TODO(crbug/1052397): Consider replacing is_ash with is_chromeos once lacros switches to target_os=chromeos -- if (is_apple || is_chromeos_ash || is_chromecast || is_fuchsia) { -+ if (is_apple || is_chromeos_ash || is_chromecast || is_fuchsia || is_bsd) { +- if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia) { ++ if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia || is_bsd) { defines += [ "SYSTEM_NATIVE_UTF8" ] } -@@ -3724,7 +3778,7 @@ test("base_unittests") { +@@ -3791,7 +3845,7 @@ test("base_unittests") { } } - if (is_fuchsia || is_linux || is_chromeos) { + if ((is_fuchsia || is_linux || is_chromeos) && !is_bsd) { sources += [ "debug/elf_reader_unittest.cc", "debug/test_elf_image_builder.cc", diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_address__space__randomization.h b/www/iridium/files/patch-base_allocator_partition__allocator_address__space__randomization.h index c222fc029502..bd62431db8a9 100644 --- a/www/iridium/files/patch-base_allocator_partition__allocator_address__space__randomization.h +++ b/www/iridium/files/patch-base_allocator_partition__allocator_address__space__randomization.h @@ -1,11 +1,20 @@ ---- base/allocator/partition_allocator/address_space_randomization.h.orig 2022-03-28 18:11:04 UTC +--- base/allocator/partition_allocator/address_space_randomization.h.orig 2022-10-05 07:34:01 UTC +++ base/allocator/partition_allocator/address_space_randomization.h @@ -38,7 +38,7 @@ AslrMask(uintptr_t bits) { #if defined(ARCH_CPU_64_BITS) - #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) + #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) && !defined(OS_BSD) // We shouldn't allocate system pages at all for sanitizer builds. However, // we do, and if random hint addresses interfere with address ranges +@@ -128,7 +128,7 @@ AslrMask(uintptr_t bits) { + return AslrAddress(0x20000000ULL); + } + +- #elif BUILDFLAG(IS_LINUX) ++ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + + // Linux on arm64 can use 39, 42, 48, or 52-bit user space, depending on + // page size and number of levels of translation pages used. We use diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_page__allocator.h b/www/iridium/files/patch-base_allocator_partition__allocator_page__allocator.h index a9fd643b0800..92e7ce5dca0a 100644 --- a/www/iridium/files/patch-base_allocator_partition__allocator_page__allocator.h +++ b/www/iridium/files/patch-base_allocator_partition__allocator_page__allocator.h @@ -1,11 +1,11 @@ ---- base/allocator/partition_allocator/page_allocator.h.orig 2022-03-28 18:11:04 UTC +--- base/allocator/partition_allocator/page_allocator.h.orig 2022-10-05 07:34:01 UTC +++ base/allocator/partition_allocator/page_allocator.h -@@ -194,7 +194,7 @@ BASE_EXPORT void DecommitAndZeroSystemPages(void* addr - // Whether decommitted memory is guaranteed to be zeroed when it is +@@ -206,7 +206,7 @@ void DecommitAndZeroSystemPages(void* address, size_t // recommitted. Do not assume that this will not change over time. - constexpr BASE_EXPORT bool DecommittedMemoryIsAlwaysZeroed() { + constexpr PA_COMPONENT_EXPORT( + PARTITION_ALLOC) bool DecommittedMemoryIsAlwaysZeroed() { -#if BUILDFLAG(IS_APPLE) +#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD) return false; #else return true; diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_page__allocator__constants.h b/www/iridium/files/patch-base_allocator_partition__allocator_page__allocator__constants.h new file mode 100644 index 000000000000..6b5bc2f5fecf --- /dev/null +++ b/www/iridium/files/patch-base_allocator_partition__allocator_page__allocator__constants.h @@ -0,0 +1,38 @@ +--- base/allocator/partition_allocator/page_allocator_constants.h.orig 2022-10-05 07:34:01 UTC ++++ base/allocator/partition_allocator/page_allocator_constants.h +@@ -25,7 +25,7 @@ + // elimination. + #define PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR __attribute__((const)) + +-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64) ++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64) + // This should work for all POSIX (if needed), but currently all other + // supported OS/architecture combinations use either hard-coded values + // (such as x86) or have means to determine these values without needing +@@ -81,7 +81,7 @@ PageAllocationGranularityShift() { + return 14; // 16kB + #elif BUILDFLAG(IS_APPLE) && defined(ARCH_CPU_64_BITS) + return static_cast(vm_page_shift); +-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64) ++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64) + // arm64 supports 4kb (shift = 12), 16kb (shift = 14), and 64kb (shift = 16) + // page sizes. Retrieve from or initialize cache. + size_t shift = page_characteristics.shift.load(std::memory_order_relaxed); +@@ -102,7 +102,7 @@ PageAllocationGranularity() { + // This is literally equivalent to |1 << PageAllocationGranularityShift()| + // below, but was separated out for IS_APPLE to avoid << on a non-constexpr. + return vm_page_size; +-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64) ++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64) + // arm64 supports 4kb, 16kb, and 64kb page sizes. Retrieve from or + // initialize cache. + size_t size = page_characteristics.size.load(std::memory_order_relaxed); +@@ -141,7 +141,7 @@ SystemPageShift() { + PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR PA_ALWAYS_INLINE size_t + SystemPageSize() { + #if (BUILDFLAG(IS_APPLE) && defined(ARCH_CPU_64_BITS)) || \ +- (BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64)) ++ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64)) + // This is literally equivalent to |1 << SystemPageShift()| below, but was + // separated out for 64-bit IS_APPLE and arm64 on Linux to avoid << on a + // non-constexpr. diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_page__allocator__internals__posix.h b/www/iridium/files/patch-base_allocator_partition__allocator_page__allocator__internals__posix.h index 59f1794594a5..7e2fb6dea88e 100644 --- a/www/iridium/files/patch-base_allocator_partition__allocator_page__allocator__internals__posix.h +++ b/www/iridium/files/patch-base_allocator_partition__allocator_page__allocator__internals__posix.h @@ -1,16 +1,16 @@ ---- base/allocator/partition_allocator/page_allocator_internals_posix.h.orig 2022-04-01 07:48:30 UTC +--- base/allocator/partition_allocator/page_allocator_internals_posix.h.orig 2022-10-05 07:34:01 UTC +++ base/allocator/partition_allocator/page_allocator_internals_posix.h -@@ -352,8 +352,12 @@ bool TryRecommitSystemPagesInternal( +@@ -347,8 +347,12 @@ bool TryRecommitSystemPagesInternal( void DiscardSystemPagesInternal(uintptr_t address, size_t length) { void* ptr = reinterpret_cast(address); -#if BUILDFLAG(IS_APPLE) +#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD) +#if BUILDFLAG(IS_BSD) + int ret = madvise(ptr, length, MADV_FREE); +#else int ret = madvise(ptr, length, MADV_FREE_REUSABLE); +#endif if (ret) { // MADV_FREE_REUSABLE sometimes fails, so fall back to MADV_DONTNEED. ret = madvise(ptr, length, MADV_DONTNEED); diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_partition__address__space.cc b/www/iridium/files/patch-base_allocator_partition__allocator_partition__address__space.cc new file mode 100644 index 000000000000..7a16a6f85476 --- /dev/null +++ b/www/iridium/files/patch-base_allocator_partition__allocator_partition__address__space.cc @@ -0,0 +1,11 @@ +--- base/allocator/partition_allocator/partition_address_space.cc.orig 2022-10-05 07:34:01 UTC ++++ base/allocator/partition_allocator/partition_address_space.cc +@@ -238,7 +238,7 @@ void PartitionAddressSpace::UninitConfigurablePoolForT + setup_.configurable_pool_ = 0; + } + +-#if BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64) ++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64) + + PageCharacteristics page_characteristics; + diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc.cc b/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc.cc index cafa2b6ed793..5ffea8d69797 100644 --- a/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc.cc +++ b/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc.cc @@ -1,15 +1,17 @@ ---- base/allocator/partition_allocator/partition_alloc.cc.orig 2022-03-28 18:11:04 UTC +--- base/allocator/partition_allocator/partition_alloc.cc.orig 2022-10-05 07:34:01 UTC +++ base/allocator/partition_allocator/partition_alloc.cc -@@ -56,7 +56,12 @@ void PartitionAllocGlobalInit(OomFunction on_out_of_me +@@ -63,8 +63,14 @@ void PartitionAllocGlobalInit(OomFunction on_out_of_me "maximum direct mapped allocation"); // Check that some of our zanier calculations worked out as expected. +#if defined(__i386__) && defined(OS_FREEBSD) + // alignof(std::max_align_t) is only 4 on FreeBSD/i386 -+ static_assert(kSmallestBucket >= kAlignment, "generic smallest bucket"); ++ static_assert(internal::kSmallestBucket >= internal::kAlignment, ++ "generic smallest bucket"); +#else - static_assert(kSmallestBucket == kAlignment, "generic smallest bucket"); + static_assert(internal::kSmallestBucket == internal::kAlignment, + "generic smallest bucket"); +#endif - static_assert(kMaxBucketed == 917504, "generic max bucketed"); + static_assert(internal::kMaxBucketed == 917504, "generic max bucketed"); STATIC_ASSERT_OR_PA_CHECK( - MaxSystemPagesPerRegularSlotSpan() <= 16, + internal::MaxSystemPagesPerRegularSlotSpan() <= 16, diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__base_rand__util__posix.cc b/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__base_rand__util__posix.cc new file mode 100644 index 000000000000..27caa9d573a3 --- /dev/null +++ b/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__base_rand__util__posix.cc @@ -0,0 +1,13 @@ +--- base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc.orig 2022-10-05 07:34:01 UTC ++++ base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc +@@ -86,6 +86,10 @@ void RandBytes(void* output, size_t output_length) { + if (getentropy(output, output_length) == 0) { + return; + } ++#elif BUILDFLAG(IS_BSD) ++ if (getentropy(output, output_length) == 0) { ++ return; ++ } + #endif + + // If the OS-specific mechanisms didn't work, fall through to reading from diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__base_threading_platform__thread__internal__posix.h b/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__base_threading_platform__thread__internal__posix.h new file mode 100644 index 000000000000..314a3557e860 --- /dev/null +++ b/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__base_threading_platform__thread__internal__posix.h @@ -0,0 +1,11 @@ +--- base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_internal_posix.h.orig 2022-10-05 07:34:01 UTC ++++ base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_internal_posix.h +@@ -10,7 +10,7 @@ + + namespace partition_alloc::internal::base::internal { + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) + // Current thread id is cached in thread local storage for performance reasons. + // In some rare cases it's important to invalidate that cache explicitly (e.g. + // after going through clone() syscall which does not call pthread_atfork() diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__base_threading_platform__thread__posix.cc b/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__base_threading_platform__thread__posix.cc new file mode 100644 index 000000000000..44ffb0c58ade --- /dev/null +++ b/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__base_threading_platform__thread__posix.cc @@ -0,0 +1,11 @@ +--- base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc.orig 2022-10-05 07:34:01 UTC ++++ base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc +@@ -17,7 +17,7 @@ + #include "base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_internal_posix.h" + #include "build/build_config.h" + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) + #include + #include + #endif diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__config.h b/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__config.h index 4a1da70acf5a..00bceb14ac93 100644 --- a/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__config.h +++ b/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__config.h @@ -1,20 +1,29 @@ ---- base/allocator/partition_allocator/partition_alloc_config.h.orig 2022-04-01 07:48:30 UTC +--- base/allocator/partition_allocator/partition_alloc_config.h.orig 2022-10-05 07:34:01 UTC +++ base/allocator/partition_allocator/partition_alloc_config.h -@@ -59,7 +59,7 @@ static_assert(sizeof(void*) != 8, ""); +@@ -76,7 +76,7 @@ static_assert(sizeof(void*) != 8, ""); // POSIX is not only UNIX, e.g. macOS and other OSes. We do use Linux-specific // features such as futex(2). -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD) #define PA_HAS_LINUX_KERNEL #endif -@@ -179,7 +179,7 @@ constexpr bool kUseLazyCommit = false; +@@ -195,7 +195,7 @@ constexpr bool kUseLazyCommit = false; // On these platforms, lock all the partitions before fork(), and unlock after. // This may be required on more platforms in the future. -#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #define PA_HAS_ATFORK_HANDLER #endif +@@ -235,7 +235,7 @@ constexpr bool kUseLazyCommit = false; + // + // Also enabled on ARM64 macOS, as the 16kiB pages on this platform lead to + // larger slot spans. +-#if BUILDFLAG(IS_LINUX) || (BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64)) ++#if BUILDFLAG(IS_LINUX) || (BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64)) || BUILDFLAG(IS_BSD) + #define PA_PREFER_SMALLER_SLOT_SPANS + #endif // BUILDFLAG(IS_LINUX) || (BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64)) + diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__constants.h b/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__constants.h new file mode 100644 index 000000000000..847dbd39091e --- /dev/null +++ b/www/iridium/files/patch-base_allocator_partition__allocator_partition__alloc__constants.h @@ -0,0 +1,20 @@ +--- base/allocator/partition_allocator/partition_alloc_constants.h.orig 2022-10-05 07:34:01 UTC ++++ base/allocator/partition_allocator/partition_alloc_constants.h +@@ -91,7 +91,7 @@ PartitionPageShift() { + return 18; // 256 KiB + } + #elif (BUILDFLAG(IS_APPLE) && defined(ARCH_CPU_64_BITS)) || \ +- (BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64)) ++ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64)) + PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR PA_ALWAYS_INLINE size_t + PartitionPageShift() { + return PageAllocationGranularityShift() + 2; +@@ -270,7 +270,7 @@ constexpr size_t kNumPools = 3; + // Special-case Android and iOS, which incur test failures with larger + // GigaCage. Regardless, allocating >8GiB with malloc() on these platforms is + // unrealistic as of 2022. +-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) ++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD) + constexpr size_t kPoolMaxSize = 8 * kGiB; + #else + constexpr size_t kPoolMaxSize = 16 * kGiB; diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_partition__page.h b/www/iridium/files/patch-base_allocator_partition__allocator_partition__page.h index d508f6fa4eec..3b248067a37d 100644 --- a/www/iridium/files/patch-base_allocator_partition__allocator_partition__page.h +++ b/www/iridium/files/patch-base_allocator_partition__allocator_partition__page.h @@ -1,22 +1,29 @@ ---- base/allocator/partition_allocator/partition_page.h.orig 2022-04-01 07:48:30 UTC +--- base/allocator/partition_allocator/partition_page.h.orig 2022-10-05 07:34:01 UTC +++ base/allocator/partition_allocator/partition_page.h -@@ -128,7 +128,8 @@ struct __attribute__((packed)) SlotSpanMetadata { +@@ -131,13 +131,14 @@ struct SlotSpanMetadata { PartitionBucket* const bucket = nullptr; // CHECK()ed in AllocNewSlotSpan(). -#if defined(PA_HAS_64_BITS_POINTERS) && BUILDFLAG(IS_APPLE) +#if (defined(PA_HAS_64_BITS_POINTERS) && BUILDFLAG(IS_APPLE)) || \ + (BUILDFLAG(IS_FREEBSD) && defined(__i386__)) // System page size is not a constant on Apple OSes, but is either 4 or 16kiB // (1 << 12 or 1 << 14), as checked in PartitionRoot::Init(). And // PartitionPageSize() is 4 times the OS page size. -@@ -142,7 +143,9 @@ struct __attribute__((packed)) SlotSpanMetadata { + static constexpr size_t kMaxSlotsPerSlotSpan = + 4 * (1 << 14) / kSmallestBucket; +-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64) ++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64) + // System page size can be 4, 16, or 64 kiB on Linux on arm64. 64 kiB is + // currently (kMaxSlotsPerSlotSpanBits == 13) not supported by the code, + // so we use the 16 kiB maximum (64 kiB will crash). +@@ -151,7 +152,9 @@ struct SlotSpanMetadata { #endif // defined(PA_HAS_64_BITS_POINTERS) && BUILDFLAG(IS_APPLE) // The maximum number of bits needed to cover all currently supported OSes. static constexpr size_t kMaxSlotsPerSlotSpanBits = 13; +#if !BUILDFLAG(IS_FREEBSD) && defined(__i386__) static_assert(kMaxSlotsPerSlotSpan < (1 << kMaxSlotsPerSlotSpanBits), ""); +#endif // |marked_full| isn't equivalent to being full. Slot span is marked as full // iff it isn't on the active slot span list (or any other list). diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_partition__root.cc b/www/iridium/files/patch-base_allocator_partition__allocator_partition__root.cc new file mode 100644 index 000000000000..96b13ce784d5 --- /dev/null +++ b/www/iridium/files/patch-base_allocator_partition__allocator_partition__root.cc @@ -0,0 +1,38 @@ +--- base/allocator/partition_allocator/partition_root.cc.orig 2022-10-05 07:34:01 UTC ++++ base/allocator/partition_allocator/partition_root.cc +@@ -33,7 +33,7 @@ + #include "wow64apiset.h" + #endif + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) + #include + #endif + +@@ -230,7 +230,7 @@ void PartitionAllocMallocInitOnce() { + if (!g_global_init_called.compare_exchange_strong(expected, true)) + return; + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) + // When fork() is called, only the current thread continues to execute in the + // child process. If the lock is held, but *not* by this thread when fork() is + // called, we have a deadlock. +@@ -321,7 +321,7 @@ static size_t PartitionPurgeSlotSpan( + constexpr size_t kMaxSlotCount = + (PartitionPageSize() * kMaxPartitionPagesPerRegularSlotSpan) / + MaxPurgeableSlotSize(); +-#elif BUILDFLAG(IS_APPLE) || (BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64)) ++#elif BUILDFLAG(IS_APPLE) || ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) && defined(ARCH_CPU_ARM64)) + // It's better for slot_usage to be stack-allocated and fixed-size, which + // demands that its size be constexpr. On IS_APPLE and Linux on arm64, + // PartitionPageSize() is always SystemPageSize() << 2, so regardless of +@@ -709,7 +709,7 @@ void PartitionRoot::Init(PartitionOptions + // apple OSes. + PA_CHECK((internal::SystemPageSize() == (size_t{1} << 12)) || + (internal::SystemPageSize() == (size_t{1} << 14))); +-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64) ++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64) + // Check runtime pagesize. Though the code is currently the same, it is + // not merged with the IS_APPLE case above as a 1 << 16 case needs to be + // added here in the future, to allow 64 kiB pagesize. That is only diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_partition__root.h b/www/iridium/files/patch-base_allocator_partition__allocator_partition__root.h deleted file mode 100644 index 7c08bb141fe9..000000000000 --- a/www/iridium/files/patch-base_allocator_partition__allocator_partition__root.h +++ /dev/null @@ -1,11 +0,0 @@ ---- base/allocator/partition_allocator/partition_root.h.orig 2022-04-01 07:48:30 UTC -+++ base/allocator/partition_allocator/partition_root.h -@@ -1071,7 +1071,7 @@ ALWAYS_INLINE void PartitionRoot::FreeNoH - // essentially). - #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && \ - ((BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMECAST)) || \ -- (BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_64_BITS))) -+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_64_BITS))) - PA_CHECK(IsManagedByPartitionAlloc(object_addr)); - #endif - diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_spinning__mutex.cc b/www/iridium/files/patch-base_allocator_partition__allocator_spinning__mutex.cc index f675fd1534c0..d5db4456a6fe 100644 --- a/www/iridium/files/patch-base_allocator_partition__allocator_spinning__mutex.cc +++ b/www/iridium/files/patch-base_allocator_partition__allocator_spinning__mutex.cc @@ -1,47 +1,47 @@ ---- base/allocator/partition_allocator/spinning_mutex.cc.orig 2022-03-28 18:11:04 UTC +--- base/allocator/partition_allocator/spinning_mutex.cc.orig 2022-10-05 07:34:01 UTC +++ base/allocator/partition_allocator/spinning_mutex.cc -@@ -17,7 +17,15 @@ +@@ -18,7 +18,15 @@ #if defined(PA_HAS_LINUX_KERNEL) #include +#if defined(OS_OPENBSD) +#include +#elif defined(OS_FREEBSD) +#include +#include +#include +#else #include +#endif #include #include #endif // defined(PA_HAS_LINUX_KERNEL) -@@ -85,8 +93,13 @@ void SpinningMutex::FutexWait() { +@@ -107,8 +115,13 @@ void SpinningMutex::FutexWait() { // |kLockedContended| anymore. Note that even without spurious wakeups, the // value of |state_| is not guaranteed when this returns, as another thread // may get the lock before we get to run. +#if defined(OS_FREEBSD) + int err = _umtx_op(&state_, UMTX_OP_WAIT_UINT_PRIVATE, + kLockedContended, nullptr, nullptr); +#else int err = syscall(SYS_futex, &state_, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, kLockedContended, nullptr, nullptr, 0); +#endif if (err) { // These are programming error, check them. -@@ -98,8 +111,14 @@ void SpinningMutex::FutexWait() { +@@ -120,8 +133,14 @@ void SpinningMutex::FutexWait() { void SpinningMutex::FutexWake() { int saved_errno = errno; +#if defined(OS_FREEBSD) + long retval = _umtx_op(&state_, UMTX_OP_WAKE_PRIVATE, + 1 /* wake up a single waiter */, nullptr, nullptr); +#else long retval = syscall(SYS_futex, &state_, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1 /* wake up a single waiter */, nullptr, nullptr, 0); +#endif + PA_CHECK(retval != -1); errno = saved_errno; } diff --git a/www/iridium/files/patch-base_allocator_partition__allocator_starscan_stack_stack.cc b/www/iridium/files/patch-base_allocator_partition__allocator_starscan_stack_stack.cc index 6868d146b140..7e8ee0d6a651 100644 --- a/www/iridium/files/patch-base_allocator_partition__allocator_starscan_stack_stack.cc +++ b/www/iridium/files/patch-base_allocator_partition__allocator_starscan_stack_stack.cc @@ -1,50 +1,50 @@ ---- base/allocator/partition_allocator/starscan/stack/stack.cc.orig 2022-03-28 18:11:04 UTC +--- base/allocator/partition_allocator/starscan/stack/stack.cc.orig 2022-10-05 07:34:01 UTC +++ base/allocator/partition_allocator/starscan/stack/stack.cc @@ -17,6 +17,10 @@ #include #endif +#if defined(OS_BSD) +#include +#endif + #if defined(LIBC_GLIBC) extern "C" void* __libc_stack_end; #endif -@@ -48,6 +52,36 @@ void* GetStackTop() { +@@ -47,6 +51,36 @@ void* GetStackTop() { void* GetStackTop() { return pthread_get_stackaddr_np(pthread_self()); +} + +#elif defined(OS_OPENBSD) + +void* GetStackTop() { + stack_t ss; + if (pthread_stackseg_np(pthread_self(), &ss) != 0) + return nullptr; + return reinterpret_cast(ss.ss_sp); +} + +#elif defined(OS_FREEBSD) + +void* GetStackTop() { + pthread_attr_t attr; + int error = pthread_attr_init(&attr); + if (error) { + return nullptr; + } + error = pthread_attr_get_np(pthread_self(), &attr); + if (!error) { + void* base; + size_t size; + error = pthread_attr_getstack(&attr, &base, &size); + PA_CHECK(!error); + pthread_attr_destroy(&attr); + return reinterpret_cast(base) + size; + } + pthread_attr_destroy(&attr); + return nullptr; } #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) diff --git a/www/iridium/files/patch-base_atomicops.h b/www/iridium/files/patch-base_atomicops.h index 5796114dc6eb..77c162f67733 100644 --- a/www/iridium/files/patch-base_atomicops.h +++ b/www/iridium/files/patch-base_atomicops.h @@ -1,14 +1,14 @@ ---- base/atomicops.h.orig 2022-03-28 18:11:04 UTC +--- base/atomicops.h.orig 2022-10-05 07:34:01 UTC +++ base/atomicops.h -@@ -57,7 +57,11 @@ typedef intptr_t Atomic64; +@@ -56,7 +56,11 @@ typedef intptr_t Atomic64; // Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or // Atomic64 routines below, depending on your architecture. +#if !defined(OS_OPENBSD) && defined(__i386__) +typedef Atomic32 AtomicWord; +#else typedef intptr_t AtomicWord; +#endif // Atomically execute: // result = *ptr; diff --git a/www/iridium/files/patch-base_base__paths__posix.cc b/www/iridium/files/patch-base_base__paths__posix.cc index 987a604ae0ae..afa431009616 100644 --- a/www/iridium/files/patch-base_base__paths__posix.cc +++ b/www/iridium/files/patch-base_base__paths__posix.cc @@ -1,98 +1,98 @@ ---- base/base_paths_posix.cc.orig 2022-03-28 18:11:04 UTC +--- base/base_paths_posix.cc.orig 2022-10-05 07:34:01 UTC +++ base/base_paths_posix.cc @@ -15,6 +15,7 @@ #include #include +#include "base/command_line.h" #include "base/environment.h" #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -25,9 +26,13 @@ #include "base/process/process_metrics.h" #include "build/build_config.h" -#if BUILDFLAG(IS_FREEBSD) +#if BUILDFLAG(IS_BSD) #include #include +#if BUILDFLAG(IS_OPENBSD) +#include +#define MAXTOKENS 2 +#endif #elif BUILDFLAG(IS_SOLARIS) || BUILDFLAG(IS_AIX) #include #endif @@ -68,13 +73,65 @@ bool PathProviderPosix(int key, FilePath* result) { *result = FilePath(bin_dir); return true; #elif BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_AIX) - // There is currently no way to get the executable path on OpenBSD - char* cpath; - if ((cpath = getenv("CHROME_EXE_PATH")) != NULL) - *result = FilePath(cpath); - else - *result = FilePath("/usr/local/chrome/chrome"); - return true; + char *cpath; +#if !BUILDFLAG(IS_AIX) + struct kinfo_file *files; + kvm_t *kd = NULL; + char errbuf[_POSIX2_LINE_MAX]; + static char retval[PATH_MAX]; + int cnt; + struct stat sb; + pid_t cpid = getpid(); + bool ret = false; + + const base::CommandLine* command_line = + base::CommandLine::ForCurrentProcess(); + + VLOG(1) << "PathProviderPosix argv: " << command_line->argv()[0]; + + if (realpath(command_line->argv()[0].c_str(), retval) == NULL) + goto out; + + if (stat(command_line->argv()[0].c_str(), &sb) < 0) + goto out; + + if (!command_line->HasSwitch("no-sandbox")) { + ret = true; + *result = FilePath(retval); + VLOG(1) << "PathProviderPosix (sandbox) result: " << retval; + goto out; + } + + if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL) + goto out; + + if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, cpid, + sizeof(struct kinfo_file), &cnt)) == NULL) + goto out; + + for (int i = 0; i < cnt; i++) { + if (files[i].fd_fd == KERN_FILE_TEXT && + files[i].va_fsid == static_cast(sb.st_dev) && + files[i].va_fileid == sb.st_ino) { + ret = true; + *result = FilePath(retval); + VLOG(1) << "PathProviderPosix result: " << retval; + } + } +out: + if (kd) + kvm_close(kd); + if (!ret) { +#endif -+ if ((cpath = getenv("IRIDIUM_EXE_PATH")) != NULL) ++ if ((cpath = getenv("CHROME_EXE_PATH")) != NULL) + *result = FilePath(cpath); + else -+ *result = FilePath("/usr/local/iridium/iridium"); ++ *result = FilePath("/usr/local/chrome/chrome"); + return true; +#if !BUILDFLAG(IS_AIX) + } + return ret; +#endif #endif } case DIR_SRC_TEST_DATA_ROOT: { diff --git a/www/iridium/files/patch-base_base__switches.cc b/www/iridium/files/patch-base_base__switches.cc index 0a4df69fd3ee..a1d655c5e642 100644 --- a/www/iridium/files/patch-base_base__switches.cc +++ b/www/iridium/files/patch-base_base__switches.cc @@ -1,11 +1,11 @@ ---- base/base_switches.cc.orig 2022-03-28 18:11:04 UTC +--- base/base_switches.cc.orig 2022-10-05 07:34:01 UTC +++ base/base_switches.cc @@ -170,7 +170,7 @@ const char kForceFieldTrialParams[] = "force-fieldtria #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) - // Controls whether or not retired instruction counts are surfaced for threads - // in trace events on Linux. - // + // TODO(crbug.com/1176772): Remove kEnableCrashpad and IsCrashpadEnabled() when + // Crashpad is fully enabled on Linux. Indicates that Crashpad should be + // enabled. diff --git a/www/iridium/files/patch-base_base__switches.h b/www/iridium/files/patch-base_base__switches.h index 6852515855b3..044813bf69bc 100644 --- a/www/iridium/files/patch-base_base__switches.h +++ b/www/iridium/files/patch-base_base__switches.h @@ -1,11 +1,11 @@ ---- base/base_switches.h.orig 2022-03-28 18:11:04 UTC +--- base/base_switches.h.orig 2022-10-05 07:34:01 UTC +++ base/base_switches.h @@ -60,7 +60,7 @@ extern const char kEnableIdleTracing[]; extern const char kForceFieldTrialParams[]; #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) - extern const char kEnableThreadInstructionCount[]; - // TODO(crbug.com/1176772): Remove kEnableCrashpad and IsCrashpadEnabled() when + // Crashpad is fully enabled on Linux. + extern const char kEnableCrashpad[]; diff --git a/www/iridium/files/patch-base_debug_debugger__posix.cc b/www/iridium/files/patch-base_debug_debugger__posix.cc index 0bbf28da9814..76478dfc3fd1 100644 --- a/www/iridium/files/patch-base_debug_debugger__posix.cc +++ b/www/iridium/files/patch-base_debug_debugger__posix.cc @@ -1,68 +1,68 @@ ---- base/debug/debugger_posix.cc.orig 2022-03-28 18:11:04 UTC +--- base/debug/debugger_posix.cc.orig 2022-10-05 07:34:01 UTC +++ base/debug/debugger_posix.cc -@@ -36,6 +36,10 @@ +@@ -35,6 +35,10 @@ #include #endif +#if BUILDFLAG(IS_OPENBSD) +#include +#endif + #if BUILDFLAG(IS_FREEBSD) #include #endif -@@ -96,32 +100,51 @@ bool BeingDebugged() { +@@ -95,32 +99,51 @@ bool BeingDebugged() { // Caution: struct kinfo_proc is marked __APPLE_API_UNSTABLE. The source and // binary interfaces may change. +#if BUILDFLAG(IS_OPENBSD) + struct kinfo_proc *info; + size_t info_size; +#else struct kinfo_proc info; size_t info_size = sizeof(info); +#endif #if BUILDFLAG(IS_OPENBSD) - if (sysctl(mib, base::size(mib), NULL, &info_size, NULL, 0) < 0) + if (sysctl(mib, std::size(mib), NULL, &info_size, NULL, 0) < 0) return -1; mib[5] = (info_size / sizeof(struct kinfo_proc)); + if ((info = reinterpret_cast(malloc(info_size))) == NULL) { + is_set = true; + being_debugged = false; + return being_debugged; + } + -+ int sysctl_result = sysctl(mib, base::size(mib), info, &info_size, NULL, 0); ++ int sysctl_result = sysctl(mib, std::size(mib), info, &info_size, NULL, 0); #endif +#if !BUILDFLAG(IS_OPENBSD) - int sysctl_result = sysctl(mib, base::size(mib), &info, &info_size, NULL, 0); + int sysctl_result = sysctl(mib, std::size(mib), &info, &info_size, NULL, 0); +#endif DCHECK_EQ(sysctl_result, 0); if (sysctl_result != 0) { is_set = true; being_debugged = false; - return being_debugged; + goto out; } // This process is being debugged if the P_TRACED flag is set. is_set = true; #if BUILDFLAG(IS_FREEBSD) being_debugged = (info.ki_flag & P_TRACED) != 0; -#elif BUILDFLAG(IS_BSD) - being_debugged = (info.p_flag & P_TRACED) != 0; +#elif BUILDFLAG(IS_OPENBSD) + being_debugged = (info->p_psflags & PS_TRACED) != 0; #else being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0; +#endif + +out: +#if BUILDFLAG(IS_OPENBSD) + free(info); #endif return being_debugged; } diff --git a/www/iridium/files/patch-base_debug_elf__reader.cc b/www/iridium/files/patch-base_debug_elf__reader.cc index 7f943f061d64..5c597a968c16 100644 --- a/www/iridium/files/patch-base_debug_elf__reader.cc +++ b/www/iridium/files/patch-base_debug_elf__reader.cc @@ -1,18 +1,18 @@ ---- base/debug/elf_reader.cc.orig 2022-03-28 18:11:04 UTC +--- base/debug/elf_reader.cc.orig 2022-10-05 07:34:01 UTC +++ base/debug/elf_reader.cc -@@ -76,6 +76,7 @@ size_t ReadElfBuildId(const void* elf_mapped_base, +@@ -78,6 +78,7 @@ size_t ReadElfBuildId(const void* elf_mapped_base, bool found = false; while (current_section < section_end) { current_note = reinterpret_cast(current_section); +#if !defined(OS_BSD) if (current_note->n_type == NT_GNU_BUILD_ID) { StringPiece note_name(current_section + sizeof(Nhdr), current_note->n_namesz); -@@ -85,6 +86,7 @@ size_t ReadElfBuildId(const void* elf_mapped_base, +@@ -87,6 +88,7 @@ size_t ReadElfBuildId(const void* elf_mapped_base, break; } } +#endif - size_t section_size = bits::AlignUp(current_note->n_namesz, 4) + - bits::AlignUp(current_note->n_descsz, 4) + + size_t section_size = bits::AlignUp(current_note->n_namesz, 4u) + + bits::AlignUp(current_note->n_descsz, 4u) + diff --git a/www/iridium/files/patch-base_debug_stack__trace__posix.cc b/www/iridium/files/patch-base_debug_stack__trace__posix.cc index fa26b7473e45..a4b5269bca67 100644 --- a/www/iridium/files/patch-base_debug_stack__trace__posix.cc +++ b/www/iridium/files/patch-base_debug_stack__trace__posix.cc @@ -1,38 +1,38 @@ ---- base/debug/stack_trace_posix.cc.orig 2022-04-01 07:48:30 UTC +--- base/debug/stack_trace_posix.cc.orig 2022-10-05 07:34:01 UTC +++ base/debug/stack_trace_posix.cc -@@ -38,7 +38,7 @@ +@@ -39,7 +39,7 @@ #include #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "base/debug/proc_maps_linux.h" #endif -@@ -695,6 +695,9 @@ class SandboxSymbolizeHelper { +@@ -698,6 +698,9 @@ class SandboxSymbolizeHelper { // for the modules that are loaded in the current process. // Returns true on success. bool CacheMemoryRegions() { +#if BUILDFLAG(IS_BSD) + return false; +#else // Reads /proc/self/maps. std::string contents; if (!ReadProcMaps(&contents)) { -@@ -712,6 +715,7 @@ class SandboxSymbolizeHelper { +@@ -715,6 +718,7 @@ class SandboxSymbolizeHelper { is_initialized_ = true; return true; +#endif } // Opens all object files and caches their file descriptors. -@@ -868,7 +872,7 @@ size_t CollectStackTrace(void** trace, size_t count) { +@@ -871,7 +875,7 @@ size_t CollectStackTrace(void** trace, size_t count) { // If we do not have unwind tables, then try tracing using frame pointers. return base::debug::TraceStackFramePointers(const_cast(trace), count, 0); -#elif !defined(__UCLIBC__) && !defined(_AIX) +#elif !defined(__UCLIBC__) && !defined(_AIX) && !BUILDFLAG(IS_BSD) // Though the backtrace API man page does not list any possible negative // return values, we take no chance. - return base::saturated_cast(backtrace(trace, count)); + return base::saturated_cast( diff --git a/www/iridium/files/patch-base_files_dir__reader__linux.h b/www/iridium/files/patch-base_files_dir__reader__linux.h new file mode 100644 index 000000000000..e119fcf240de --- /dev/null +++ b/www/iridium/files/patch-base_files_dir__reader__linux.h @@ -0,0 +1,39 @@ +--- base/files/dir_reader_linux.h.orig 2022-10-05 07:34:01 UTC ++++ base/files/dir_reader_linux.h +@@ -16,10 +16,16 @@ + #include "base/logging.h" + #include "base/posix/eintr_wrapper.h" + ++#include "build/build_config.h" ++ + // See the comments in dir_reader_posix.h about this. + + namespace base { + ++#if BUILDFLAG(IS_BSD) ++#include ++typedef struct dirent linux_dirent; ++#else + struct linux_dirent { + uint64_t d_ino; + int64_t d_off; +@@ -27,6 +33,7 @@ struct linux_dirent { + unsigned char d_type; + char d_name[0]; + }; ++#endif + + class DirReaderLinux { + public: +@@ -61,7 +68,11 @@ class DirReaderLinux { + if (offset_ != size_) + return true; + ++#if BUILDFLAG(IS_BSD) ++ const int r = getdents(fd_, reinterpret_cast(buf_), sizeof(buf_)); ++#else + const long r = syscall(__NR_getdents64, fd_, buf_, sizeof(buf_)); ++#endif + if (r == 0) + return false; + if (r < 0) { diff --git a/www/iridium/files/patch-base_files_dir__reader__posix.h b/www/iridium/files/patch-base_files_dir__reader__posix.h new file mode 100644 index 000000000000..ade769e0df79 --- /dev/null +++ b/www/iridium/files/patch-base_files_dir__reader__posix.h @@ -0,0 +1,20 @@ +--- base/files/dir_reader_posix.h.orig 2022-10-05 07:34:01 UTC ++++ base/files/dir_reader_posix.h +@@ -17,7 +17,7 @@ + // seems worse than falling back to enumerating all file descriptors so we will + // probably never implement this on the Mac. + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD) + #include "base/files/dir_reader_linux.h" + #else + #include "base/files/dir_reader_fallback.h" +@@ -25,7 +25,7 @@ + + namespace base { + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD) + typedef DirReaderLinux DirReaderPosix; + #else + typedef DirReaderFallback DirReaderPosix; diff --git a/www/iridium/files/patch-base_files_file__path__watcher__unittest.cc b/www/iridium/files/patch-base_files_file__path__watcher__unittest.cc index dab339e36609..ffb671dbc74b 100644 --- a/www/iridium/files/patch-base_files_file__path__watcher__unittest.cc +++ b/www/iridium/files/patch-base_files_file__path__watcher__unittest.cc @@ -1,29 +1,29 @@ ---- base/files/file_path_watcher_unittest.cc.orig 2022-03-28 18:11:04 UTC +--- base/files/file_path_watcher_unittest.cc.orig 2022-10-05 07:34:01 UTC +++ base/files/file_path_watcher_unittest.cc -@@ -450,7 +450,7 @@ TEST_F(FilePathWatcherTest, WatchDirectory) { +@@ -498,7 +498,7 @@ TEST_F(FilePathWatcherTest, MAYBE_WatchDirectory) { VLOG(1) << "Waiting for file1 creation"; ASSERT_TRUE(WaitForEvents()); -#if !BUILDFLAG(IS_APPLE) +#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD) // Mac implementation does not detect files modified in a directory. ASSERT_TRUE(WriteFile(file1, "content v2")); VLOG(1) << "Waiting for file1 modification"; -@@ -1038,7 +1038,7 @@ enum Permission { +@@ -1118,7 +1118,7 @@ enum Permission { Execute }; -#if BUILDFLAG(IS_APPLE) +#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD) bool ChangeFilePermissions(const FilePath& path, Permission perm, bool allow) { struct stat stat_buf; -@@ -1069,7 +1069,7 @@ bool ChangeFilePermissions(const FilePath& path, Permi +@@ -1149,7 +1149,7 @@ bool ChangeFilePermissions(const FilePath& path, Permi } #endif // BUILDFLAG(IS_APPLE) -#if BUILDFLAG(IS_APPLE) +#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD) // Linux implementation of FilePathWatcher doesn't catch attribute changes. // http://crbug.com/78043 // Windows implementation of FilePathWatcher catches attribute changes that diff --git a/www/iridium/files/patch-base_files_file__util__posix.cc b/www/iridium/files/patch-base_files_file__util__posix.cc index aeefc0cf196d..45679a464d08 100644 --- a/www/iridium/files/patch-base_files_file__util__posix.cc +++ b/www/iridium/files/patch-base_files_file__util__posix.cc @@ -1,52 +1,52 @@ ---- base/files/file_util_posix.cc.orig 2022-03-28 18:11:04 UTC +--- base/files/file_util_posix.cc.orig 2022-10-05 07:34:01 UTC +++ base/files/file_util_posix.cc -@@ -694,32 +694,34 @@ bool CreateDirectoryAndGetError(const FilePath& full_p +@@ -700,32 +700,34 @@ bool CreateDirectoryAndGetError(const FilePath& full_p File::Error* error) { ScopedBlockingCall scoped_blocking_call( FROM_HERE, BlockingType::MAY_BLOCK); // For call to mkdir(). + const FilePath kFileSystemRoot("/"); std::vector subpaths; // Collect a list of all parent directories. FilePath last_path = full_path; - subpaths.push_back(full_path); + if (full_path != kFileSystemRoot) + subpaths.push_back(full_path); for (FilePath path = full_path.DirName(); - path.value() != last_path.value(); path = path.DirName()) { + (path.value() != last_path.value() && + (path != kFileSystemRoot)); path = path.DirName()) { subpaths.push_back(path); last_path = path; } // Iterate through the parents and create the missing ones. - for (auto i = subpaths.rbegin(); i != subpaths.rend(); ++i) { -- if (DirectoryExists(*i)) + for (const FilePath& subpath : base::Reversed(subpaths)) { +- if (DirectoryExists(subpath)) - continue; -- if (mkdir(i->value().c_str(), 0700) == 0) +- if (mkdir(subpath.value().c_str(), 0700) == 0) - continue; - // Mkdir failed, but it might have failed with EEXIST, or some other error - // due to the directory appearing out of thin air. This can occur if - // two processes are trying to create the same file system tree at the same - // time. Check to see if it exists and make sure it is a directory. - int saved_errno = errno; -- if (!DirectoryExists(*i)) { +- if (!DirectoryExists(subpath)) { - if (error) - *error = File::OSErrorToFileError(saved_errno); - return false; -+ if (!PathExists(*i)) { -+ if ((mkdir(i->value().c_str(), 0700) == -1) && -+ ((full_path != *i) ? (errno != ENOENT) : (-1))) { ++ if (!PathExists(subpath)) { ++ if ((mkdir(subpath.value().c_str(), 0700) == -1) && ++ ((full_path != subpath) ? (errno != ENOENT) : (-1))) { + int saved_errno = errno; + if (error) + *error = File::OSErrorToFileError(saved_errno); + return false; + } -+ } else if (!DirectoryExists(*i)) { ++ } else if (!DirectoryExists(subpath)) { + if (error) + *error = File::OSErrorToFileError(ENOTDIR); + return false; } } return true; diff --git a/www/iridium/files/patch-base_files_file__util__unittest.cc b/www/iridium/files/patch-base_files_file__util__unittest.cc index 2bd4cf512707..68bd0ae78688 100644 --- a/www/iridium/files/patch-base_files_file__util__unittest.cc +++ b/www/iridium/files/patch-base_files_file__util__unittest.cc @@ -1,20 +1,20 @@ ---- base/files/file_util_unittest.cc.orig 2022-03-28 18:11:04 UTC +--- base/files/file_util_unittest.cc.orig 2022-10-05 07:34:01 UTC +++ base/files/file_util_unittest.cc -@@ -3524,7 +3524,7 @@ TEST_F(FileUtilTest, ReadFileToStringWithNamedPipe) { +@@ -3522,7 +3522,7 @@ TEST_F(FileUtilTest, ReadFileToStringWithNamedPipe) { } #endif // BUILDFLAG(IS_WIN) -#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) +#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD) TEST_F(FileUtilTest, ReadFileToStringWithProcFileSystem) { FilePath file_path("/proc/cpuinfo"); std::string data = "temp"; -@@ -4240,7 +4240,7 @@ TEST(FileUtilMultiThreadedTest, MultiThreadedTempFiles +@@ -4245,7 +4245,7 @@ TEST(FileUtilMultiThreadedTest, MultiThreadedTempFiles NULL); #else size_t bytes_written = - ::write(::fileno(output_file.get()), content.c_str(), content.length()); + ::write(fileno(output_file.get()), content.c_str(), content.length()); #endif EXPECT_EQ(content.length(), bytes_written); ::fflush(output_file.get()); diff --git a/www/iridium/files/patch-base_i18n_icu__util.cc b/www/iridium/files/patch-base_i18n_icu__util.cc index 536e41c3e974..e3900550db39 100644 --- a/www/iridium/files/patch-base_i18n_icu__util.cc +++ b/www/iridium/files/patch-base_i18n_icu__util.cc @@ -1,20 +1,20 @@ ---- base/i18n/icu_util.cc.orig 2022-03-28 18:11:04 UTC +--- base/i18n/icu_util.cc.orig 2022-10-05 07:34:01 UTC +++ base/i18n/icu_util.cc -@@ -52,7 +52,7 @@ +@@ -53,7 +53,7 @@ + #include "third_party/icu/source/common/unicode/unistr.h" #endif - #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \ -- ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \ -+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \ - !BUILDFLAG(IS_CHROMECAST)) +-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \ ++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) || \ + BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) #include "third_party/icu/source/i18n/unicode/timezone.h" #endif -@@ -346,7 +346,7 @@ void InitializeIcuTimeZone() { +@@ -325,7 +325,7 @@ void InitializeIcuTimeZone() { FuchsiaIntlProfileWatcher::GetPrimaryTimeZoneIdForIcuInitialization(); icu::TimeZone::adoptDefault( icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(zone_id))); --#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \ -+#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \ - !BUILDFLAG(IS_CHROMECAST) +-#elif BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) ++#elif BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || BUILDFLAG(IS_BSD) // To respond to the time zone change properly, the default time zone // cache in ICU has to be populated on starting up. + // See TimeZoneMonitorLinux::NotifyClientsFromImpl(). diff --git a/www/iridium/files/patch-base_linux__util.cc b/www/iridium/files/patch-base_linux__util.cc index ffc58a7c8655..a0b489c99eab 100644 --- a/www/iridium/files/patch-base_linux__util.cc +++ b/www/iridium/files/patch-base_linux__util.cc @@ -1,28 +1,28 @@ ---- base/linux_util.cc.orig 2022-03-28 18:11:04 UTC +--- base/linux_util.cc.orig 2022-10-05 07:34:01 UTC +++ base/linux_util.cc @@ -15,6 +15,7 @@ #include #include +#include + #include "base/base_export.h" #include "base/files/dir_reader_posix.h" - #include "base/files/file_util.h" -@@ -134,6 +135,9 @@ void SetLinuxDistro(const std::string& distro) { +@@ -135,6 +136,9 @@ void SetLinuxDistro(const std::string& distro) { } bool GetThreadsForProcess(pid_t pid, std::vector* tids) { +#if defined(OS_BSD) + return false; +#else // 25 > strlen("/proc//task") + strlen(std::to_string(INT_MAX)) + 1 = 22 char buf[25]; strings::SafeSPrintf(buf, "/proc/%d/task", pid); -@@ -153,6 +157,7 @@ bool GetThreadsForProcess(pid_t pid, std::vector #endif -@@ -552,14 +552,18 @@ void CheckCrashTestSighandler(int, siginfo_t* info, vo +@@ -574,14 +574,18 @@ void CheckCrashTestSighandler(int, siginfo_t* info, vo // need the arch-specific boilerplate below, which is inspired by breakpad. // At the same time, on OSX, ucontext.h is deprecated but si_addr works fine. uintptr_t crash_addr = 0; -#if BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FREEBSD) crash_addr = reinterpret_cast(info->si_addr); #else // OS_* ucontext_t* context = reinterpret_cast(context_ptr); #if defined(ARCH_CPU_X86) crash_addr = static_cast(context->uc_mcontext.gregs[REG_EIP]); #elif defined(ARCH_CPU_X86_64) +#if BUILDFLAG(IS_OPENBSD) + crash_addr = static_cast(context->sc_rip); +#else crash_addr = static_cast(context->uc_mcontext.gregs[REG_RIP]); +#endif #elif defined(ARCH_CPU_ARMEL) crash_addr = static_cast(context->uc_mcontext.arm_pc); #elif defined(ARCH_CPU_ARM64) diff --git a/www/iridium/files/patch-base_memory_discardable__memory.cc b/www/iridium/files/patch-base_memory_discardable__memory.cc index fa94ad078f00..6a302b8004a6 100644 --- a/www/iridium/files/patch-base_memory_discardable__memory.cc +++ b/www/iridium/files/patch-base_memory_discardable__memory.cc @@ -1,38 +1,38 @@ ---- base/memory/discardable_memory.cc.orig 2022-03-28 18:11:04 UTC +--- base/memory/discardable_memory.cc.orig 2022-10-05 07:34:01 UTC +++ base/memory/discardable_memory.cc -@@ -24,7 +24,7 @@ const base::Feature kMadvFreeDiscardableMemory{ +@@ -25,7 +25,7 @@ const base::Feature kMadvFreeDiscardableMemory{ "MadvFreeDiscardableMemory", base::FEATURE_DISABLED_BY_DEFAULT}; #endif // BUILDFLAG(IS_POSIX) -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) const base::Feature kDiscardableMemoryBackingTrial{ "DiscardableMemoryBackingTrial", base::FEATURE_DISABLED_BY_DEFAULT}; -@@ -49,7 +49,7 @@ const base::FeatureParam +@@ -50,7 +50,7 @@ const base::FeatureParam namespace { -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) DiscardableMemoryBacking GetBackingForFieldTrial() { DiscardableMemoryTrialGroup trial_group = -@@ -68,7 +68,7 @@ DiscardableMemoryBacking GetBackingForFieldTrial() { +@@ -69,7 +69,7 @@ DiscardableMemoryBacking GetBackingForFieldTrial() { } // namespace -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // Probe capabilities of this device to determine whether we should participate // in the discardable memory backing trial. -@@ -98,7 +98,7 @@ DiscardableMemory::DiscardableMemory() = default; +@@ -99,7 +99,7 @@ DiscardableMemory::DiscardableMemory() = default; DiscardableMemory::~DiscardableMemory() = default; DiscardableMemoryBacking GetDiscardableMemoryBacking() { -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) if (DiscardableMemoryBackingFieldTrialIsEnabled()) { return GetBackingForFieldTrial(); } diff --git a/www/iridium/files/patch-base_memory_madv__free__discardable__memory__posix.cc b/www/iridium/files/patch-base_memory_madv__free__discardable__memory__posix.cc index 2bcb51efe8aa..efa72b318679 100644 --- a/www/iridium/files/patch-base_memory_madv__free__discardable__memory__posix.cc +++ b/www/iridium/files/patch-base_memory_madv__free__discardable__memory__posix.cc @@ -1,21 +1,21 @@ ---- base/memory/madv_free_discardable_memory_posix.cc.orig 2022-03-28 18:11:04 UTC +--- base/memory/madv_free_discardable_memory_posix.cc.orig 2022-10-05 07:34:01 UTC +++ base/memory/madv_free_discardable_memory_posix.cc -@@ -294,6 +294,10 @@ void MadvFreeDiscardableMemoryPosix::SetKeepMemoryForT +@@ -295,6 +295,10 @@ void MadvFreeDiscardableMemoryPosix::SetKeepMemoryForT bool MadvFreeDiscardableMemoryPosix::IsResident() const { DFAKE_SCOPED_RECURSIVE_LOCK(thread_collision_warner_); +// XXX mincore +#if BUILDFLAG(IS_BSD) + return false; +#else #if BUILDFLAG(IS_APPLE) std::vector vec(allocated_pages_); #else -@@ -309,6 +313,7 @@ bool MadvFreeDiscardableMemoryPosix::IsResident() cons +@@ -310,6 +314,7 @@ bool MadvFreeDiscardableMemoryPosix::IsResident() cons return false; } return true; +#endif } bool MadvFreeDiscardableMemoryPosix::IsDiscarded() const { diff --git a/www/iridium/files/patch-base_memory_platform__shared__memory__region.h b/www/iridium/files/patch-base_memory_platform__shared__memory__region.h index c5e43cd552c7..5cfb8d4a0d78 100644 --- a/www/iridium/files/patch-base_memory_platform__shared__memory__region.h +++ b/www/iridium/files/patch-base_memory_platform__shared__memory__region.h @@ -1,29 +1,29 @@ ---- base/memory/platform_shared_memory_region.h.orig 2022-03-28 18:11:04 UTC +--- base/memory/platform_shared_memory_region.h.orig 2022-10-05 07:34:01 UTC +++ base/memory/platform_shared_memory_region.h -@@ -23,7 +23,7 @@ - #include "base/files/scoped_file.h" - #endif +@@ -16,7 +16,7 @@ + + #include -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) namespace content { class SandboxIPCHandler; } -@@ -116,7 +116,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion { +@@ -83,7 +83,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion { kMaxValue = GET_SHMEM_TEMP_DIR_FAILURE }; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // Structure to limit access to executable region creation. struct ExecutableRegion { private: -@@ -263,7 +263,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion { +@@ -211,7 +211,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion { CheckPlatformHandlePermissionsCorrespondToMode); static PlatformSharedMemoryRegion Create(Mode mode, size_t size -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) , bool executable = false #endif diff --git a/www/iridium/files/patch-base_memory_platform__shared__memory__region__posix.cc b/www/iridium/files/patch-base_memory_platform__shared__memory__region__posix.cc index 62629e981c66..7de0fcfe7f22 100644 --- a/www/iridium/files/patch-base_memory_platform__shared__memory__region__posix.cc +++ b/www/iridium/files/patch-base_memory_platform__shared__memory__region__posix.cc @@ -1,29 +1,29 @@ ---- base/memory/platform_shared_memory_region_posix.cc.orig 2022-03-28 18:11:04 UTC +--- base/memory/platform_shared_memory_region_posix.cc.orig 2022-10-05 07:34:01 UTC +++ base/memory/platform_shared_memory_region_posix.cc -@@ -70,7 +70,7 @@ FDPair ScopedFDPair::get() const { - return {fd.get(), readonly_fd.get()}; - } +@@ -55,7 +55,7 @@ bool CheckFDAccessMode(int fd, int expected_mode) { + + } // namespace -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // static ScopedFD PlatformSharedMemoryRegion::ExecutableRegion::CreateFD(size_t size) { PlatformSharedMemoryRegion region = -@@ -204,7 +204,7 @@ bool PlatformSharedMemoryRegion::MapAtInternal(off_t o +@@ -171,7 +171,7 @@ bool PlatformSharedMemoryRegion::ConvertToUnsafe() { // static PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode, size_t size -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) , bool executable #endif -@@ -233,7 +233,7 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion: +@@ -200,7 +200,7 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion: // flag. FilePath directory; if (!GetShmemTempDir( -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) executable, #else false /* executable */, diff --git a/www/iridium/files/patch-base_message__loop_message__pump__glib.cc b/www/iridium/files/patch-base_message__loop_message__pump__glib.cc index a8efb5f100ef..d200475045cc 100644 --- a/www/iridium/files/patch-base_message__loop_message__pump__glib.cc +++ b/www/iridium/files/patch-base_message__loop_message__pump__glib.cc @@ -1,28 +1,28 @@ ---- base/message_loop/message_pump_glib.cc.orig 2022-03-28 18:11:04 UTC +--- base/message_loop/message_pump_glib.cc.orig 2022-10-05 07:34:01 UTC +++ base/message_loop/message_pump_glib.cc @@ -8,6 +8,11 @@ #include #include +#if BUILDFLAG(IS_BSD) +#include +#include +#endif + #include "base/logging.h" + #include "base/memory/raw_ptr.h" #include "base/notreached.h" - #include "base/numerics/safe_conversions.h" -@@ -50,9 +55,13 @@ int GetTimeIntervalMilliseconds(TimeTicks next_task_ti +@@ -51,9 +56,13 @@ int GetTimeIntervalMilliseconds(TimeTicks next_task_ti } bool RunningOnMainThread() { +#if BUILDFLAG(IS_BSD) + return pthread_main_np(); +#else auto pid = getpid(); auto tid = PlatformThread::CurrentId(); return pid > 0 && tid > 0 && pid == tid; +#endif } // A brief refresher on GLib: diff --git a/www/iridium/files/patch-base_native__library__posix.cc b/www/iridium/files/patch-base_native__library__posix.cc index 13756477b102..2814e4b4b732 100644 --- a/www/iridium/files/patch-base_native__library__posix.cc +++ b/www/iridium/files/patch-base_native__library__posix.cc @@ -1,11 +1,11 @@ ---- base/native_library_posix.cc.orig 2022-03-28 18:11:04 UTC +--- base/native_library_posix.cc.orig 2022-10-05 07:34:01 UTC +++ base/native_library_posix.cc -@@ -32,7 +32,7 @@ NativeLibrary LoadNativeLibraryWithOptions(const FileP +@@ -33,7 +33,7 @@ NativeLibrary LoadNativeLibraryWithOptions(const FileP // http://crbug.com/17943, http://crbug.com/17557, http://crbug.com/36892, // and http://crbug.com/40794. int flags = RTLD_LAZY; -#if BUILDFLAG(IS_ANDROID) || !defined(RTLD_DEEPBIND) +#if BUILDFLAG(IS_ANDROID) || !defined(RTLD_DEEPBIND) || BUILDFLAG(IS_BSD) // Certain platforms don't define RTLD_DEEPBIND. Android dlopen() requires // further investigation, as it might vary across versions. Crash here to // warn developers that they're trying to rely on uncertain behavior. diff --git a/www/iridium/files/patch-base_posix_unix__domain__socket.cc b/www/iridium/files/patch-base_posix_unix__domain__socket.cc index a7c600b307d9..833309243830 100644 --- a/www/iridium/files/patch-base_posix_unix__domain__socket.cc +++ b/www/iridium/files/patch-base_posix_unix__domain__socket.cc @@ -1,39 +1,39 @@ ---- base/posix/unix_domain_socket.cc.orig 2022-03-28 18:11:04 UTC +--- base/posix/unix_domain_socket.cc.orig 2022-10-05 07:34:01 UTC +++ base/posix/unix_domain_socket.cc -@@ -50,7 +50,7 @@ bool CreateSocketPair(ScopedFD* one, ScopedFD* two) { +@@ -51,7 +51,7 @@ bool CreateSocketPair(ScopedFD* one, ScopedFD* two) { // static bool UnixDomainSocket::EnableReceiveProcessId(int fd) { -#if !BUILDFLAG(IS_APPLE) +#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD) const int enable = 1; return setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)) == 0; #else -@@ -140,7 +140,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, +@@ -149,7 +149,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, const size_t kControlBufferSize = CMSG_SPACE(sizeof(int) * kMaxFileDescriptors) -#if !BUILDFLAG(IS_APPLE) +#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD) // macOS does not support ucred. // macOS supports xucred, but this structure is insufficient. + CMSG_SPACE(sizeof(struct ucred)) -@@ -168,7 +168,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, +@@ -177,7 +177,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, wire_fds = reinterpret_cast(CMSG_DATA(cmsg)); wire_fds_len = payload_len / sizeof(int); } -#if !BUILDFLAG(IS_APPLE) +#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD) // macOS does not support SCM_CREDENTIALS. if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_CREDENTIALS) { -@@ -202,6 +202,9 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, +@@ -211,6 +211,9 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, socklen_t pid_size = sizeof(pid); if (getsockopt(fd, SOL_LOCAL, LOCAL_PEERPID, &pid, &pid_size) != 0) pid = -1; +#elif BUILDFLAG(IS_BSD) + NOTIMPLEMENTED(); + pid = -1; #else // |pid| will legitimately be -1 if we read EOF, so only DCHECK if we // actually received a message. Unfortunately, Linux allows sending zero diff --git a/www/iridium/files/patch-base_process_kill.h b/www/iridium/files/patch-base_process_kill.h index e66726c65dec..7f6d5b957acc 100644 --- a/www/iridium/files/patch-base_process_kill.h +++ b/www/iridium/files/patch-base_process_kill.h @@ -1,11 +1,11 @@ ---- base/process/kill.h.orig 2022-03-28 18:11:04 UTC +--- base/process/kill.h.orig 2022-10-05 07:34:01 UTC +++ base/process/kill.h -@@ -112,7 +112,7 @@ BASE_EXPORT TerminationStatus GetTerminationStatus(Pro +@@ -113,7 +113,7 @@ BASE_EXPORT TerminationStatus GetTerminationStatus(Pro BASE_EXPORT TerminationStatus GetKnownDeadTerminationStatus( ProcessHandle handle, int* exit_code); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // Spawns a thread to wait asynchronously for the child |process| to exit // and then reaps it. BASE_EXPORT void EnsureProcessGetsReaped(Process process); diff --git a/www/iridium/files/patch-base_process_kill__posix.cc b/www/iridium/files/patch-base_process_kill__posix.cc index 15228ccbd543..d0da11564e7c 100644 --- a/www/iridium/files/patch-base_process_kill__posix.cc +++ b/www/iridium/files/patch-base_process_kill__posix.cc @@ -1,11 +1,11 @@ ---- base/process/kill_posix.cc.orig 2022-03-28 18:11:04 UTC +--- base/process/kill_posix.cc.orig 2022-10-05 07:34:01 UTC +++ base/process/kill_posix.cc -@@ -159,7 +159,7 @@ void EnsureProcessTerminated(Process process) { +@@ -158,7 +158,7 @@ void EnsureProcessTerminated(Process process) { 0, new BackgroundReaper(std::move(process), Seconds(2))); } -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) void EnsureProcessGetsReaped(Process process) { DCHECK(!process.is_current()); diff --git a/www/iridium/files/patch-base_process_launch.h b/www/iridium/files/patch-base_process_launch.h index 22aac90ca891..0edde543cab6 100644 --- a/www/iridium/files/patch-base_process_launch.h +++ b/www/iridium/files/patch-base_process_launch.h @@ -1,11 +1,11 @@ ---- base/process/launch.h.orig 2022-03-28 18:11:04 UTC +--- base/process/launch.h.orig 2022-10-05 07:34:01 UTC +++ base/process/launch.h -@@ -195,7 +195,7 @@ struct BASE_EXPORT LaunchOptions { +@@ -198,7 +198,7 @@ struct BASE_EXPORT LaunchOptions { bool clear_environment = false; #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // If non-zero, start the process using clone(), using flags as provided. // Unlike in clone, clone_flags may not contain a custom termination signal // that is sent to the parent when the child dies. The termination signal will diff --git a/www/iridium/files/patch-base_process_memory.cc b/www/iridium/files/patch-base_process_memory.cc index c7b047e640c0..db25f3dd4dc4 100644 --- a/www/iridium/files/patch-base_process_memory.cc +++ b/www/iridium/files/patch-base_process_memory.cc @@ -1,20 +1,11 @@ ---- base/process/memory.cc.orig 2022-03-28 18:11:04 UTC +--- base/process/memory.cc.orig 2022-10-05 07:34:01 UTC +++ base/process/memory.cc -@@ -65,14 +65,16 @@ NOINLINE void OnNoMemoryInternal(size_t size) { - - } // namespace internal - -+#if !BUILDFLAG(IS_BSD) - void TerminateBecauseOutOfMemory(size_t size) { - internal::OnNoMemoryInternal(size); - } -+#endif - +@@ -29,7 +29,7 @@ namespace base { // Defined in memory_mac.mm for macOS + use_allocator="none". In case of // USE_PARTITION_ALLOC_AS_MALLOC, no need to route the call to the system // default calloc of macOS. -#if !BUILDFLAG(IS_APPLE) || BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) +#if (!BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)) || BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) bool UncheckedCalloc(size_t num_items, size_t size, void** result) { const size_t alloc_size = num_items * size; diff --git a/www/iridium/files/patch-base_process_process__handle__freebsd.cc b/www/iridium/files/patch-base_process_process__handle__freebsd.cc index 097ee458c179..be6873bb2492 100644 --- a/www/iridium/files/patch-base_process_process__handle__freebsd.cc +++ b/www/iridium/files/patch-base_process_process__handle__freebsd.cc @@ -1,23 +1,25 @@ ---- base/process/process_handle_freebsd.cc.orig 2022-03-28 18:11:04 UTC +--- base/process/process_handle_freebsd.cc.orig 2022-10-05 07:34:01 UTC +++ base/process/process_handle_freebsd.cc -@@ -12,15 +12,19 @@ - #include +@@ -3,6 +3,7 @@ + // found in the LICENSE file. - #include "base/cxx17_backports.h" -+#include "base/files/file_path.h" + #include "base/process/process_handle.h" ++#include "base/files/file_util.h" - namespace base { + #include + #include +@@ -15,10 +16,13 @@ namespace base { ProcessId GetParentProcessId(ProcessHandle process) { struct kinfo_proc info; - size_t length; + size_t length = sizeof(struct kinfo_proc); int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process }; - if (sysctl(mib, base::size(mib), &info, &length, NULL, 0) < 0) + if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0) + return -1; + + if (length < sizeof(struct kinfo_proc)) return -1; return info.ki_ppid; diff --git a/www/iridium/files/patch-base_process_process__handle__openbsd.cc b/www/iridium/files/patch-base_process_process__handle__openbsd.cc index ce55d295fe45..cfde3ae9716d 100644 --- a/www/iridium/files/patch-base_process_process__handle__openbsd.cc +++ b/www/iridium/files/patch-base_process_process__handle__openbsd.cc @@ -1,89 +1,89 @@ ---- base/process/process_handle_openbsd.cc.orig 2022-03-28 18:11:04 UTC +--- base/process/process_handle_openbsd.cc.orig 2022-10-05 07:34:01 UTC +++ base/process/process_handle_openbsd.cc @@ -3,8 +3,11 @@ // found in the LICENSE file. #include "base/process/process_handle.h" +#include "base/files/file_util.h" #include +#include +#include #include #include #include -@@ -14,39 +17,59 @@ +@@ -12,39 +15,59 @@ namespace base { ProcessId GetParentProcessId(ProcessHandle process) { - struct kinfo_proc info; + struct kinfo_proc *info; size_t length; + pid_t ppid; int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process, sizeof(struct kinfo_proc), 0 }; - if (sysctl(mib, base::size(mib), NULL, &length, NULL, 0) < 0) + if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0) return -1; + info = (struct kinfo_proc *)malloc(length); + mib[5] = (length / sizeof(struct kinfo_proc)); -- if (sysctl(mib, base::size(mib), &info, &length, NULL, 0) < 0) +- if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0) - return -1; -+ if (sysctl(mib, base::size(mib), info, &length, NULL, 0) < 0) { ++ if (sysctl(mib, std::size(mib), info, &length, NULL, 0) < 0) { + ppid = -1; + goto out; + } - return info.p_ppid; + ppid = info->p_ppid; + +out: + free(info); + return ppid; } FilePath GetProcessExecutablePath(ProcessHandle process) { - struct kinfo_proc kp; - size_t len; + struct kinfo_proc *info; + size_t length; + char *path = NULL; int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process, sizeof(struct kinfo_proc), 0 }; -- if (sysctl(mib, base::size(mib), NULL, &len, NULL, 0) == -1) -+ if (sysctl(mib, base::size(mib), NULL, &length, NULL, 0) == -1) +- if (sysctl(mib, std::size(mib), NULL, &len, NULL, 0) == -1) ++ if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) == -1) return FilePath(); - mib[5] = (len / sizeof(struct kinfo_proc)); -- if (sysctl(mib, base::size(mib), &kp, &len, NULL, 0) < 0) +- if (sysctl(mib, std::size(mib), &kp, &len, NULL, 0) < 0) - return FilePath(); - if ((kp.p_flag & P_SYSTEM) != 0) - return FilePath(); - if (strcmp(kp.p_comm, "chrome") == 0) - return FilePath(kp.p_comm); - return FilePath(); + info = (struct kinfo_proc *)malloc(length); + + mib[5] = (length / sizeof(struct kinfo_proc)); + -+ if (sysctl(mib, base::size(mib), info, &length, NULL, 0) < 0) ++ if (sysctl(mib, std::size(mib), info, &length, NULL, 0) < 0) + goto out; + + if ((info->p_flag & P_SYSTEM) != 0) + goto out; + + if (strcmp(info->p_comm, "chrome") == 0) { + path = info->p_comm; + goto out; + } + +out: + free(info); + return FilePath(path); } } // namespace base diff --git a/www/iridium/files/patch-base_process_process__iterator__freebsd.cc b/www/iridium/files/patch-base_process_process__iterator__freebsd.cc index a319a4f0a1f2..204c3440c567 100644 --- a/www/iridium/files/patch-base_process_process__iterator__freebsd.cc +++ b/www/iridium/files/patch-base_process_process__iterator__freebsd.cc @@ -1,51 +1,51 @@ ---- base/process/process_iterator_freebsd.cc.orig 2022-03-28 18:11:04 UTC +--- base/process/process_iterator_freebsd.cc.orig 2022-10-05 07:34:01 UTC +++ base/process/process_iterator_freebsd.cc -@@ -21,7 +21,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* +@@ -20,7 +20,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* : index_of_kinfo_proc_(), filter_(filter) { - int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, getuid() }; + int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, (int) getuid() }; bool done = false; int try_num = 1; -@@ -40,7 +40,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* +@@ -39,7 +39,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* num_of_kinfo_proc += 16; kinfo_procs_.resize(num_of_kinfo_proc); len = num_of_kinfo_proc * sizeof(struct kinfo_proc); -- if (sysctl(mib, base::size(mib), &kinfo_procs_[0], &len, NULL, 0) < 0) { -+ if (sysctl(mib, base::size(mib), kinfo_procs_.data(), &len, NULL, 0) < 0) { +- if (sysctl(mib, std::size(mib), &kinfo_procs_[0], &len, NULL, 0) < 0) { ++ if (sysctl(mib, std::size(mib), kinfo_procs_.data(), &len, NULL, 0) < 0) { // If we get a mem error, it just means we need a bigger buffer, so // loop around again. Anything else is a real error and give up. if (errno != ENOMEM) { -@@ -50,7 +50,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* +@@ -49,7 +49,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* } } else { // Got the list, just make sure we're sized exactly right - size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc); -+ num_of_kinfo_proc = len / sizeof(struct kinfo_proc); ++ num_of_kinfo_proc = len / sizeof(struct kinfo_proc); kinfo_procs_.resize(num_of_kinfo_proc); done = true; } -@@ -72,18 +72,13 @@ bool ProcessIterator::CheckForNextProcess() { +@@ -71,18 +71,13 @@ bool ProcessIterator::CheckForNextProcess() { for (; index_of_kinfo_proc_ < kinfo_procs_.size(); ++index_of_kinfo_proc_) { size_t length; struct kinfo_proc kinfo = kinfo_procs_[index_of_kinfo_proc_]; - int mib[] = { CTL_KERN, KERN_PROC_ARGS, kinfo.ki_pid }; + int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ARGS, kinfo.ki_pid }; if ((kinfo.ki_pid > 0) && (kinfo.ki_stat == SZOMB)) continue; - length = 0; -- if (sysctl(mib, base::size(mib), NULL, &length, NULL, 0) < 0) { +- if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0) { - LOG(ERROR) << "failed to figure out the buffer size for a command line"; - continue; - } - - data.resize(length); + data.resize(ARG_MAX); + length = ARG_MAX; - if (sysctl(mib, base::size(mib), &data[0], &length, NULL, 0) < 0) { + if (sysctl(mib, std::size(mib), &data[0], &length, NULL, 0) < 0) { LOG(ERROR) << "failed to fetch a commandline"; diff --git a/www/iridium/files/patch-base_process_process__iterator__openbsd.cc b/www/iridium/files/patch-base_process_process__iterator__openbsd.cc index 4749dc067a02..ad384cf7d963 100644 --- a/www/iridium/files/patch-base_process_process__iterator__openbsd.cc +++ b/www/iridium/files/patch-base_process_process__iterator__openbsd.cc @@ -1,45 +1,45 @@ ---- base/process/process_iterator_openbsd.cc.orig 2022-03-28 18:11:04 UTC +--- base/process/process_iterator_openbsd.cc.orig 2022-10-05 07:34:01 UTC +++ base/process/process_iterator_openbsd.cc @@ -6,6 +6,9 @@ #include #include +#include +#include +#include #include - #include "base/cxx17_backports.h" -@@ -19,12 +22,13 @@ ProcessIterator::ProcessIterator(const ProcessFilter* + #include "base/logging.h" +@@ -18,12 +21,13 @@ ProcessIterator::ProcessIterator(const ProcessFilter* : index_of_kinfo_proc_(), filter_(filter) { - int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, getuid(), + int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, static_cast(getuid()), sizeof(struct kinfo_proc), 0 }; bool done = false; int try_num = 1; const int max_tries = 10; + size_t num_of_kinfo_proc; do { size_t len = 0; -@@ -33,7 +37,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* +@@ -32,7 +36,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* kinfo_procs_.resize(0); done = true; } else { - size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc); + num_of_kinfo_proc = len / sizeof(struct kinfo_proc); // Leave some spare room for process table growth (more could show up // between when we check and now) num_of_kinfo_proc += 16; -@@ -49,7 +53,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* +@@ -48,7 +52,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* } } else { // Got the list, just make sure we're sized exactly right - size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc); + num_of_kinfo_proc = len / sizeof(struct kinfo_proc); kinfo_procs_.resize(num_of_kinfo_proc); done = true; } diff --git a/www/iridium/files/patch-base_process_process__metrics.cc b/www/iridium/files/patch-base_process_process__metrics.cc index 9b6223182061..2398f6259a1d 100644 --- a/www/iridium/files/patch-base_process_process__metrics.cc +++ b/www/iridium/files/patch-base_process_process__metrics.cc @@ -1,47 +1,47 @@ ---- base/process/process_metrics.cc.orig 2022-03-28 18:11:04 UTC +--- base/process/process_metrics.cc.orig 2022-10-05 07:34:01 UTC +++ base/process/process_metrics.cc -@@ -18,7 +18,7 @@ namespace base { +@@ -17,7 +17,7 @@ namespace base { namespace { #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_AIX) + BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) int CalculateEventsPerSecond(uint64_t event_count, uint64_t* last_event_count, base::TimeTicks* last_calculated) { -@@ -55,7 +55,7 @@ SystemMetrics SystemMetrics::Sample() { +@@ -54,7 +54,7 @@ SystemMetrics SystemMetrics::Sample() { SystemMetrics system_metrics; system_metrics.committed_memory_ = GetSystemCommitCharge(); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD) GetSystemMemoryInfo(&system_metrics.memory_info_); GetVmStatInfo(&system_metrics.vmstat_info_); GetSystemDiskInfo(&system_metrics.disk_info_); -@@ -74,7 +74,7 @@ Value SystemMetrics::ToValue() const { +@@ -73,7 +73,7 @@ Value SystemMetrics::ToValue() const { Value res(Value::Type::DICTIONARY); res.SetIntKey("committed_memory", static_cast(committed_memory_)); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD) Value meminfo = memory_info_.ToValue(); Value vmstat = vmstat_info_.ToValue(); meminfo.MergeDictionary(&vmstat); -@@ -100,7 +100,7 @@ std::unique_ptr ProcessMetrics::Create +@@ -99,7 +99,7 @@ std::unique_ptr ProcessMetrics::Create #endif // !BUILDFLAG(IS_MAC) } -#if !BUILDFLAG(IS_FREEBSD) || !BUILDFLAG(IS_POSIX) -+#if !BUILDFLAG(IS_BSD) || !BUILDFLAG(IS_POSIX) ++#if !BUILDFLAG(IS_FREEBSD) double ProcessMetrics::GetPlatformIndependentCPUUsage() { TimeDelta cumulative_cpu = GetCumulativeCPUUsage(); TimeTicks time = TimeTicks::Now(); -@@ -126,7 +126,7 @@ double ProcessMetrics::GetPlatformIndependentCPUUsage( - #endif +@@ -150,7 +150,7 @@ double ProcessMetrics::GetPreciseCPUUsage() { + #endif // BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_AIX) + BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) int ProcessMetrics::CalculateIdleWakeupsPerSecond( uint64_t absolute_idle_wakeups) { return CalculateEventsPerSecond(absolute_idle_wakeups, diff --git a/www/iridium/files/patch-base_process_process__metrics.h b/www/iridium/files/patch-base_process_process__metrics.h index e0e9cf4639d7..27bdfe62aaa4 100644 --- a/www/iridium/files/patch-base_process_process__metrics.h +++ b/www/iridium/files/patch-base_process_process__metrics.h @@ -1,119 +1,129 @@ ---- base/process/process_metrics.h.orig 2022-03-28 18:11:04 UTC +--- base/process/process_metrics.h.orig 2022-10-05 07:34:01 UTC +++ base/process/process_metrics.h @@ -36,7 +36,7 @@ #endif #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ - BUILDFLAG(IS_AIX) + BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) #include #include #include @@ -52,7 +52,7 @@ class Value; // Full declaration is in process_metrics_iocounters.h. struct IoCounters; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD) // Minor and major page fault counts since the process creation. // Both counts are process-wide, and exclude child processes. // @@ -107,7 +107,7 @@ class BASE_EXPORT ProcessMetrics { // convenience wrapper for CreateProcessMetrics(). static std::unique_ptr CreateCurrentProcessMetrics(); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD) // Resident Set Size is a Linux/Android specific memory concept. Do not // attempt to extend this to other platforms. BASE_EXPORT size_t GetResidentSetSize() const; -@@ -134,7 +134,7 @@ class BASE_EXPORT ProcessMetrics { - [[nodiscard]] TimeDelta GetCumulativeCPUUsage(); +@@ -155,7 +155,7 @@ class BASE_EXPORT ProcessMetrics { + #endif // BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ - BUILDFLAG(IS_AIX) + BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) // Emits the cumulative CPU usage for all currently active threads since they // were started into the output parameter (replacing its current contents). // Threads that have already terminated will not be reported. Thus, the sum of -@@ -217,7 +217,7 @@ class BASE_EXPORT ProcessMetrics { +@@ -238,7 +238,7 @@ class BASE_EXPORT ProcessMetrics { int GetOpenFdSoftLimit() const; #endif // BUILDFLAG(IS_POSIX) -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD) // Bytes of swap as reported by /proc/[pid]/status. uint64_t GetVmSwapBytes() const; -@@ -238,7 +238,7 @@ class BASE_EXPORT ProcessMetrics { +@@ -259,7 +259,7 @@ class BASE_EXPORT ProcessMetrics { #endif // !BUILDFLAG(IS_MAC) #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_AIX) + BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) int CalculateIdleWakeupsPerSecond(uint64_t absolute_idle_wakeups); #endif #if BUILDFLAG(IS_APPLE) -@@ -249,7 +249,7 @@ class BASE_EXPORT ProcessMetrics { +@@ -270,7 +270,7 @@ class BASE_EXPORT ProcessMetrics { #endif #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ - BUILDFLAG(IS_AIX) + BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) - CPU::CoreType GetCoreType(int core_index); + CPU::CoreType GetCoreType(uint32_t core_index); #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_AIX) -@@ -274,7 +274,7 @@ class BASE_EXPORT ProcessMetrics { - uint64_t last_cumulative_disk_usage_ = 0; +@@ -284,9 +284,7 @@ class BASE_EXPORT ProcessMetrics { + // Used to store the previous times and CPU usage counts so we can + // compute the CPU usage between calls. + TimeTicks last_cpu_time_; +-#if !BUILDFLAG(IS_FREEBSD) || !BUILDFLAG(IS_POSIX) + TimeDelta last_cumulative_cpu_; +-#endif + + #if BUILDFLAG(IS_WIN) + TimeTicks last_cpu_time_for_precise_cpu_usage_; +@@ -294,7 +292,7 @@ class BASE_EXPORT ProcessMetrics { + #endif #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_AIX) + BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) // Same thing for idle wakeups. TimeTicks last_idle_wakeups_time_; uint64_t last_absolute_idle_wakeups_; -@@ -317,7 +317,7 @@ BASE_EXPORT void IncreaseFdLimitTo(unsigned int max_de +@@ -337,7 +335,7 @@ BASE_EXPORT void IncreaseFdLimitTo(unsigned int max_de #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_AIX) || \ - BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) // Data about system-wide memory consumption. Values are in KB. Available on // Windows, Mac, Linux, Android and Chrome OS. // -@@ -352,7 +352,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { +@@ -372,7 +370,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { #endif #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ - BUILDFLAG(IS_AIX) + BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) // This provides an estimate of available memory as described here: // https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773 // NOTE: this is ONLY valid in kernels 3.14 and up. Its value will always -@@ -367,7 +367,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { +@@ -387,7 +385,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { #endif #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_AIX) || BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_AIX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) int buffers = 0; int cached = 0; int active_anon = 0; -@@ -404,7 +404,7 @@ BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoK +@@ -424,7 +422,7 @@ BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoK // BUILDFLAG(IS_FUCHSIA) #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ - BUILDFLAG(IS_AIX) + BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) // Parse the data found in /proc//stat and return the sum of the // CPU-related ticks. Returns -1 on parse error. // Exposed for testing. -@@ -591,7 +591,7 @@ class BASE_EXPORT SystemMetrics { +@@ -611,7 +609,7 @@ class BASE_EXPORT SystemMetrics { FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics); size_t committed_memory_; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD) SystemMemoryInfoKB memory_info_; VmStatInfo vmstat_info_; SystemDiskInfo disk_info_; diff --git a/www/iridium/files/patch-base_process_process__metrics__freebsd.cc b/www/iridium/files/patch-base_process_process__metrics__freebsd.cc index 7b7633d05bd8..c0ed225bef18 100644 --- a/www/iridium/files/patch-base_process_process__metrics__freebsd.cc +++ b/www/iridium/files/patch-base_process_process__metrics__freebsd.cc @@ -1,292 +1,290 @@ ---- base/process/process_metrics_freebsd.cc.orig 2022-03-28 20:16:21 UTC +--- base/process/process_metrics_freebsd.cc.orig 2022-10-05 07:34:01 UTC +++ base/process/process_metrics_freebsd.cc -@@ -3,21 +3,41 @@ +@@ -3,20 +3,39 @@ // found in the LICENSE file. #include "base/process/process_metrics.h" +#include "base/notreached.h" #include +#include #include #include #include +#include /* O_RDONLY */ +#include +#include + - #include "base/cxx17_backports.h" #include "base/memory/ptr_util.h" #include "base/process/process_metrics_iocounters.h" +#include "base/values.h" namespace base { +namespace { - +int GetPageShift() { + int pagesize = getpagesize(); + int pageshift = 0; -+ + + while (pagesize > 1) { + pageshift++; + pagesize >>= 1; + } + + return pageshift; +} +} + ProcessMetrics::ProcessMetrics(ProcessHandle process) - : process_(process), - last_cpu_(0) {} + : process_(process) {} // static std::unique_ptr ProcessMetrics::CreateProcessMetrics( -@@ -27,17 +47,18 @@ std::unique_ptr ProcessMetrics::Create +@@ -26,17 +45,18 @@ std::unique_ptr ProcessMetrics::Create double ProcessMetrics::GetPlatformIndependentCPUUsage() { struct kinfo_proc info; - int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, process_}; - size_t length = sizeof(info); + size_t length = sizeof(struct kinfo_proc); -+ int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, process_ }; ++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process_ }; + - if (sysctl(mib, base::size(mib), &info, &length, NULL, 0) < 0) + if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0) - return 0; + return 0.0; - return (info.ki_pctcpu / FSCALE) * 100.0; + return static_cast((info.ki_pctcpu * 100.0) / FSCALE); } TimeDelta ProcessMetrics::GetCumulativeCPUUsage() { - NOTREACHED(); + NOTIMPLEMENTED(); return TimeDelta(); } -@@ -68,4 +89,221 @@ size_t GetSystemCommitCharge() { +@@ -67,4 +87,221 @@ size_t GetSystemCommitCharge() { return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize); } -+int GetNumberOfThreads(ProcessHandle process) { ++int64_t GetNumberOfThreads(ProcessHandle process) { + // Taken from FreeBSD top (usr.bin/top/machine.c) + + kvm_t* kd = kvm_open(NULL, "/dev/null", NULL, O_RDONLY, "kvm_open"); + if (kd == NULL) + return 0; + + struct kinfo_proc* pbase; + int nproc; + pbase = kvm_getprocs(kd, KERN_PROC_PID, process, &nproc); + if (pbase == NULL) + return 0; + + if (kvm_close(kd) == -1) + return 0; + + return nproc; +} + +bool GetSystemMemoryInfo(SystemMemoryInfoKB *meminfo) { + unsigned int mem_total, mem_free, swap_total, swap_used; + size_t length; + int pagesizeKB; + + pagesizeKB = getpagesize() / 1024; + + length = sizeof(mem_total); + if (sysctlbyname("vm.stats.vm.v_page_count", &mem_total, + &length, NULL, 0) != 0 || length != sizeof(mem_total)) + return false; + + length = sizeof(mem_free); + if (sysctlbyname("vm.stats.vm.v_free_count", &mem_free, &length, NULL, 0) + != 0 || length != sizeof(mem_free)) + return false; + + length = sizeof(swap_total); + if (sysctlbyname("vm.swap_size", &swap_total, &length, NULL, 0) + != 0 || length != sizeof(swap_total)) + return false; + + length = sizeof(swap_used); + if (sysctlbyname("vm.swap_anon_use", &swap_used, &length, NULL, 0) + != 0 || length != sizeof(swap_used)) + return false; + + meminfo->total = mem_total * pagesizeKB; + meminfo->free = mem_free * pagesizeKB; + meminfo->swap_total = swap_total * pagesizeKB; + meminfo->swap_free = (swap_total - swap_used) * pagesizeKB; + + return true; +} + +int ProcessMetrics::GetOpenFdCount() const { + struct kinfo_file * kif; + int cnt; + + if ((kif = kinfo_getfile(process_, &cnt)) == NULL) + return -1; + + free(kif); + + return cnt; +} + +int ProcessMetrics::GetOpenFdSoftLimit() const { + size_t length; + int total_count = 0; + int mib[] = { CTL_KERN, KERN_MAXFILESPERPROC }; + + length = sizeof(total_count); + -+ if (sysctl(mib, base::size(mib), &total_count, &length, NULL, 0) < 0) { ++ if (sysctl(mib, std::size(mib), &total_count, &length, NULL, 0) < 0) { + total_count = -1; + } + + return total_count; +} + +size_t ProcessMetrics::GetResidentSetSize() const { + kvm_t *kd = kvm_open(nullptr, "/dev/null", nullptr, O_RDONLY, "kvm_open"); + + if (kd == nullptr) + return 0; + + struct kinfo_proc *pp; + int nproc; + + if ((pp = kvm_getprocs(kd, KERN_PROC_PID, process_, &nproc)) == nullptr) { + kvm_close(kd); + return 0; + } + + size_t rss; + + if (nproc > 0) { + rss = pp->ki_rssize << GetPageShift(); + } else { + rss = 0; + } + + kvm_close(kd); + return rss; +} + +uint64_t ProcessMetrics::GetVmSwapBytes() const { + kvm_t *kd = kvm_open(nullptr, "/dev/null", nullptr, O_RDONLY, "kvm_open"); + + if (kd == nullptr) + return 0; + + struct kinfo_proc *pp; + int nproc; + + if ((pp = kvm_getprocs(kd, KERN_PROC_PID, process_, &nproc)) == nullptr) { + kvm_close(kd); + return 0; + } + + size_t swrss; + + if (nproc > 0) { + swrss = pp->ki_swrss > pp->ki_rssize + ? (pp->ki_swrss - pp->ki_rssize) << GetPageShift() + : 0; + } else { + swrss = 0; + } + + kvm_close(kd); + return swrss; +} + +int ProcessMetrics::GetIdleWakeupsPerSecond() { + NOTIMPLEMENTED(); + return 0; +} + +bool GetSystemDiskInfo(SystemDiskInfo* diskinfo) { + NOTIMPLEMENTED(); + return false; +} + +bool GetVmStatInfo(VmStatInfo* vmstat) { + NOTIMPLEMENTED(); + return false; +} + +SystemDiskInfo::SystemDiskInfo() { + reads = 0; + reads_merged = 0; + sectors_read = 0; + read_time = 0; + writes = 0; + writes_merged = 0; + sectors_written = 0; + write_time = 0; + io = 0; + io_time = 0; + weighted_io_time = 0; +} + +SystemDiskInfo::SystemDiskInfo(const SystemDiskInfo& other) = default; + +SystemDiskInfo& SystemDiskInfo::operator=(const SystemDiskInfo&) = default; + +Value SystemDiskInfo::ToValue() const { + Value res(Value::Type::DICTIONARY); + + // Write out uint64_t variables as doubles. + // Note: this may discard some precision, but for JS there's no other option. + res.SetDoubleKey("reads", static_cast(reads)); + res.SetDoubleKey("reads_merged", static_cast(reads_merged)); + res.SetDoubleKey("sectors_read", static_cast(sectors_read)); + res.SetDoubleKey("read_time", static_cast(read_time)); + res.SetDoubleKey("writes", static_cast(writes)); + res.SetDoubleKey("writes_merged", static_cast(writes_merged)); + res.SetDoubleKey("sectors_written", static_cast(sectors_written)); + res.SetDoubleKey("write_time", static_cast(write_time)); + res.SetDoubleKey("io", static_cast(io)); + res.SetDoubleKey("io_time", static_cast(io_time)); + res.SetDoubleKey("weighted_io_time", static_cast(weighted_io_time)); + + return res; +} + +Value SystemMemoryInfoKB::ToValue() const { + Value res(Value::Type::DICTIONARY); + + res.SetIntKey("total", total); + res.SetIntKey("free", free); + res.SetIntKey("available", available); + res.SetIntKey("buffers", buffers); + res.SetIntKey("cached", cached); + res.SetIntKey("active_anon", active_anon); + res.SetIntKey("inactive_anon", inactive_anon); + res.SetIntKey("active_file", active_file); + res.SetIntKey("inactive_file", inactive_file); + res.SetIntKey("swap_total", swap_total); + res.SetIntKey("swap_free", swap_free); + res.SetIntKey("swap_used", swap_total - swap_free); + res.SetIntKey("dirty", dirty); + res.SetIntKey("reclaimable", reclaimable); + + return res; +} + +Value VmStatInfo::ToValue() const { + Value res(Value::Type::DICTIONARY); + + res.SetIntKey("pswpin", pswpin); + res.SetIntKey("pswpout", pswpout); + res.SetIntKey("pgmajfault", pgmajfault); + + return res; +} } // namespace base diff --git a/www/iridium/files/patch-base_process_process__metrics__openbsd.cc b/www/iridium/files/patch-base_process_process__metrics__openbsd.cc index f23c76752eb3..15b11af28d11 100644 --- a/www/iridium/files/patch-base_process_process__metrics__openbsd.cc +++ b/www/iridium/files/patch-base_process_process__metrics__openbsd.cc @@ -1,235 +1,215 @@ ---- base/process/process_metrics_openbsd.cc.orig 2022-04-01 07:48:30 UTC +--- base/process/process_metrics_openbsd.cc.orig 2022-10-05 07:34:01 UTC +++ base/process/process_metrics_openbsd.cc -@@ -4,17 +4,36 @@ +@@ -6,14 +6,23 @@ - #include "base/process/process_metrics.h" - -+#include "base/files/file_util.h" -+#include "base/logging.h" -+#include "base/process/internal_linux.h" -+#include "base/strings/string_number_conversions.h" -+#include "base/strings/string_split.h" -+#include "base/strings/string_tokenizer.h" -+#include "base/strings/string_util.h" -+#include "base/system/sys_info.h" -+#include "base/threading/thread_restrictions.h" -+#include "base/notreached.h" -+ #include #include +#include #include #include +#include +#include + - #include "base/cxx17_backports.h" #include "base/memory/ptr_util.h" #include "base/process/process_metrics_iocounters.h" +#include "base/values.h" ++#include "base/notreached.h" namespace base { +ProcessMetrics::ProcessMetrics(ProcessHandle process) + : process_(process) {} + // static std::unique_ptr ProcessMetrics::CreateProcessMetrics( ProcessHandle process) { -@@ -25,49 +44,24 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_coun +@@ -24,49 +33,23 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_coun return false; } -static int GetProcessCPU(pid_t pid) { -+double ProcessMetrics::GetPlatformIndependentCPUUsage() { ++TimeDelta ProcessMetrics::GetCumulativeCPUUsage() { struct kinfo_proc info; - size_t length; - int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid, - sizeof(struct kinfo_proc), 0 }; + size_t length = sizeof(struct kinfo_proc); ++ struct timeval tv; -- if (sysctl(mib, base::size(mib), NULL, &length, NULL, 0) < 0) +- if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0) - return -1; + int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process_, + sizeof(struct kinfo_proc), 1 }; - mib[5] = (length / sizeof(struct kinfo_proc)); -+ if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0) -+ return 0.0; - -- if (sysctl(mib, base::size(mib), &info, &length, NULL, 0) < 0) -- return 0; - + if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0) +- return 0; ++ return TimeDelta(); + - return info.p_pctcpu; -+ return static_cast((info.p_pctcpu * 100.0) / FSCALE); - } +-} ++ tv.tv_sec = info.p_rtime_sec; ++ tv.tv_usec = info.p_rtime_usec; -double ProcessMetrics::GetPlatformIndependentCPUUsage() { - TimeTicks time = TimeTicks::Now(); - - if (last_cpu_time_.is_zero()) { - // First call, just set the last values. - last_cpu_time_ = time; - return 0; - } - - int cpu = GetProcessCPU(process_); - - last_cpu_time_ = time; - double percentage = static_cast((cpu * 100.0) / FSCALE); - - return percentage; --} -- - TimeDelta ProcessMetrics::GetCumulativeCPUUsage() { - NOTREACHED(); - return TimeDelta(); ++ return Microseconds(TimeValToMicroseconds(tv)); } +-TimeDelta ProcessMetrics::GetCumulativeCPUUsage() { +- NOTREACHED(); +- return TimeDelta(); +-} +- -ProcessMetrics::ProcessMetrics(ProcessHandle process) - : process_(process), - last_cpu_(0) {} - size_t GetSystemCommitCharge() { int mib[] = { CTL_VM, VM_METER }; int pagesize; -@@ -75,7 +69,7 @@ size_t GetSystemCommitCharge() { - unsigned long mem_total, mem_free, mem_inactive; - size_t len = sizeof(vmtotal); - -- if (sysctl(mib, base::size(mib), &vmtotal, &len, NULL, 0) < 0) -+ if (sysctl(mib, std::size(mib), &vmtotal, &len, NULL, 0) < 0) - return 0; - - mem_total = vmtotal.t_vm; -@@ -85,6 +79,129 @@ size_t GetSystemCommitCharge() { +@@ -84,6 +67,129 @@ size_t GetSystemCommitCharge() { pagesize = getpagesize(); return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize); +} + +int ProcessMetrics::GetOpenFdCount() const { + struct kinfo_file *files; + kvm_t *kd = NULL; + int total_count = 0; + char errbuf[_POSIX2_LINE_MAX]; + + if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL) + goto out; + + if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, process_, + sizeof(struct kinfo_file), &total_count)) == NULL) { + total_count = 0; + goto out; + } + + kvm_close(kd); + +out: + return total_count; +} + +int ProcessMetrics::GetOpenFdSoftLimit() const { + return GetMaxFds(); +} + +uint64_t ProcessMetrics::GetVmSwapBytes() const { + NOTIMPLEMENTED(); + return 0; +} + +bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) { + NOTIMPLEMENTED_LOG_ONCE(); + return false; +} + +SystemDiskInfo::SystemDiskInfo() { + reads = 0; + reads_merged = 0; + sectors_read = 0; + read_time = 0; + writes = 0; + writes_merged = 0; + sectors_written = 0; + write_time = 0; + io = 0; + io_time = 0; + weighted_io_time = 0; +} + +SystemDiskInfo::SystemDiskInfo(const SystemDiskInfo& other) = default; + +bool GetSystemDiskInfo(SystemDiskInfo* diskinfo) { + NOTIMPLEMENTED(); + return false; +} + +bool GetVmStatInfo(VmStatInfo* vmstat) { + NOTIMPLEMENTED(); + return false; +} + +int ProcessMetrics::GetIdleWakeupsPerSecond() { + NOTIMPLEMENTED(); + return 0; +} + +Value SystemMemoryInfoKB::ToValue() const { + Value res(Value::Type::DICTIONARY); + res.SetIntKey("total", total); + res.SetIntKey("free", free); + res.SetIntKey("available", available); + res.SetIntKey("buffers", buffers); + res.SetIntKey("cached", cached); + res.SetIntKey("active_anon", active_anon); + res.SetIntKey("inactive_anon", inactive_anon); + res.SetIntKey("active_file", active_file); + res.SetIntKey("inactive_file", inactive_file); + res.SetIntKey("swap_total", swap_total); + res.SetIntKey("swap_free", swap_free); + res.SetIntKey("swap_used", swap_total - swap_free); + res.SetIntKey("dirty", dirty); + res.SetIntKey("reclaimable", reclaimable); + + NOTIMPLEMENTED(); + + return res; +} + +Value VmStatInfo::ToValue() const { + Value res(Value::Type::DICTIONARY); + res.SetIntKey("pswpin", pswpin); + res.SetIntKey("pswpout", pswpout); + res.SetIntKey("pgmajfault", pgmajfault); + + NOTIMPLEMENTED(); + + return res; +} + +SystemDiskInfo& SystemDiskInfo::operator=(const SystemDiskInfo&) = default; + +Value SystemDiskInfo::ToValue() const { + Value res(Value::Type::DICTIONARY); + + // Write out uint64_t variables as doubles. + // Note: this may discard some precision, but for JS there's no other option. + res.SetDoubleKey("reads", static_cast(reads)); + res.SetDoubleKey("reads_merged", static_cast(reads_merged)); + res.SetDoubleKey("sectors_read", static_cast(sectors_read)); + res.SetDoubleKey("read_time", static_cast(read_time)); + res.SetDoubleKey("writes", static_cast(writes)); + res.SetDoubleKey("writes_merged", static_cast(writes_merged)); + res.SetDoubleKey("sectors_written", static_cast(sectors_written)); + res.SetDoubleKey("write_time", static_cast(write_time)); + res.SetDoubleKey("io", static_cast(io)); + res.SetDoubleKey("io_time", static_cast(io_time)); + res.SetDoubleKey("weighted_io_time", static_cast(weighted_io_time)); + + NOTIMPLEMENTED(); + + return res; } } // namespace base diff --git a/www/iridium/files/patch-base_process_process__metrics__posix.cc b/www/iridium/files/patch-base_process_process__metrics__posix.cc index d44f4b8d2368..265511141d4e 100644 --- a/www/iridium/files/patch-base_process_process__metrics__posix.cc +++ b/www/iridium/files/patch-base_process_process__metrics__posix.cc @@ -1,20 +1,20 @@ ---- base/process/process_metrics_posix.cc.orig 2022-03-28 18:11:04 UTC +--- base/process/process_metrics_posix.cc.orig 2022-10-05 07:34:01 UTC +++ base/process/process_metrics_posix.cc @@ -20,6 +20,8 @@ #if BUILDFLAG(IS_APPLE) #include +#elif BUILDFLAG(IS_OPENBSD) +#include #else #include #endif -@@ -133,7 +135,7 @@ size_t ProcessMetrics::GetMallocUsage() { +@@ -135,7 +137,7 @@ size_t ProcessMetrics::GetMallocUsage() { return stats.size_in_use; #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) return GetMallocUsageMallinfo(); -#elif BUILDFLAG(IS_FUCHSIA) +#elif BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) // TODO(fuchsia): Not currently exposed. https://crbug.com/735087. return 0; #endif diff --git a/www/iridium/files/patch-base_process_process__metrics__unittest.cc b/www/iridium/files/patch-base_process_process__metrics__unittest.cc new file mode 100644 index 000000000000..570e0546750a --- /dev/null +++ b/www/iridium/files/patch-base_process_process__metrics__unittest.cc @@ -0,0 +1,20 @@ +--- base/process/process_metrics_unittest.cc.orig 2022-10-05 07:34:01 UTC ++++ base/process/process_metrics_unittest.cc +@@ -44,7 +44,7 @@ namespace debug { + + #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ + BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || \ +- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) ++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) + + namespace { + +@@ -347,7 +347,7 @@ TEST_F(SystemMetricsTest, ParseVmstat) { + + #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ + BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || \ +- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) ++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) + + // Test that ProcessMetrics::GetPlatformIndependentCPUUsage() doesn't return + // negative values when the number of threads running on the process decreases diff --git a/www/iridium/files/patch-base_process_process__posix.cc b/www/iridium/files/patch-base_process_process__posix.cc index fad21c5cbcdd..6387e90f381e 100644 --- a/www/iridium/files/patch-base_process_process__posix.cc +++ b/www/iridium/files/patch-base_process_process__posix.cc @@ -1,93 +1,93 @@ ---- base/process/process_posix.cc.orig 2022-04-01 07:48:30 UTC +--- base/process/process_posix.cc.orig 2022-10-05 07:34:01 UTC +++ base/process/process_posix.cc -@@ -23,10 +23,15 @@ +@@ -25,10 +25,15 @@ #include "build/build_config.h" #include "third_party/abseil-cpp/absl/types/optional.h" -#if BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) #include #endif +#if defined(OS_BSD) +#include +#include +#endif + #if BUILDFLAG(CLANG_PROFILING) #include "base/test/clang_profiling.h" #endif @@ -95,7 +100,7 @@ bool WaitpidWithTimeout(base::ProcessHandle handle, return ret_pid > 0; } -#if BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) // Using kqueue on Mac so that we can wait on non-child processes. // We can't use kqueues on child processes because we need to reap // our own children using wait. @@ -200,7 +205,7 @@ bool WaitForExitWithTimeoutImpl(base::ProcessHandle ha const bool exited = (parent_pid < 0); if (!exited && parent_pid != our_pid) { -#if BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) // On Mac we can wait on non child processes. return WaitForSingleNonChildProcess(handle, timeout); #else -@@ -356,7 +361,55 @@ void Process::Exited(int exit_code) const {} +@@ -392,7 +397,55 @@ void Process::Exited(int exit_code) const { int Process::GetPriority() const { DCHECK(IsValid()); +// avoid pledge(2) violation +#if defined(OS_BSD) + return 0; +#else - return getpriority(PRIO_PROCESS, process_); + return getpriority(PRIO_PROCESS, static_cast(process_)); +#endif +} + +Time Process::CreationTime() const { +// avoid ps pledge in the network process +#if !defined(OS_BSD) + int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid(), + sizeof(struct kinfo_proc), 0 }; + struct kinfo_proc *info = nullptr; + size_t info_size; +#endif + Time ct = Time(); + +#if !defined(OS_BSD) -+ if (sysctl(mib, base::size(mib), NULL, &info_size, NULL, 0) < 0) ++ if (sysctl(mib, std::size(mib), NULL, &info_size, NULL, 0) < 0) + goto out; + + mib[5] = (info_size / sizeof(struct kinfo_proc)); + if ((info = reinterpret_cast(malloc(info_size))) == NULL) + goto out; + -+ if (sysctl(mib, base::size(mib), info, &info_size, NULL, 0) < 0) ++ if (sysctl(mib, std::size(mib), info, &info_size, NULL, 0) < 0) + goto out; + + ct = Time::FromTimeT(info->p_ustart_sec); + +out: + if (info) + free(info); +#endif + return ct; +} + +bool Process::IsProcessBackgrounded() const { + return false; +} + +bool Process::SetProcessBackgrounded(bool value) { + return false; +} + +// static +bool Process::CanBackgroundProcesses() { + return false; } } // namespace base diff --git a/www/iridium/files/patch-base_process_process__unittest.cc b/www/iridium/files/patch-base_process_process__unittest.cc index 14d9b1c397ce..aaa7950d5119 100644 --- a/www/iridium/files/patch-base_process_process__unittest.cc +++ b/www/iridium/files/patch-base_process_process__unittest.cc @@ -1,11 +1,11 @@ ---- base/process/process_unittest.cc.orig 2022-03-28 18:11:04 UTC +--- base/process/process_unittest.cc.orig 2022-10-05 07:34:01 UTC +++ base/process/process_unittest.cc -@@ -140,7 +140,7 @@ TEST_F(ProcessTest, CreationTimeOtherProcess) { +@@ -193,7 +193,7 @@ TEST_F(ProcessTest, CreationTimeOtherProcess) { // was spawned and a time recorded after it was spawned. However, since the // base::Time and process creation clocks don't match, tolerate some error. constexpr base::TimeDelta kTolerance = -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // On Linux, process creation time is relative to boot time which has a // 1-second resolution. Tolerate 1 second for the imprecise boot time and // 100 ms for the imprecise clock. diff --git a/www/iridium/files/patch-base_profiler_module__cache.cc b/www/iridium/files/patch-base_profiler_module__cache.cc new file mode 100644 index 000000000000..10cb6f73f093 --- /dev/null +++ b/www/iridium/files/patch-base_profiler_module__cache.cc @@ -0,0 +1,11 @@ +--- base/profiler/module_cache.cc.orig 2022-10-05 07:34:01 UTC ++++ base/profiler/module_cache.cc +@@ -34,7 +34,7 @@ struct ModuleAddressCompare { + + std::string TransformModuleIDToBreakpadFormat(StringPiece module_id) { + std::string mangled_id(module_id); +-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) + // Linux ELF module IDs are 160bit integers, which we need to mangle + // down to 128bit integers to match the id that Breakpad outputs. + // Example on version '66.0.3359.170' x64: diff --git a/www/iridium/files/patch-base_profiler_stack__sampling__profiler__test__util.cc b/www/iridium/files/patch-base_profiler_stack__sampling__profiler__test__util.cc index fa3b6e11c0cc..fd49d6fc321b 100644 --- a/www/iridium/files/patch-base_profiler_stack__sampling__profiler__test__util.cc +++ b/www/iridium/files/patch-base_profiler_stack__sampling__profiler__test__util.cc @@ -1,11 +1,11 @@ ---- base/profiler/stack_sampling_profiler_test_util.cc.orig 2022-03-28 18:11:04 UTC +--- base/profiler/stack_sampling_profiler_test_util.cc.orig 2022-10-05 07:34:01 UTC +++ base/profiler/stack_sampling_profiler_test_util.cc -@@ -32,7 +32,7 @@ +@@ -39,7 +39,7 @@ // Fortunately, it provides _alloca, which functions identically. #include #define alloca _alloca -#else +#elif !BUILDFLAG(IS_BSD) #include #endif diff --git a/www/iridium/files/patch-base_rand__util.h b/www/iridium/files/patch-base_rand__util.h index ec7e3e73a069..34547895ab20 100644 --- a/www/iridium/files/patch-base_rand__util.h +++ b/www/iridium/files/patch-base_rand__util.h @@ -1,11 +1,11 @@ ---- base/rand_util.h.orig 2022-04-01 07:48:30 UTC +--- base/rand_util.h.orig 2022-10-05 07:34:01 UTC +++ base/rand_util.h -@@ -81,7 +81,7 @@ void RandomShuffle(Itr first, Itr last) { +@@ -80,7 +80,7 @@ void RandomShuffle(Itr first, Itr last) { std::shuffle(first, last, RandomBitGenerator()); } -#if BUILDFLAG(IS_POSIX) -+#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_OPENBSD) ++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_BSD) BASE_EXPORT int GetUrandomFD(); #endif diff --git a/www/iridium/files/patch-base_rand__util__posix.cc b/www/iridium/files/patch-base_rand__util__posix.cc index 7fd63f41875e..7802c8f04468 100644 --- a/www/iridium/files/patch-base_rand__util__posix.cc +++ b/www/iridium/files/patch-base_rand__util__posix.cc @@ -1,52 +1,57 @@ ---- base/rand_util_posix.cc.orig 2022-03-28 18:11:04 UTC +--- base/rand_util_posix.cc.orig 2022-10-05 07:34:01 UTC +++ base/rand_util_posix.cc -@@ -17,7 +17,7 @@ - #include "base/posix/eintr_wrapper.h" +@@ -22,7 +22,7 @@ + #include "base/time/time.h" #include "build/build_config.h" -#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_NACL) +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD) #include "third_party/lss/linux_syscall_support.h" #elif BUILDFLAG(IS_MAC) // TODO(crbug.com/995996): Waiting for this header to appear in the iOS SDK. -@@ -34,6 +34,7 @@ static constexpr int kOpenFlags = O_RDONLY; +@@ -39,6 +39,7 @@ static constexpr int kOpenFlags = O_RDONLY; static constexpr int kOpenFlags = O_RDONLY | O_CLOEXEC; #endif -+#if !BUILDFLAG(IS_OPENBSD) ++#if !BUILDFLAG(IS_BSD) // We keep the file descriptor for /dev/urandom around so we don't need to // reopen it (which is expensive), and since we may not even be able to reopen // it if we are later put in a sandbox. This class wraps the file descriptor so -@@ -51,6 +52,7 @@ class URandomFd { +@@ -56,10 +57,11 @@ class URandomFd { private: const int fd_; }; +#endif - } // namespace - -@@ -62,6 +64,7 @@ namespace base { + #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ + BUILDFLAG(IS_ANDROID)) && \ +- !BUILDFLAG(IS_NACL) ++ !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD) + // TODO(pasko): Unify reading kernel version numbers in: + // mojo/core/channel_linux.cc + // chrome/browser/android/seccomp_support_detector.cc +@@ -144,6 +146,7 @@ void ConfigureRandBytesFieldTrial() { // (https://chromium-review.googlesource.com/c/chromium/src/+/1545096) and land // it or some form of it. void RandBytes(void* output, size_t output_length) { -+#if !BUILDFLAG(IS_OPENBSD) - #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_NACL) - // We have to call `getrandom` via Linux Syscall Support, rather than through - // the libc wrapper, because we might not have an up-to-date libc (e.g. on -@@ -93,11 +96,16 @@ void RandBytes(void* output, size_t output_length) { ++#if !BUILDFLAG(IS_BSD) + #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ + BUILDFLAG(IS_ANDROID)) && \ + !BUILDFLAG(IS_NACL) +@@ -172,11 +175,16 @@ void RandBytes(void* output, size_t output_length) { const bool success = ReadFromFD(urandom_fd, static_cast(output), output_length); CHECK(success); +#else + arc4random_buf(static_cast(output), output_length); +#endif } -+#if !BUILDFLAG(IS_OPENBSD) ++#if !BUILDFLAG(IS_BSD) int GetUrandomFD() { static NoDestructor urandom_fd; return urandom_fd->fd(); } +#endif } // namespace base diff --git a/www/iridium/files/patch-base_strings_safe__sprintf__unittest.cc b/www/iridium/files/patch-base_strings_safe__sprintf__unittest.cc index 4c9c6535d3a4..c3eb254f5229 100644 --- a/www/iridium/files/patch-base_strings_safe__sprintf__unittest.cc +++ b/www/iridium/files/patch-base_strings_safe__sprintf__unittest.cc @@ -1,18 +1,18 @@ ---- base/strings/safe_sprintf_unittest.cc.orig 2022-03-28 18:11:04 UTC +--- base/strings/safe_sprintf_unittest.cc.orig 2022-10-05 07:34:01 UTC +++ base/strings/safe_sprintf_unittest.cc -@@ -731,6 +731,7 @@ TEST(SafeSPrintfTest, EmbeddedNul) { +@@ -732,6 +732,7 @@ TEST(SafeSPrintfTest, EmbeddedNul) { #endif } +#if !BUILDFLAG(IS_BSD) TEST(SafeSPrintfTest, EmitNULL) { char buf[40]; #if defined(__GNUC__) -@@ -747,6 +748,7 @@ TEST(SafeSPrintfTest, EmitNULL) { +@@ -748,6 +749,7 @@ TEST(SafeSPrintfTest, EmitNULL) { #pragma GCC diagnostic pop #endif } +#endif TEST(SafeSPrintfTest, PointerSize) { // The internal data representation is a 64bit value, independent of the diff --git a/www/iridium/files/patch-base_synchronization_lock__impl.h b/www/iridium/files/patch-base_synchronization_lock__impl.h index 6e3d7c31cacd..18c7f2e03d90 100644 --- a/www/iridium/files/patch-base_synchronization_lock__impl.h +++ b/www/iridium/files/patch-base_synchronization_lock__impl.h @@ -1,23 +1,23 @@ ---- base/synchronization/lock_impl.h.orig 2022-03-28 18:11:04 UTC +--- base/synchronization/lock_impl.h.orig 2022-10-05 07:34:01 UTC +++ base/synchronization/lock_impl.h @@ -107,6 +107,10 @@ void LockImpl::Unlock() { } #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) +#if BUILDFLAG(IS_FREEBSD) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wthread-safety-analysis" +#endif - BASE_EXPORT std::string SystemErrorCodeToString(int error_code); - -@@ -121,6 +125,9 @@ void LockImpl::Unlock() { - int rv = pthread_mutex_unlock(&native_handle_); - DCHECK_EQ(rv, 0) << ". " << strerror(rv); + #if DCHECK_IS_ON() + BASE_EXPORT void dcheck_trylock_result(int rv); +@@ -127,6 +131,9 @@ void LockImpl::Unlock() { + dcheck_unlock_result(rv); + #endif } +#if BUILDFLAG(IS_FREEBSD) +#pragma GCC diagnostic pop +#endif #endif // This is an implementation used for AutoLock templated on the lock type. diff --git a/www/iridium/files/patch-base_system_sys__info.cc b/www/iridium/files/patch-base_system_sys__info.cc index f9e54ea0272d..3578f2ba09bc 100644 --- a/www/iridium/files/patch-base_system_sys__info.cc +++ b/www/iridium/files/patch-base_system_sys__info.cc @@ -1,11 +1,11 @@ ---- base/system/sys_info.cc.orig 2022-03-28 18:11:04 UTC +--- base/system/sys_info.cc.orig 2022-10-05 07:34:01 UTC +++ base/system/sys_info.cc -@@ -100,7 +100,7 @@ void SysInfo::GetHardwareInfo(base::OnceCallback callback) { +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) + constexpr base::TaskTraits kTraits = {base::MayBlock()}; + #else + constexpr base::TaskTraits kTraits = {}; diff --git a/www/iridium/files/patch-base_system_sys__info.h b/www/iridium/files/patch-base_system_sys__info.h index d8fcacba9d2d..bd0fd5af06cf 100644 --- a/www/iridium/files/patch-base_system_sys__info.h +++ b/www/iridium/files/patch-base_system_sys__info.h @@ -1,20 +1,20 @@ ---- base/system/sys_info.h.orig 2022-03-28 18:11:04 UTC +--- base/system/sys_info.h.orig 2022-10-05 07:34:01 UTC +++ base/system/sys_info.h -@@ -212,6 +212,8 @@ class BASE_EXPORT SysInfo { +@@ -211,6 +211,8 @@ class BASE_EXPORT SysInfo { // On Desktop this returns true when memory <= 2GB. static bool IsLowEndDevice(); + static uint64_t MaxSharedMemorySize(); + private: FRIEND_TEST_ALL_PREFIXES(SysInfoTest, AmountOfAvailablePhysicalMemory); FRIEND_TEST_ALL_PREFIXES(debug::SystemMetricsTest, ParseMeminfo); -@@ -222,7 +224,7 @@ class BASE_EXPORT SysInfo { +@@ -221,7 +223,7 @@ class BASE_EXPORT SysInfo { static HardwareInfo GetHardwareInfoSync(); #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ - BUILDFLAG(IS_AIX) + BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) - static int64_t AmountOfAvailablePhysicalMemory( + static uint64_t AmountOfAvailablePhysicalMemory( const SystemMemoryInfoKB& meminfo); #endif diff --git a/www/iridium/files/patch-base_system_sys__info__freebsd.cc b/www/iridium/files/patch-base_system_sys__info__freebsd.cc index 5b3e2081df7b..d77a0e55a002 100644 --- a/www/iridium/files/patch-base_system_sys__info__freebsd.cc +++ b/www/iridium/files/patch-base_system_sys__info__freebsd.cc @@ -1,113 +1,115 @@ ---- base/system/sys_info_freebsd.cc.orig 2022-03-28 20:16:21 UTC +--- base/system/sys_info_freebsd.cc.orig 2022-10-05 07:34:01 UTC +++ base/system/sys_info_freebsd.cc @@ -9,30 +9,106 @@ #include #include "base/notreached.h" +#include "base/process/process_metrics.h" +#include "base/strings/string_util.h" namespace base { +-int64_t SysInfo::AmountOfPhysicalMemoryImpl() { +- int pages, page_size; +int SysInfo::NumberOfProcessors() { + int mib[] = {CTL_HW, HW_NCPU}; + int ncpu; + size_t size = sizeof(ncpu); -+ if (sysctl(mib, base::size(mib), &ncpu, &size, NULL, 0) < 0) { ++ if (sysctl(mib, std::size(mib), &ncpu, &size, NULL, 0) < 0) { + NOTREACHED(); + return 1; + } + return ncpu; +} + - int64_t SysInfo::AmountOfPhysicalMemoryImpl() { -- int pages, page_size; ++uint64_t SysInfo::AmountOfPhysicalMemoryImpl() { + int pages, page_size, r = 0; size_t size = sizeof(pages); - sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0); - sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0); - if (pages == -1 || page_size == -1) { + + if (r == 0) + r = sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0); + if (r == 0) + r = sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0); + + if (r == -1) { NOTREACHED(); return 0; } +- return static_cast(pages) * page_size; + - return static_cast(pages) * page_size; ++ return static_cast(pages) * page_size; } -+int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { ++uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { + int page_size, r = 0; + unsigned int pgfree, pginact, pgcache; + size_t size = sizeof(page_size); + size_t szpg = sizeof(pgfree); + + if (r == 0) + r = sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0); + if (r == 0) + r = sysctlbyname("vm.stats.vm.v_free_count", &pgfree, &szpg, NULL, 0); + if (r == 0) + r = sysctlbyname("vm.stats.vm.v_inactive_count", &pginact, &szpg, NULL, 0); + if (r == 0) + r = sysctlbyname("vm.stats.vm.v_cache_count", &pgcache, &szpg, NULL, 0); + + if (r == -1) { + NOTREACHED(); + return 0; + } + -+ return static_cast((pgfree + pginact + pgcache) * page_size); ++ return static_cast((pgfree + pginact + pgcache) * page_size); +} + // static -+int64_t SysInfo::AmountOfAvailablePhysicalMemory(const SystemMemoryInfoKB& info) { -+ int64_t res_kb = info.available != 0 ++uint64_t SysInfo::AmountOfAvailablePhysicalMemory(const SystemMemoryInfoKB& info) { ++ uint64_t res_kb = info.available != 0 + ? info.available - info.active_file + : info.free + info.reclaimable + info.inactive_file; + return res_kb * 1024; +} + +// static +std::string SysInfo::CPUModelName() { + int mib[] = { CTL_HW, HW_MODEL }; + char name[256]; -+ size_t size = base::size(name); ++ size_t size = std::size(name); + -+ if (sysctl(mib, base::size(mib), &name, &size, NULL, 0) == 0) { ++ if (sysctl(mib, std::size(mib), &name, &size, NULL, 0) == 0) { + return name; + } + + return std::string(); +} + +// static uint64_t SysInfo::MaxSharedMemorySize() { size_t limit; size_t size = sizeof(limit); + if (sysctlbyname("kern.ipc.shmmax", &limit, &size, NULL, 0) < 0) { NOTREACHED(); return 0; } + return static_cast(limit); +} + +SysInfo::HardwareInfo SysInfo::GetHardwareInfoSync() { + HardwareInfo info; + + info.manufacturer = "FreeBSD"; + info.model = HardwareModelName(); + + DCHECK(IsStringUTF8(info.manufacturer)); + DCHECK(IsStringUTF8(info.model)); + + return info; } } // namespace base diff --git a/www/iridium/files/patch-base_system_sys__info__openbsd.cc b/www/iridium/files/patch-base_system_sys__info__openbsd.cc index 61fad82c015d..2173b6657c69 100644 --- a/www/iridium/files/patch-base_system_sys__info__openbsd.cc +++ b/www/iridium/files/patch-base_system_sys__info__openbsd.cc @@ -1,102 +1,94 @@ ---- base/system/sys_info_openbsd.cc.orig 2022-03-28 18:11:04 UTC +--- base/system/sys_info_openbsd.cc.orig 2022-10-05 07:34:01 UTC +++ base/system/sys_info_openbsd.cc -@@ -12,6 +12,7 @@ +@@ -11,6 +11,7 @@ + #include - #include "base/cxx17_backports.h" #include "base/notreached.h" +#include "base/strings/string_util.h" namespace { -@@ -29,9 +30,15 @@ int64_t AmountOfMemory(int pages_name) { +@@ -26,9 +27,15 @@ uint64_t AmountOfMemory(int pages_name) { namespace base { +// pledge(2) +int64_t aofpmem = 0; +int64_t aofapmem = 0; +int64_t shmmax = 0; +char cpumodel[256]; + // static int SysInfo::NumberOfProcessors() { - int mib[] = {CTL_HW, HW_NCPU}; + int mib[] = {CTL_HW, HW_NCPUONLINE}; int ncpu; size_t size = sizeof(ncpu); - if (sysctl(mib, base::size(mib), &ncpu, &size, NULL, 0) < 0) { -@@ -43,38 +50,62 @@ int SysInfo::NumberOfProcessors() { + if (sysctl(mib, std::size(mib), &ncpu, &size, NULL, 0) < 0) { +@@ -40,10 +47,26 @@ int SysInfo::NumberOfProcessors() { // static - int64_t SysInfo::AmountOfPhysicalMemoryImpl() { + uint64_t SysInfo::AmountOfPhysicalMemoryImpl() { - return AmountOfMemory(_SC_PHYS_PAGES); + // pledge(2) + if (!aofpmem) + aofpmem = AmountOfMemory(_SC_PHYS_PAGES); + return aofpmem; } - // static - int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { - // We should add inactive file-backed memory also but there is no such - // information from OpenBSD unfortunately. -- return AmountOfMemory(_SC_AVPHYS_PAGES); -+ // pledge(2) -+ if (!aofapmem) -+ aofapmem = AmountOfMemory(_SC_AVPHYS_PAGES); -+ return aofapmem; - } - // static +std::string SysInfo::CPUModelName() { + int mib[] = {CTL_HW, HW_MODEL}; -+ size_t len = base::size(cpumodel); ++ size_t len = std::size(cpumodel); + + if (cpumodel[0] == '\0') { -+ if (sysctl(mib, base::size(mib), cpumodel, &len, NULL, 0) < 0) ++ if (sysctl(mib, std::size(mib), cpumodel, &len, NULL, 0) < 0) + return std::string(); + } + + return std::string(cpumodel, len - 1); +} + +// static - uint64_t SysInfo::MaxSharedMemorySize() { + uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { + // We should add inactive file-backed memory also but there is no such + // information from OpenBSD unfortunately. +@@ -55,23 +78,28 @@ uint64_t SysInfo::MaxSharedMemorySize() { int mib[] = {CTL_KERN, KERN_SHMINFO, KERN_SHMINFO_SHMMAX}; size_t limit; size_t size = sizeof(limit); + // pledge(2) + if (shmmax) + goto out; - if (sysctl(mib, base::size(mib), &limit, &size, NULL, 0) < 0) { + if (sysctl(mib, std::size(mib), &limit, &size, NULL, 0) < 0) { NOTREACHED(); return 0; } - return static_cast(limit); + shmmax = static_cast(limit); +out: + return shmmax; } // static -std::string SysInfo::CPUModelName() { - int mib[] = {CTL_HW, HW_MODEL}; - char name[256]; -- size_t len = base::size(name); -- if (sysctl(mib, base::size(mib), name, &len, NULL, 0) < 0) { +- size_t len = std::size(name); +- if (sysctl(mib, std::size(mib), name, &len, NULL, 0) < 0) { - NOTREACHED(); - return std::string(); - } - return name; +SysInfo::HardwareInfo SysInfo::GetHardwareInfoSync() { + HardwareInfo info; + // Set the manufacturer to "OpenBSD" and the model to + // an empty string. + info.manufacturer = "OpenBSD"; + info.model = HardwareModelName(); + DCHECK(IsStringUTF8(info.manufacturer)); + DCHECK(IsStringUTF8(info.model)); + return info; } } // namespace base diff --git a/www/iridium/files/patch-base_system_sys__info__posix.cc b/www/iridium/files/patch-base_system_sys__info__posix.cc index dd2fa9a623b6..71fd898b27bb 100644 --- a/www/iridium/files/patch-base_system_sys__info__posix.cc +++ b/www/iridium/files/patch-base_system_sys__info__posix.cc @@ -1,43 +1,43 @@ ---- base/system/sys_info_posix.cc.orig 2022-03-28 20:16:21 UTC +--- base/system/sys_info_posix.cc.orig 2022-10-05 07:34:01 UTC +++ base/system/sys_info_posix.cc @@ -37,7 +37,7 @@ namespace { -#if !BUILDFLAG(IS_OPENBSD) +#if !BUILDFLAG(IS_BSD) int NumberOfProcessors() { // sysconf returns the number of "logical" (not "physical") processors on both // Mac and Linux. So we get the number of max available "logical" processors. @@ -77,7 +77,7 @@ int NumberOfProcessors() { base::LazyInstance>:: Leaky g_lazy_number_of_processors = LAZY_INSTANCE_INITIALIZER; -#endif // !BUILDFLAG(IS_OPENBSD) +#endif // !BUILDFLAG(IS_BSD) - int64_t AmountOfVirtualMemory() { + uint64_t AmountOfVirtualMemory() { struct rlimit limit; -@@ -143,11 +143,11 @@ bool GetDiskSpaceInfo(const base::FilePath& path, +@@ -144,11 +144,11 @@ bool GetDiskSpaceInfo(const base::FilePath& path, namespace base { -#if !BUILDFLAG(IS_OPENBSD) +#if !BUILDFLAG(IS_BSD) int SysInfo::NumberOfProcessors() { return g_lazy_number_of_processors.Get().value(); } -#endif // !BUILDFLAG(IS_OPENBSD) +#endif // !BUILDFLAG(IS_BSD) // static - int64_t SysInfo::AmountOfVirtualMemory() { -@@ -239,6 +239,8 @@ std::string SysInfo::OperatingSystemArchitecture() { + uint64_t SysInfo::AmountOfVirtualMemory() { +@@ -238,6 +238,8 @@ std::string SysInfo::OperatingSystemArchitecture() { arch = "x86"; } else if (arch == "amd64") { arch = "x86_64"; + } else if (arch == "arm64") { + arch = "aarch64"; } else if (std::string(info.sysname) == "AIX") { arch = "ppc64"; } diff --git a/www/iridium/files/patch-base_system_sys__info__unittest.cc b/www/iridium/files/patch-base_system_sys__info__unittest.cc index ee7a0ff79e30..04c9153a61aa 100644 --- a/www/iridium/files/patch-base_system_sys__info__unittest.cc +++ b/www/iridium/files/patch-base_system_sys__info__unittest.cc @@ -1,19 +1,20 @@ ---- base/system/sys_info_unittest.cc.orig 2022-04-01 07:48:30 UTC +--- base/system/sys_info_unittest.cc.orig 2022-10-05 07:34:01 UTC +++ base/system/sys_info_unittest.cc -@@ -234,12 +234,15 @@ TEST_F(SysInfoTest, GetHardwareInfo) { +@@ -234,12 +234,16 @@ TEST_F(SysInfoTest, GetHardwareInfo) { EXPECT_TRUE(IsStringUTF8(hardware_info->model)); bool empty_result_expected = #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN) || \ -- BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) -+ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) +- BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) ++ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || \ ++ BUILDFLAG(IS_BSD) false; #else true; #endif EXPECT_EQ(hardware_info->manufacturer.empty(), empty_result_expected); +#if BUILDFLAG(IS_BSD) + empty_result_expected = true; +#endif EXPECT_EQ(hardware_info->model.empty(), empty_result_expected); } diff --git a/www/iridium/files/patch-base_task_thread__pool_environment__config__unittest.cc b/www/iridium/files/patch-base_task_thread__pool_environment__config__unittest.cc index 910875d45076..b8f261c47475 100644 --- a/www/iridium/files/patch-base_task_thread__pool_environment__config__unittest.cc +++ b/www/iridium/files/patch-base_task_thread__pool_environment__config__unittest.cc @@ -1,11 +1,11 @@ ---- base/task/thread_pool/environment_config_unittest.cc.orig 2022-03-28 18:11:04 UTC +--- base/task/thread_pool/environment_config_unittest.cc.orig 2022-10-05 07:34:01 UTC +++ base/task/thread_pool/environment_config_unittest.cc @@ -15,7 +15,7 @@ TEST(ThreadPoolEnvironmentConfig, CanUseBackgroundPrio #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) - EXPECT_TRUE(CanUseBackgroundPriorityForWorkerThread()); + EXPECT_TRUE(CanUseBackgroundThreadTypeForWorkerThread()); #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \ - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_NACL) + BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_NACL) || BUILDFLAG(IS_BSD) - EXPECT_FALSE(CanUseBackgroundPriorityForWorkerThread()); + EXPECT_FALSE(CanUseBackgroundThreadTypeForWorkerThread()); #else #error Platform doesn't match any block diff --git a/www/iridium/files/patch-base_test_launcher_test__launcher.cc b/www/iridium/files/patch-base_test_launcher_test__launcher.cc index 366b37facec0..0a84917716cb 100644 --- a/www/iridium/files/patch-base_test_launcher_test__launcher.cc +++ b/www/iridium/files/patch-base_test_launcher_test__launcher.cc @@ -1,10 +1,10 @@ ---- base/test/launcher/test_launcher.cc.orig 2022-03-28 18:11:04 UTC +--- base/test/launcher/test_launcher.cc.orig 2022-10-05 07:34:01 UTC +++ base/test/launcher/test_launcher.cc -@@ -63,6 +63,7 @@ - #include "testing/gtest/include/gtest/gtest.h" +@@ -65,6 +65,7 @@ + #include "third_party/libxml/chromium/libxml_utils.h" #if BUILDFLAG(IS_POSIX) +#include #include #include "base/files/file_descriptor_watcher_posix.h" diff --git a/www/iridium/files/patch-base_threading_platform__thread.h b/www/iridium/files/patch-base_threading_platform__thread.h index 4b73c3095a50..cf922ccae694 100644 --- a/www/iridium/files/patch-base_threading_platform__thread.h +++ b/www/iridium/files/patch-base_threading_platform__thread.h @@ -1,11 +1,11 @@ ---- base/threading/platform_thread.h.orig 2022-03-28 18:11:04 UTC +--- base/threading/platform_thread.h.orig 2022-10-05 07:34:01 UTC +++ base/threading/platform_thread.h -@@ -205,7 +205,7 @@ class BASE_EXPORT PlatformThread { +@@ -253,7 +253,7 @@ class BASE_EXPORT PlatformThread { // Returns a realtime period provided by `delegate`. static TimeDelta GetRealtimePeriod(Delegate* delegate); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) - // Toggles a specific thread's priority at runtime. This can be used to + // Toggles a specific thread's type at runtime. This can be used to // change the priority of a thread in a different process and will fail // if the calling process does not have proper permissions. The diff --git a/www/iridium/files/patch-base_threading_platform__thread__linux.cc b/www/iridium/files/patch-base_threading_platform__thread__linux.cc index 73ba928f2ecd..cda41bdd934d 100644 --- a/www/iridium/files/patch-base_threading_platform__thread__linux.cc +++ b/www/iridium/files/patch-base_threading_platform__thread__linux.cc @@ -1,77 +1,77 @@ ---- base/threading/platform_thread_linux.cc.orig 2022-03-28 18:11:04 UTC +--- base/threading/platform_thread_linux.cc.orig 2022-10-05 07:34:01 UTC +++ base/threading/platform_thread_linux.cc @@ -29,7 +29,9 @@ #if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_AIX) #include +#if !BUILDFLAG(IS_BSD) #include +#endif #include #include #include -@@ -132,7 +134,7 @@ int sched_setattr(pid_t pid, +@@ -132,7 +134,7 @@ long sched_setattr(pid_t pid, #endif // !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_AIX) - #endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) + #endif // BUILDFLAG(IS_CHROMEOS) -#if !BUILDFLAG(IS_NACL) +#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD) const FilePath::CharType kCgroupDirectory[] = FILE_PATH_LITERAL("/sys/fs/cgroup"); -@@ -286,7 +288,7 @@ void SetThreadCgroupsForThreadPriority(PlatformThreadI +@@ -304,7 +306,7 @@ void SetThreadCgroupsForThreadType(PlatformThreadId th namespace internal { namespace { -#if !BUILDFLAG(IS_NACL) +#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD) const struct sched_param kRealTimePrio = {8}; #endif } // namespace -@@ -299,7 +301,7 @@ const ThreadPriorityToNiceValuePair kThreadPriorityToN +@@ -330,7 +332,7 @@ const ThreadTypeToNiceValuePair kThreadTypeToNiceValue }; - bool CanSetThreadPriorityToRealtimeAudio() { + bool CanSetThreadTypeToRealtimeAudio() { -#if !BUILDFLAG(IS_NACL) +#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD) // A non-zero soft-limit on RLIMIT_RTPRIO is required to be allowed to invoke - // pthread_setschedparam in SetCurrentThreadPriorityForPlatform(). + // pthread_setschedparam in SetCurrentThreadTypeForPlatform(). struct rlimit rlim; -@@ -310,7 +312,7 @@ bool CanSetThreadPriorityToRealtimeAudio() { - } +@@ -342,7 +344,7 @@ bool CanSetThreadTypeToRealtimeAudio() { - bool SetCurrentThreadPriorityForPlatform(ThreadPriority priority) { + bool SetCurrentThreadTypeForPlatform(ThreadType thread_type, + MessagePumpType pump_type_hint) { -#if !BUILDFLAG(IS_NACL) +#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD) // For legacy schedtune interface - SetThreadCgroupsForThreadPriority(PlatformThread::CurrentId(), priority); + SetThreadCgroupsForThreadType(PlatformThread::CurrentId(), thread_type); -@@ -328,7 +330,7 @@ bool SetCurrentThreadPriorityForPlatform(ThreadPriorit - } +@@ -361,7 +363,7 @@ bool SetCurrentThreadTypeForPlatform(ThreadType thread - absl::optional GetCurrentThreadPriorityForPlatform() { + absl::optional + GetCurrentThreadPriorityForPlatformForTest() { -#if !BUILDFLAG(IS_NACL) +#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD) int maybe_sched_rr = 0; struct sched_param maybe_realtime_prio = {0}; if (pthread_getschedparam(pthread_self(), &maybe_sched_rr, -@@ -347,7 +349,7 @@ absl::optional GetCurrentThreadPriorit +@@ -380,7 +382,7 @@ GetCurrentThreadPriorityForPlatformForTest() { void PlatformThread::SetName(const std::string& name) { ThreadIdNameManager::GetInstance()->SetName(name); -#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_AIX) +#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_AIX) && !BUILDFLAG(IS_BSD) // On linux we can get the thread names to show up in the debugger by setting // the process name for the LWP. We don't want to do this for the main // thread because that would rename the process, causing tools like killall -@@ -377,8 +379,10 @@ void PlatformThread::SetThreadPriority(ProcessId proce +@@ -410,8 +412,10 @@ void PlatformThread::SetThreadType(ProcessId process_i // priority. CHECK_NE(thread_id, process_id); +#if !BUILDFLAG(IS_BSD) // For legacy schedtune interface - SetThreadCgroupsForThreadPriority(thread_id, priority); + SetThreadCgroupsForThreadType(thread_id, thread_type); +#endif - #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) + #if BUILDFLAG(IS_CHROMEOS) // For upstream uclamp interface. We try both legacy (schedtune, as done diff --git a/www/iridium/files/patch-base_threading_platform__thread__posix.cc b/www/iridium/files/patch-base_threading_platform__thread__posix.cc index a1da3065d379..26de09a430fb 100644 --- a/www/iridium/files/patch-base_threading_platform__thread__posix.cc +++ b/www/iridium/files/patch-base_threading_platform__thread__posix.cc @@ -1,21 +1,21 @@ ---- base/threading/platform_thread_posix.cc.orig 2022-03-28 18:11:04 UTC +--- base/threading/platform_thread_posix.cc.orig 2022-10-05 07:34:01 UTC +++ base/threading/platform_thread_posix.cc -@@ -75,7 +75,7 @@ void* ThreadFunc(void* params) { +@@ -76,7 +76,7 @@ void* ThreadFunc(void* params) { if (!thread_params->joinable) base::DisallowSingleton(); -#if !BUILDFLAG(IS_NACL) +#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD) #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) - internal::PCScan::NotifyThreadCreated(internal::GetStackPointer()); - #endif -@@ -362,6 +362,9 @@ bool PlatformThread::CanChangeThreadPriority(ThreadPri - // static - void PlatformThread::SetCurrentThreadPriorityImpl(ThreadPriority priority) { + partition_alloc::internal::PCScan::NotifyThreadCreated( + partition_alloc::internal::GetStackPointer()); +@@ -371,6 +371,9 @@ namespace internal { + void SetCurrentThreadTypeImpl(ThreadType thread_type, + MessagePumpType pump_type_hint) { #if BUILDFLAG(IS_NACL) + NOTIMPLEMENTED(); +// avoid pledge(2) violation +#elif BUILDFLAG(IS_BSD) NOTIMPLEMENTED(); #else - if (internal::SetCurrentThreadPriorityForPlatform(priority)) + if (internal::SetCurrentThreadTypeForPlatform(thread_type, pump_type_hint)) diff --git a/www/iridium/files/patch-base_threading_platform__thread__unittest.cc b/www/iridium/files/patch-base_threading_platform__thread__unittest.cc index 63ece48accfb..ff2ce9c6629e 100644 --- a/www/iridium/files/patch-base_threading_platform__thread__unittest.cc +++ b/www/iridium/files/patch-base_threading_platform__thread__unittest.cc @@ -1,47 +1,47 @@ ---- base/threading/platform_thread_unittest.cc.orig 2022-03-28 18:11:04 UTC +--- base/threading/platform_thread_unittest.cc.orig 2022-10-05 07:34:01 UTC +++ base/threading/platform_thread_unittest.cc -@@ -30,7 +30,7 @@ +@@ -31,7 +31,7 @@ #include "base/time/time.h" #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include #include #include -@@ -319,7 +319,7 @@ TEST(PlatformThreadTest, +@@ -417,7 +417,7 @@ TEST(PlatformThreadTest, // and hardcodes what we know. Please inform scheduler-dev@chromium.org if this // proprerty changes for a given platform. - TEST(PlatformThreadTest, CanChangeThreadPriority) { + TEST(PlatformThreadTest, CanChangeThreadType) { -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // On Ubuntu, RLIMIT_NICE and RLIMIT_RTPRIO are 0 by default, so we won't be // able to increase priority to any level. constexpr bool kCanIncreasePriority = false; -@@ -417,7 +417,7 @@ TEST(PlatformThreadTest, SetHugeThreadName) { +@@ -523,7 +523,7 @@ TEST(PlatformThreadTest, SetHugeThreadName) { TEST(PlatformThreadTest, GetDefaultThreadStackSize) { size_t stack_size = PlatformThread::GetDefaultThreadStackSize(); #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA) || \ - ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \ + ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \ !defined(THREAD_SANITIZER)) || \ (BUILDFLAG(IS_ANDROID) && !defined(ADDRESS_SANITIZER)) EXPECT_EQ(0u, stack_size); -@@ -578,12 +578,16 @@ INSTANTIATE_TEST_SUITE_P( +@@ -684,12 +684,16 @@ INSTANTIATE_TEST_SUITE_P( #endif // BUILDFLAG(IS_APPLE) -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) namespace { bool IsTidCacheCorrect() { +#if BUILDFLAG(IS_BSD) + return PlatformThread::CurrentId() == reinterpret_cast(pthread_self()); +#else return PlatformThread::CurrentId() == syscall(__NR_gettid); +#endif } void* CheckTidCacheCorrectWrapper(void*) { diff --git a/www/iridium/files/patch-base_time_time.cc b/www/iridium/files/patch-base_time_time.cc deleted file mode 100644 index 55fa87eab2ab..000000000000 --- a/www/iridium/files/patch-base_time_time.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- base/time/time.cc.orig 2022-03-28 18:11:04 UTC -+++ base/time/time.cc -@@ -6,7 +6,7 @@ - - #include "build/build_config.h" - --#if BUILDFLAG(IS_LINUX) -+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) - // time.h is a widely included header and its size impacts build time. - // Try not to raise this limit unless necessary. See - // https://chromium.googlesource.com/chromium/src/+/HEAD/docs/wmax_tokens.md diff --git a/www/iridium/files/patch-base_trace__event_malloc__dump__provider.cc b/www/iridium/files/patch-base_trace__event_malloc__dump__provider.cc index f63ff384e6c7..51351ba7b885 100644 --- a/www/iridium/files/patch-base_trace__event_malloc__dump__provider.cc +++ b/www/iridium/files/patch-base_trace__event_malloc__dump__provider.cc @@ -1,21 +1,30 @@ ---- base/trace_event/malloc_dump_provider.cc.orig 2022-03-28 18:11:04 UTC +--- base/trace_event/malloc_dump_provider.cc.orig 2022-10-05 07:34:01 UTC +++ base/trace_event/malloc_dump_provider.cc -@@ -23,6 +23,8 @@ +@@ -24,6 +24,8 @@ #if BUILDFLAG(IS_APPLE) #include +#elif defined(OS_BSD) +#include #else #include #endif -@@ -220,6 +222,9 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDump +@@ -185,7 +187,7 @@ void ReportAppleAllocStats(size_t* total_virtual_size, + + #if (BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && BUILDFLAG(IS_ANDROID)) || \ + (!BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && !BUILDFLAG(IS_WIN) && \ +- !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_FUCHSIA)) ++ !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_BSD)) + void ReportMallinfoStats(ProcessMemoryDump* pmd, + size_t* total_virtual_size, + size_t* resident_size, +@@ -356,6 +358,9 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDump &allocated_objects_count); #elif BUILDFLAG(IS_FUCHSIA) // TODO(fuchsia): Port, see https://crbug.com/706592. +#elif defined(OS_BSD) + total_virtual_size = 0; + allocated_objects_size = 0; #else - #if defined(__GLIBC__) && defined(__GLIBC_PREREQ) - #if __GLIBC_PREREQ(2, 33) + ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size, + &allocated_objects_size, &allocated_objects_count); diff --git a/www/iridium/files/patch-base_trace__event_process__memory__dump.cc b/www/iridium/files/patch-base_trace__event_process__memory__dump.cc index 08e934edeaf5..9229adeb5728 100644 --- a/www/iridium/files/patch-base_trace__event_process__memory__dump.cc +++ b/www/iridium/files/patch-base_trace__event_process__memory__dump.cc @@ -1,20 +1,20 @@ ---- base/trace_event/process_memory_dump.cc.orig 2022-03-28 18:11:04 UTC +--- base/trace_event/process_memory_dump.cc.orig 2022-10-05 07:34:01 UTC +++ base/trace_event/process_memory_dump.cc -@@ -105,7 +105,7 @@ absl::optional ProcessMemoryDump::CountResiden +@@ -112,7 +112,7 @@ absl::optional ProcessMemoryDump::CountResiden #if BUILDFLAG(IS_WIN) std::unique_ptr vec( new PSAPI_WORKING_SET_EX_INFORMATION[max_vec_size]); -#elif BUILDFLAG(IS_APPLE) +#elif BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD) std::unique_ptr vec(new char[max_vec_size]); #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) std::unique_ptr vec(new unsigned char[max_vec_size]); -@@ -130,7 +130,7 @@ absl::optional ProcessMemoryDump::CountResiden +@@ -134,7 +134,7 @@ absl::optional ProcessMemoryDump::CountResiden for (size_t i = 0; i < page_count; i++) resident_page_count += vec[i].VirtualAttributes.Valid; -#elif BUILDFLAG(IS_FUCHSIA) +#elif BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) - // TODO(fuchsia): Port, see https://crbug.com/706592. - #elif BUILDFLAG(IS_APPLE) - // mincore in MAC does not fail with EAGAIN. + // TODO(crbug.com/851760): Implement counting resident bytes. + // For now, log and avoid unused variable warnings. + NOTIMPLEMENTED_LOG_ONCE(); diff --git a/www/iridium/files/patch-build_config_BUILD.gn b/www/iridium/files/patch-build_config_BUILD.gn index 64b201f66c3d..fb4eefa994cf 100644 --- a/www/iridium/files/patch-build_config_BUILD.gn +++ b/www/iridium/files/patch-build_config_BUILD.gn @@ -1,22 +1,22 @@ ---- build/config/BUILD.gn.orig 2022-03-28 18:11:04 UTC +--- build/config/BUILD.gn.orig 2022-10-05 07:34:01 UTC +++ build/config/BUILD.gn -@@ -218,13 +218,17 @@ config("default_libs") { +@@ -215,13 +215,17 @@ config("default_libs") { "CoreText.framework", "Foundation.framework", ] - } else if (is_linux || is_chromeos) { + } else if ((is_linux && !is_bsd) || is_chromeos) { libs = [ "dl", "pthread", "rt", ] - } + } else if (is_bsd) { + libs = [ + "pthread", + ] + } } group("common_deps") { diff --git a/www/iridium/files/patch-build_config_BUILDCONFIG.gn b/www/iridium/files/patch-build_config_BUILDCONFIG.gn index c209822d3d1d..5cc6d67c416e 100644 --- a/www/iridium/files/patch-build_config_BUILDCONFIG.gn +++ b/www/iridium/files/patch-build_config_BUILDCONFIG.gn @@ -1,45 +1,45 @@ ---- build/config/BUILDCONFIG.gn.orig 2022-03-28 18:11:04 UTC +--- build/config/BUILDCONFIG.gn.orig 2022-10-05 07:34:01 UTC +++ build/config/BUILDCONFIG.gn @@ -136,7 +136,8 @@ declare_args() { is_official_build = false # Set to true when compiling with the Clang compiler. - is_clang = current_os != "linux" || + is_clang = current_os != "linux" || current_os == "openbsd" || + current_os == "freebsd" || (current_cpu != "s390x" && current_cpu != "s390" && current_cpu != "ppc64" && current_cpu != "ppc" && current_cpu != "mips" && current_cpu != "mips64" && -@@ -218,6 +219,10 @@ if (host_toolchain == "") { +@@ -220,6 +221,10 @@ if (host_toolchain == "") { host_toolchain = "//build/toolchain/aix:$host_cpu" } else if (host_os == "zos") { host_toolchain = "//build/toolchain/zos:$host_cpu" + } else if (host_os == "openbsd") { + host_toolchain = "//build/toolchain/openbsd:clang_$host_cpu" + } else if (host_os == "freebsd") { + host_toolchain = "//build/toolchain/freebsd:clang_$host_cpu" } else { assert(false, "Unsupported host_os: $host_os") } -@@ -262,6 +267,8 @@ if (target_os == "android") { +@@ -264,6 +269,8 @@ if (target_os == "android") { _default_toolchain = "//build/toolchain/aix:$target_cpu" } else if (target_os == "zos") { _default_toolchain = "//build/toolchain/zos:$target_cpu" +} else if (target_os == "openbsd" || target_os == "freebsd") { + _default_toolchain = host_toolchain } else { assert(false, "Unsupported target_os: $target_os") } -@@ -296,7 +303,11 @@ is_android = current_os == "android" +@@ -298,7 +305,11 @@ is_android = current_os == "android" is_chromeos = current_os == "chromeos" is_fuchsia = current_os == "fuchsia" is_ios = current_os == "ios" -is_linux = current_os == "linux" +is_linux = current_os == "linux" || current_os == "openbsd" || + current_os == "freebsd" +is_openbsd = current_os == "openbsd" +is_freebsd = current_os == "freebsd" +is_bsd = current_os == "openbsd" || current_os == "freebsd" is_mac = current_os == "mac" is_nacl = current_os == "nacl" is_win = current_os == "win" || current_os == "winuwp" diff --git a/www/iridium/files/patch-build_config_compiler_BUILD.gn b/www/iridium/files/patch-build_config_compiler_BUILD.gn index b63f65a970fb..6b6d36614ebe 100644 --- a/www/iridium/files/patch-build_config_compiler_BUILD.gn +++ b/www/iridium/files/patch-build_config_compiler_BUILD.gn @@ -1,185 +1,185 @@ ---- build/config/compiler/BUILD.gn.orig 2022-04-01 07:48:30 UTC +--- build/config/compiler/BUILD.gn.orig 2022-10-05 07:34:01 UTC +++ build/config/compiler/BUILD.gn -@@ -236,13 +236,16 @@ config("default_include_dirs") { +@@ -222,13 +222,16 @@ config("default_include_dirs") { # Compiler instrumentation can introduce dependencies in DSOs to symbols in # the executable they are loaded into, so they are unresolved at link-time. config("no_unresolved_symbols") { - if (!using_sanitizer && + if (!using_sanitizer && !is_bsd && (is_linux || is_chromeos || is_android || is_fuchsia)) { ldflags = [ "-Wl,-z,defs", "-Wl,--as-needed", ] } + if (current_cpu == "x86" && is_openbsd) { + ldflags = [ "-Wl,-z,notext" ] + } } # compiler --------------------------------------------------------------------- -@@ -291,7 +294,9 @@ config("compiler") { +@@ -274,7 +277,9 @@ config("compiler") { configs += [ # See the definitions below. + ":clang_revision", ":rustc_revision", + ":compiler_cpu_abi", ":compiler_codegen", ":compiler_deterministic", ] @@ -450,6 +455,10 @@ config("compiler") { } } + if (is_openbsd) { + ldflags += [ "-Wl,-z,wxneeded" ] + } + # Linux-specific compiler flags setup. # ------------------------------------ - if ((is_posix || is_fuchsia) && !is_apple && use_lld) { -@@ -879,7 +888,7 @@ config("compiler_cpu_abi") { + if (use_gold) { +@@ -862,7 +871,7 @@ config("compiler_cpu_abi") { ] } } else if (current_cpu == "arm") { -- if (is_clang && !is_android && !is_nacl) { -+ if (is_clang && !is_android && !is_nacl && !is_bsd) { +- if (is_clang && !is_android && !is_nacl && ++ if (is_clang && !is_android && !is_nacl && !is_bsd && + !(is_chromeos_lacros && is_chromeos_device)) { cflags += [ "--target=arm-linux-gnueabihf" ] ldflags += [ "--target=arm-linux-gnueabihf" ] - } -@@ -893,7 +902,7 @@ config("compiler_cpu_abi") { - cflags += [ "-mtune=$arm_tune" ] +@@ -878,7 +887,7 @@ config("compiler_cpu_abi") { } } else if (current_cpu == "arm64") { -- if (is_clang && !is_android && !is_nacl && !is_fuchsia) { -+ if (is_clang && !is_android && !is_nacl && !is_fuchsia && !is_bsd) { + if (is_clang && !is_android && !is_nacl && !is_fuchsia && +- !(is_chromeos_lacros && is_chromeos_device)) { ++ !(is_chromeos_lacros && is_chromeos_device) && !is_bsd) { cflags += [ "--target=aarch64-linux-gnu" ] ldflags += [ "--target=aarch64-linux-gnu" ] } -@@ -1465,7 +1474,7 @@ config("default_warnings") { - "-Wno-ignored-pragma-optimize", - ] - -- if (is_chromeos || default_toolchain == "//build/toolchain/cros:target") { -+ if (is_chromeos || default_toolchain == "//build/toolchain/cros:target" || is_bsd) { - # TODO(https://crbug.com/1016945): Re-enable once ChromeOS toolchain is up to date - cflags += [ "-Wno-builtin-assume-aligned-alignment" ] +@@ -1464,7 +1473,7 @@ config("default_warnings") { + ] } -@@ -1644,7 +1653,7 @@ config("no_chromium_code") { + +- if (!is_nacl) { ++ if (!is_nacl && !is_bsd) { + cflags += [ + # TODO(crbug.com/1343975) Evaluate and possibly enable. + "-Wno-deprecated-builtins", +@@ -1623,7 +1632,7 @@ config("no_chromium_code") { # third-party libraries. "-Wno-c++11-narrowing", ] - if (!is_nacl) { + if (!is_nacl && !is_freebsd) { cflags += [ # Disabled for similar reasons as -Wunused-variable. "-Wno-unused-but-set-variable", -@@ -1956,8 +1965,7 @@ config("default_stack_frames") { +@@ -1935,8 +1944,7 @@ config("default_stack_frames") { } # Default "optimization on" config. -config("optimize") { } -config("xoptimize") { +config("optimize") { if (is_win) { if (chrome_pgo_phase != 2) { # Favor size over speed, /O1 must be before the common flags. -@@ -1995,8 +2003,7 @@ config("xoptimize") { +@@ -1974,8 +1982,7 @@ config("xoptimize") { } # Turn off optimizations. -config("no_optimize") { } -config("xno_optimize") { +config("no_optimize") { if (is_win) { cflags = [ "/Od", # Disable optimization. -@@ -2036,8 +2043,7 @@ config("xno_optimize") { +@@ -2015,8 +2022,7 @@ config("xno_optimize") { # Turns up the optimization level. On Windows, this implies whole program # optimization and link-time code generation which is very expensive and should # be used sparingly. -config("optimize_max") { } -config("xoptimize_max") { +config("optimize_max") { if (is_nacl && is_nacl_irt) { # The NaCl IRT is a special case and always wants its own config. # Various components do: -@@ -2070,8 +2076,7 @@ config("xoptimize_max") { +@@ -2049,8 +2055,7 @@ config("xoptimize_max") { # # TODO(crbug.com/621335) - rework how all of these configs are related # so that we don't need this disclaimer. -config("optimize_speed") { } -config("xoptimize_speed") { +config("optimize_speed") { if (is_nacl && is_nacl_irt) { # The NaCl IRT is a special case and always wants its own config. # Various components do: -@@ -2097,8 +2102,7 @@ config("xoptimize_speed") { +@@ -2076,8 +2081,7 @@ config("xoptimize_speed") { } } -config("optimize_fuzzing") { } -config("xoptimize_fuzzing") { +config("optimize_fuzzing") { cflags = [ "-O1" ] + common_optimize_on_cflags rustflags = [ "-Copt-level=1" ] ldflags = common_optimize_on_ldflags -@@ -2163,7 +2167,7 @@ config("afdo_optimize_size") { +@@ -2142,7 +2146,7 @@ config("afdo_optimize_size") { # There are some targeted places that AFDO regresses, so we provide a separate # config to allow AFDO to be disabled per-target. config("afdo") { - if (is_clang) { + if (is_clang && !is_bsd) { cflags = [] if (clang_emit_debug_info_for_profiling) { # Add the following flags to generate debug info for profiling. -@@ -2179,7 +2183,7 @@ config("afdo") { +@@ -2158,7 +2162,7 @@ config("afdo") { cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ] inputs = [ _clang_sample_profile ] } - } else if (auto_profile_path != "" && is_a_target_toolchain) { + } else if (auto_profile_path != "" && is_a_target_toolchain && !is_bsd) { cflags = [ "-fauto-profile=${auto_profile_path}" ] inputs = [ auto_profile_path ] } -@@ -2217,8 +2221,7 @@ config("win_pdbaltpath") { +@@ -2196,8 +2200,7 @@ config("win_pdbaltpath") { } # Full symbols. -config("symbols") { } -config("xsymbols") { +config("symbols") { if (is_win) { if (is_clang) { cflags = [ "/Z7" ] # Debug information in the .obj files. -@@ -2323,7 +2326,8 @@ config("xsymbols") { +@@ -2299,7 +2302,8 @@ config("xsymbols") { } } - if (is_clang && (!is_nacl || is_nacl_saigo) && current_os != "zos") { + if (is_clang && (!is_nacl || is_nacl_saigo) && current_os != "zos" && + !is_bsd) { if (is_apple) { # TODO(https://crbug.com/1050118): Investigate missing debug info on mac. # Make sure we don't use constructor homing on mac. -@@ -2346,8 +2350,7 @@ config("xsymbols") { +@@ -2322,8 +2326,7 @@ config("xsymbols") { # Minimal symbols. # This config guarantees to hold symbol for stack trace which are shown to user # when crash happens in unittests running on buildbot. -config("minimal_symbols") { } -config("xminimal_symbols") { +config("minimal_symbols") { if (is_win) { # Functions, files, and line tables only. cflags = [] -@@ -2420,8 +2423,7 @@ config("xminimal_symbols") { +@@ -2395,8 +2398,7 @@ config("xminimal_symbols") { # This configuration contains function names only. That is, the compiler is # told to not generate debug information and the linker then just puts function # names in the final debug information. -config("no_symbols") { } -config("xno_symbols") { +config("no_symbols") { if (is_win) { ldflags = [ "/DEBUG" ] diff --git a/www/iridium/files/patch-build_config_compiler_pgo_pgo.gni b/www/iridium/files/patch-build_config_compiler_pgo_pgo.gni deleted file mode 100644 index 1cb2d3dcfbe9..000000000000 --- a/www/iridium/files/patch-build_config_compiler_pgo_pgo.gni +++ /dev/null @@ -1,11 +0,0 @@ ---- build/config/compiler/pgo/pgo.gni.orig 2022-03-28 18:11:04 UTC -+++ build/config/compiler/pgo/pgo.gni -@@ -16,7 +16,7 @@ declare_args() { - # TODO(crbug.com/1052397): Remove chromeos_is_browser_only once - # target_os switch for lacros-chrome is completed. - (is_win || is_mac || -- (is_linux && !chromeos_is_browser_only && !is_chromecast))) { -+ (is_linux && !chromeos_is_browser_only && !is_chromecast && !is_bsd))) { - chrome_pgo_phase = 2 - } - diff --git a/www/iridium/files/patch-build_config_linux_BUILD.gn b/www/iridium/files/patch-build_config_linux_BUILD.gn index 36d2ec257d7d..57a77d064bb5 100644 --- a/www/iridium/files/patch-build_config_linux_BUILD.gn +++ b/www/iridium/files/patch-build_config_linux_BUILD.gn @@ -1,11 +1,11 @@ ---- build/config/linux/BUILD.gn.orig 2022-03-28 18:11:04 UTC +--- build/config/linux/BUILD.gn.orig 2022-10-05 07:34:01 UTC +++ build/config/linux/BUILD.gn -@@ -42,7 +42,7 @@ config("runtime_library") { +@@ -41,7 +41,7 @@ config("runtime_library") { + } - if ((!(is_chromeos_ash || is_chromeos_lacros) || - default_toolchain != "//build/toolchain/cros:target") && + if ((!is_chromeos || default_toolchain != "//build/toolchain/cros:target") && - (!use_custom_libcxx || current_cpu == "mipsel")) { + (!use_custom_libcxx || current_cpu == "mipsel") && !is_bsd) { libs = [ "atomic" ] } } diff --git a/www/iridium/files/patch-build_config_ozone.gni b/www/iridium/files/patch-build_config_ozone.gni index 75e60dc7adf7..118645d394a0 100644 --- a/www/iridium/files/patch-build_config_ozone.gni +++ b/www/iridium/files/patch-build_config_ozone.gni @@ -1,19 +1,19 @@ ---- build/config/ozone.gni.orig 2022-03-31 09:38:28 UTC +--- build/config/ozone.gni.orig 2022-10-05 07:34:01 UTC +++ build/config/ozone.gni -@@ -91,7 +91,15 @@ declare_args() { +@@ -87,7 +87,15 @@ declare_args() { } else if (is_chromeos_lacros) { ozone_platform = "wayland" ozone_platform_wayland = true - } else if (is_linux) { + } else if (is_linux && !is_bsd) { + ozone_platform = "x11" + ozone_platform_wayland = true + ozone_platform_x11 = true + } else if (is_openbsd) { + ozone_platform = "x11" + ozone_platform_wayland = false + ozone_platform_x11 = true + } else if (is_freebsd) { ozone_platform = "x11" ozone_platform_wayland = true ozone_platform_x11 = true diff --git a/www/iridium/files/patch-build_config_rust.gni b/www/iridium/files/patch-build_config_rust.gni index d4cd8961aa4f..b74a05428eb5 100644 --- a/www/iridium/files/patch-build_config_rust.gni +++ b/www/iridium/files/patch-build_config_rust.gni @@ -1,11 +1,11 @@ ---- build/config/rust.gni.orig 2022-04-01 07:48:30 UTC +--- build/config/rust.gni.orig 2022-10-05 07:34:01 UTC +++ build/config/rust.gni -@@ -116,7 +116,7 @@ if (enable_rust) { +@@ -124,7 +124,7 @@ if (enable_rust) { rust_sysroot = "//third_party/rust-toolchain" use_unverified_rust_toolchain = false } else { - if (host_os != "linux") { + if (host_os != "linux" && host_os != "openbsd" && host_os != "freebsd") { assert(false, "Attempt to use Android Rust toolchain on an unsupported platform") } diff --git a/www/iridium/files/patch-build_toolchain_gcc__toolchain.gni b/www/iridium/files/patch-build_toolchain_gcc__toolchain.gni index 16f24db9ab60..450d35ba5c66 100644 --- a/www/iridium/files/patch-build_toolchain_gcc__toolchain.gni +++ b/www/iridium/files/patch-build_toolchain_gcc__toolchain.gni @@ -1,35 +1,44 @@ ---- build/toolchain/gcc_toolchain.gni.orig 2022-04-01 07:48:30 UTC +--- build/toolchain/gcc_toolchain.gni.orig 2022-10-05 07:34:01 UTC +++ build/toolchain/gcc_toolchain.gni @@ -53,6 +53,13 @@ if (enable_resource_allowlist_generation) { "enable_resource_allowlist_generation=true does not work for target_os=$target_os") } +declare_args() { + extra_cflags = "" + extra_cppflags = "" + extra_cxxflags = "" + extra_ldflags = "" +} + # This template defines a toolchain for something that works like gcc # (including clang). # -@@ -771,13 +778,12 @@ template("gcc_toolchain") { +@@ -786,22 +793,12 @@ template("gcc_toolchain") { # use_gold too. template("clang_toolchain") { gcc_toolchain(target_name) { -- prefix = rebase_path("$clang_base_path/bin", root_build_dir) +- _path = "$clang_base_path/bin" +- _is_path_absolute = get_path_info(_path, "abspath") == _path +- +- # Preserve absolute paths for tools like distcc. +- if (_is_path_absolute && filter_include([ _path ], [ "//*" ]) == []) { +- prefix = _path +- } else { +- prefix = rebase_path(_path, root_build_dir) +- } +- - cc = "${prefix}/clang" - cxx = "${prefix}/clang++" + cc = "cc" + cxx = "c++" ld = cxx - readelf = "${prefix}/llvm-readelf" - ar = "${prefix}/llvm-ar" - nm = "${prefix}/llvm-nm" + readelf = "readelf" + ar = "ar" + nm = "nm" forward_variables_from(invoker, [ diff --git a/www/iridium/files/patch-chrome_app_app__management__strings.grdp b/www/iridium/files/patch-chrome_app_app__management__strings.grdp new file mode 100644 index 000000000000..c2eda39438ec --- /dev/null +++ b/www/iridium/files/patch-chrome_app_app__management__strings.grdp @@ -0,0 +1,11 @@ +--- chrome/app/app_management_strings.grdp.orig 2022-10-05 07:34:01 UTC ++++ chrome/app/app_management_strings.grdp +@@ -173,7 +173,7 @@ + You can open and edit supported files with this app from Finder or other apps. To control which files open this app by default, <a href="#">learn how to set default apps on your device</a>. + + +- ++ + + You can open and edit supported files with this app from your file browser or other apps. To control which files open this app by default, <a href="#">learn how to set default apps on your device</a>. + diff --git a/www/iridium/files/patch-chrome_app_chrome__command__ids.h b/www/iridium/files/patch-chrome_app_chrome__command__ids.h index e9a80bec2240..fdb4318a26d9 100644 --- a/www/iridium/files/patch-chrome_app_chrome__command__ids.h +++ b/www/iridium/files/patch-chrome_app_chrome__command__ids.h @@ -1,11 +1,11 @@ ---- chrome/app/chrome_command_ids.h.orig 2022-03-28 18:11:04 UTC +--- chrome/app/chrome_command_ids.h.orig 2022-10-05 07:34:01 UTC +++ chrome/app/chrome_command_ids.h -@@ -66,7 +66,7 @@ +@@ -67,7 +67,7 @@ #define IDC_NAME_WINDOW 34049 // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch of lacros-chrome is complete. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) #define IDC_USE_SYSTEM_TITLE_BAR 34051 #define IDC_RESTORE_WINDOW 34052 #endif diff --git a/www/iridium/files/patch-chrome_app_chrome__main.cc b/www/iridium/files/patch-chrome_app_chrome__main.cc index a393724a942d..c08821e823b7 100644 --- a/www/iridium/files/patch-chrome_app_chrome__main.cc +++ b/www/iridium/files/patch-chrome_app_chrome__main.cc @@ -1,20 +1,20 @@ ---- chrome/app/chrome_main.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/app/chrome_main.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/app/chrome_main.cc -@@ -25,7 +25,7 @@ +@@ -26,7 +26,7 @@ #include "chrome/app/notification_metrics.h" #endif -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) #include "base/base_switches.h" #endif -@@ -146,7 +146,7 @@ int ChromeMain(int argc, const char** argv) { +@@ -152,7 +152,7 @@ int ChromeMain(int argc, const char** argv) { headless::SetUpCommandLine(command_line); } else { #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \ - BUILDFLAG(IS_WIN) + BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) if (command_line->HasSwitch(switches::kHeadless)) { #if BUILDFLAG(GOOGLE_CHROME_BRANDING) command_line->AppendSwitch(::headless::switches::kEnableCrashReporter); diff --git a/www/iridium/files/patch-chrome_app_chrome__main__delegate.cc b/www/iridium/files/patch-chrome_app_chrome__main__delegate.cc index 7f48959c413d..57b083bc2b25 100644 --- a/www/iridium/files/patch-chrome_app_chrome__main__delegate.cc +++ b/www/iridium/files/patch-chrome_app_chrome__main__delegate.cc @@ -1,107 +1,121 @@ ---- chrome/app/chrome_main_delegate.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/app/chrome_main_delegate.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/app/chrome_main_delegate.cc -@@ -114,7 +114,7 @@ - #include "chrome/app/chrome_crash_reporter_client.h" +@@ -126,7 +126,7 @@ + #include "components/about_ui/credit_utils.h" #endif -#if BUILDFLAG(ENABLE_NACL) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) +#if BUILDFLAG(ENABLE_NACL) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD) #include "components/nacl/common/nacl_paths.h" #include "components/nacl/zygote/nacl_fork_delegate_linux.h" #endif -@@ -158,12 +158,12 @@ +@@ -169,16 +169,16 @@ #include "v8/include/v8.h" #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "base/environment.h" #endif +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD) + #include "base/message_loop/message_pump_libevent.h" + #endif + #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || \ - BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) + BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "chrome/browser/policy/policy_path_parser.h" #include "components/crash/core/app/crashpad.h" #endif -@@ -311,7 +311,7 @@ void AdjustLinuxOOMScore(const std::string& process_ty +@@ -329,7 +329,7 @@ void AdjustLinuxOOMScore(const std::string& process_ty // and resources loaded. bool SubprocessNeedsResourceBundle(const std::string& process_type) { return -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // The zygote process opens the resources for the renderers. process_type == switches::kZygoteProcess || #endif -@@ -351,7 +351,7 @@ bool HandleVersionSwitches(const base::CommandLine& co +@@ -415,7 +415,7 @@ bool HandleVersionSwitches(const base::CommandLine& co // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) // Show the man page if --help or -h is on the command line. void HandleHelpSwitches(const base::CommandLine& command_line) { if (command_line.HasSwitch(switches::kHelp) || -@@ -415,7 +415,7 @@ void InitializeUserDataDir(base::CommandLine* command_ +@@ -506,7 +506,7 @@ void InitializeUserDataDir(base::CommandLine* command_ std::string process_type = command_line->GetSwitchValueASCII(switches::kProcessType); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // On Linux, Chrome does not support running multiple copies under different // DISPLAYs, so the profile directory can be specified in the environment to // support the virtual desktop use-case. -@@ -499,7 +499,7 @@ void RecordMainStartupMetrics(base::TimeTicks applicat +@@ -589,7 +589,7 @@ void RecordMainStartupMetrics(base::TimeTicks applicat #endif #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_CHROMEOS) + BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // Record the startup process creation time on supported platforms. On Android // this is recorded in ChromeMainDelegateAndroid. startup_metric_utils::RecordStartupProcessCreationTime( -@@ -680,6 +680,8 @@ void ChromeMainDelegate::PostFieldTrialInitialization( +@@ -767,6 +767,8 @@ void ChromeMainDelegate::CommonEarlyInitialization() { // not always enabled on Linux/ChromeOS. #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) bool enable_gwp_asan = crash_reporter::IsCrashpadEnabled(); +#elif BUILDFLAG(IS_BSD) + bool enable_gwp_asan = false; #else bool enable_gwp_asan = true; #endif -@@ -815,7 +817,7 @@ bool ChromeMainDelegate::BasicStartupComplete(int* exi - } - // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch - // of lacros-chrome is complete. +@@ -826,7 +828,7 @@ void ChromeMainDelegate::CommonEarlyInitialization() { + base::internal::TimerBase::InitializeFeatures(); + base::InitializeCpuReductionExperiment(); + base::sequence_manager::internal::SequenceManagerImpl::InitializeFeatures(); +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD) + base::MessagePumpLibevent::InitializeFeatures(); + #elif BUILDFLAG(IS_MAC) + base::PlatformThread::InitializeOptimizedRealtimeThreadingFeature(); +@@ -916,7 +918,7 @@ absl::optional ChromeMainDelegate::BasicStartupCo + + // TODO(crbug.com/1052397): Revisit the macro expression once build flag + // switch of lacros-chrome is complete. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) // This will directly exit if the user asked for help. HandleHelpSwitches(command_line); #endif -@@ -846,7 +848,7 @@ bool ChromeMainDelegate::BasicStartupComplete(int* exi - #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) +@@ -946,7 +948,7 @@ absl::optional ChromeMainDelegate::BasicStartupCo + #if BUILDFLAG(IS_CHROMEOS) chromeos::dbus_paths::RegisterPathProvider(); #endif -#if BUILDFLAG(ENABLE_NACL) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) +#if BUILDFLAG(ENABLE_NACL) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) nacl::RegisterPathProvider(); #endif -@@ -1161,7 +1163,7 @@ void ChromeMainDelegate::PreSandboxStartup() { - locale; +@@ -1336,7 +1338,7 @@ void ChromeMainDelegate::PreSandboxStartup() { + CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale; } -#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD) // Zygote needs to call InitCrashReporter() in RunZygote(). if (process_type != switches::kZygoteProcess) { - #if BUILDFLAG(IS_ANDROID) -@@ -1237,7 +1239,7 @@ absl::variant Chrome + if (command_line.HasSwitch(switches::kPreCrashpadCrashTest)) { +@@ -1412,7 +1414,7 @@ absl::variant Chrome - // This entry is not needed on Linux, where the NaCl loader - // process is launched via nacl_helper instead. + // This entry is not needed on Linux, where the NaCl loader + // process is launched via nacl_helper instead. -#if BUILDFLAG(ENABLE_NACL) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(ENABLE_NACL) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD) {switches::kNaClLoaderProcess, NaClMain}, #else {"", nullptr}, // To avoid constant array of size 0 diff --git a/www/iridium/files/patch-chrome_app_chromium__strings.grd b/www/iridium/files/patch-chrome_app_chromium__strings.grd index 804d6dd668d0..b090c666b5f9 100644 --- a/www/iridium/files/patch-chrome_app_chromium__strings.grd +++ b/www/iridium/files/patch-chrome_app_chromium__strings.grd @@ -1,29 +1,20 @@ ---- chrome/app/chromium_strings.grd.orig 2022-04-01 07:48:30 UTC +--- chrome/app/chromium_strings.grd.orig 2022-10-05 07:34:01 UTC +++ chrome/app/chromium_strings.grd -@@ -298,7 +298,7 @@ If you update this file, be sure also to update google +@@ -296,7 +296,7 @@ If you update this file, be sure also to update google Welcome to Iridium; new browser window opened - + Welcome to Iridium -@@ -818,7 +818,7 @@ Permissions you've already given to websites and apps - - - -- -+ - - Your system administrator has configured the browser to open an alternative browser to access $1example.com. +@@ -410,7 +410,7 @@ If you update this file, be sure also to update google + The browser may not function correctly because it is no longer supported on Windows XP or Windows Vista -@@ -944,7 +944,7 @@ Permissions you've already given to websites and apps - - - -- -+ - - The profile appears to be in use by another browsr process ($112345) on another computer ($2example.com). The browser has locked the profile so that it doesn't get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch the browser. + +- ++ + + The browser may not function correctly because it is no longer supported on this Linux distribution diff --git a/www/iridium/files/patch-chrome_app_generated__resources.grd b/www/iridium/files/patch-chrome_app_generated__resources.grd index d0137ece6f13..413eb5ad5528 100644 --- a/www/iridium/files/patch-chrome_app_generated__resources.grd +++ b/www/iridium/files/patch-chrome_app_generated__resources.grd @@ -1,56 +1,74 @@ ---- chrome/app/generated_resources.grd.orig 2022-04-01 07:48:30 UTC +--- chrome/app/generated_resources.grd.orig 2022-10-05 07:34:01 UTC +++ chrome/app/generated_resources.grd @@ -2,7 +2,7 @@ -@@ -298,7 +298,7 @@ are declared in tools/grit/grit_rule.gni. - - - -- -+ - - - -@@ -2833,7 +2833,7 @@ are declared in tools/grit/grit_rule.gni. +@@ -3069,7 +3069,7 @@ are declared in tools/grit/grit_rule.gni. - + Device Credentials -@@ -5686,7 +5686,7 @@ Keep your key file in a safe place. You will need it t +@@ -4802,7 +4802,7 @@ are declared in tools/grit/grit_rule.gni. + Read information about your browser, OS, device, installed software, registry values and files + + +- ++ + + Read information about your browser, OS, device, installed software and files + +@@ -5439,7 +5439,7 @@ Keep your key file in a safe place. You will need it t + Old versions of Chrome Apps won't open on Windows devices after December 2022. Contact your administrator to update to a new version or remove this app. + - - -- -+ - - Legacy Browser Support +- ++ + + Old versions of Chrome Apps won't open on Linux devices after December 2022. Contact your administrator to update to a new version or remove this app. -@@ -8217,7 +8217,7 @@ Keep your key file in a safe place. You will need it t +@@ -5467,7 +5467,7 @@ Keep your key file in a safe place. You will need it t + Old versions of Chrome apps won't open on Windows devices after December 2022. You can check if there's a new version available. + + +- ++ + + Old versions of Chrome apps won't open on Linux devices after December 2022. You can check if there's a new version available. + +@@ -8964,7 +8964,7 @@ Check your passwords anytime in -+ +- ++ Use system title bar and borders -@@ -9372,7 +9372,7 @@ Please help our engineers fix this problem. Tell us wh +@@ -10148,7 +10148,7 @@ Please help our engineers fix this problem. Tell us wh Set as default -- -+ +- ++ Minimize +@@ -12211,7 +12211,7 @@ Please help our engineers fix this problem. Tell us wh + Open Anyway + + +- ++ + + System Signals Utilities + diff --git a/www/iridium/files/patch-chrome_app_google__chrome__strings.grd b/www/iridium/files/patch-chrome_app_google__chrome__strings.grd index 90ca9b7127f4..3895d1d1e29e 100644 --- a/www/iridium/files/patch-chrome_app_google__chrome__strings.grd +++ b/www/iridium/files/patch-chrome_app_google__chrome__strings.grd @@ -1,29 +1,20 @@ ---- chrome/app/google_chrome_strings.grd.orig 2022-04-01 07:48:30 UTC +--- chrome/app/google_chrome_strings.grd.orig 2022-10-05 07:34:01 UTC +++ chrome/app/google_chrome_strings.grd -@@ -303,7 +303,7 @@ chromium_strings.grd. --> +@@ -301,7 +301,7 @@ chromium_strings.grd. --> Welcome to Chrome; new browser window opened - + Welcome to Google Chrome -@@ -863,7 +863,7 @@ Permissions you've already given to websites and apps - - - -- -+ - - Your system administrator has configured Google Chrome to open an alternative browser to access $1example.com. +@@ -438,7 +438,7 @@ chromium_strings.grd. --> + This computer will no longer receive Google Chrome updates because Windows XP and Windows Vista are no longer supported -@@ -1012,7 +1012,7 @@ Permissions you've already given to websites and apps - - - -- -+ - - The profile appears to be in use by another Google Chrome process ($112345) on another computer ($2example.com). Chrome has locked the profile so that it doesn't get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch Chrome. + +- ++ + + Google Chrome may not function correctly because it is no longer supported on this Linux distribution diff --git a/www/iridium/files/patch-chrome_app_settings__strings.grdp b/www/iridium/files/patch-chrome_app_settings__strings.grdp index caaa01f97837..a956f79d3910 100644 --- a/www/iridium/files/patch-chrome_app_settings__strings.grdp +++ b/www/iridium/files/patch-chrome_app_settings__strings.grdp @@ -1,20 +1,20 @@ ---- chrome/app/settings_strings.grdp.orig 2022-03-28 18:11:04 UTC +--- chrome/app/settings_strings.grdp.orig 2022-10-05 07:34:01 UTC +++ chrome/app/settings_strings.grdp -@@ -131,7 +131,7 @@ +@@ -134,7 +134,7 @@ Theme -- -+ +- ++ GTK+ -@@ -145,7 +145,7 @@ +@@ -148,7 +148,7 @@ Use Classic -- -+ +- ++ Reset to default diff --git a/www/iridium/files/patch-chrome_app_theme_chrome__unscaled__resources.grd b/www/iridium/files/patch-chrome_app_theme_chrome__unscaled__resources.grd index 77c8bf474b6a..ab7eb9bd7ba3 100644 --- a/www/iridium/files/patch-chrome_app_theme_chrome__unscaled__resources.grd +++ b/www/iridium/files/patch-chrome_app_theme_chrome__unscaled__resources.grd @@ -1,32 +1,32 @@ ---- chrome/app/theme/chrome_unscaled_resources.grd.orig 2022-04-01 07:48:30 UTC +--- chrome/app/theme/chrome_unscaled_resources.grd.orig 2022-10-05 07:34:01 UTC +++ chrome/app/theme/chrome_unscaled_resources.grd @@ -15,12 +15,12 @@ - + - + -@@ -52,12 +52,12 @@ +@@ -53,12 +53,12 @@ - + - + diff --git a/www/iridium/files/patch-chrome_app_theme_theme__resources.grd b/www/iridium/files/patch-chrome_app_theme_theme__resources.grd index 1bfe0269b3f2..d19441f84c1b 100644 --- a/www/iridium/files/patch-chrome_app_theme_theme__resources.grd +++ b/www/iridium/files/patch-chrome_app_theme_theme__resources.grd @@ -1,11 +1,34 @@ ---- chrome/app/theme/theme_resources.grd.orig 2022-03-28 18:11:04 UTC +--- chrome/app/theme/theme_resources.grd.orig 2022-10-05 07:34:01 UTC +++ chrome/app/theme/theme_resources.grd -@@ -25,7 +25,7 @@ - -- -+ - +@@ -130,11 +130,11 @@ + - + +- ++ + + + +- ++ + + + +@@ -142,7 +142,7 @@ + + + +- ++ + + + +@@ -150,7 +150,7 @@ + + + +- ++ + + + diff --git a/www/iridium/files/patch-chrome_browser_about__flags.cc b/www/iridium/files/patch-chrome_browser_about__flags.cc index ae127b2d48f8..fdf0ba9fcb20 100644 --- a/www/iridium/files/patch-chrome_browser_about__flags.cc +++ b/www/iridium/files/patch-chrome_browser_about__flags.cc @@ -1,128 +1,128 @@ ---- chrome/browser/about_flags.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/about_flags.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/about_flags.cc -@@ -206,7 +206,7 @@ +@@ -212,7 +212,7 @@ #include "ui/native_theme/native_theme_features.h" #include "ui/ui_features.h" -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "base/allocator/buildflags.h" #endif -@@ -275,7 +275,7 @@ - #include "chrome/browser/supervised_user/supervised_user_features/supervised_user_features.h" +@@ -287,7 +287,7 @@ + #include "chrome/browser/supervised_user/supervised_user_features/supervised_user_features.h" // nogncheck #endif // ENABLE_SUPERVISED_USERS -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD) #include "ui/ozone/buildflags.h" #include "ui/ozone/public/ozone_switches.h" #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) -@@ -362,7 +362,7 @@ const FeatureEntry::Choice kUseAngleChoicesMac[] = { - gl::kANGLEImplementationMetalName}}; +@@ -392,7 +392,7 @@ const FeatureEntry::FeatureVariation kDXGIWaitableSwap + {"Max 3 Frames", &kDXGIWaitableSwapChain3Frames, 1, nullptr}}; #endif -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) const FeatureEntry::Choice kOzonePlatformHintRuntimeChoices[] = { {flag_descriptions::kOzonePlatformHintChoiceDefault, "", ""}, {flag_descriptions::kOzonePlatformHintChoiceAuto, -@@ -976,7 +976,7 @@ const FeatureEntry::FeatureVariation kPageContentAnnot +@@ -1262,7 +1262,7 @@ const FeatureEntry::FeatureVariation }; #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \ - BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) const FeatureEntry::FeatureParam kOmniboxDocumentProviderServerScoring[] = { {"DocumentUseServerScore", "true"}, {"DocumentUseClientScore", "false"}, -@@ -3424,7 +3424,7 @@ const FeatureEntry kFeatureEntries[] = { - FEATURE_VALUE_TYPE(chromeos::kLacrosTtsSupport)}, +@@ -3923,7 +3923,7 @@ const FeatureEntry kFeatureEntries[] = { + FEATURE_VALUE_TYPE(base::kOneGroupPerRenderer)}, #endif // BUILDFLAG(IS_CHROMEOS) -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) { "enable-accelerated-video-decode", flag_descriptions::kAcceleratedVideoDecodeName, -@@ -3838,7 +3838,7 @@ const FeatureEntry kFeatureEntries[] = { - {"enable-login-detection", flag_descriptions::kEnableLoginDetectionName, - flag_descriptions::kEnableLoginDetectionDescription, kOsAll, - FEATURE_VALUE_TYPE(login_detection::kLoginDetection)}, --#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) -+#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) - {"enable-navigation-predictor", - flag_descriptions::kEnableNavigationPredictorName, - flag_descriptions::kEnableNavigationPredictorDescription, -@@ -4031,7 +4031,7 @@ const FeatureEntry kFeatureEntries[] = { +@@ -4549,7 +4549,7 @@ const FeatureEntry kFeatureEntries[] = { FEATURE_VALUE_TYPE(features::kWebShare)}, #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) {"ozone-platform-hint", flag_descriptions::kOzonePlatformHintName, flag_descriptions::kOzonePlatformHintDescription, kOsLinux, MULTI_VALUE_TYPE(kOzonePlatformHintRuntimeChoices)}, -@@ -4050,7 +4050,7 @@ const FeatureEntry kFeatureEntries[] = { +@@ -4568,7 +4568,7 @@ const FeatureEntry kFeatureEntries[] = { password_manager::features::kForceInitialSyncWhenDecryptionFails)}, #endif // BUILDFLAG(IS_LINUX) -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) {"skip-undecryptable-passwords", flag_descriptions::kSkipUndecryptablePasswordsName, flag_descriptions::kSkipUndecryptablePasswordsDescription, -@@ -4760,7 +4760,7 @@ const FeatureEntry kFeatureEntries[] = { - "OmniboxBundledExperimentV1")}, +@@ -4822,7 +4822,7 @@ const FeatureEntry kFeatureEntries[] = { + "FeedCloseRefresh")}, + #endif // BUILDFLAG(IS_ANDROID) + #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \ +- BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) ++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) + {"following-feed-sidepanel", flag_descriptions::kFollowingFeedSidepanelName, + flag_descriptions::kFollowingFeedSidepanelDescription, kOsDesktop, + FEATURE_VALUE_TYPE(feed::kWebUiFeed)}, +@@ -5336,7 +5336,7 @@ const FeatureEntry kFeatureEntries[] = { + FEATURE_VALUE_TYPE(omnibox::kZeroSuggestPrefetchingOnWeb)}, #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \ - BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) {"omnibox-experimental-keyword-mode", flag_descriptions::kOmniboxExperimentalKeywordModeName, flag_descriptions::kOmniboxExperimentalKeywordModeDescription, kOsDesktop, -@@ -5158,7 +5158,7 @@ const FeatureEntry kFeatureEntries[] = { - #endif // BUILDFLAG(IS_ANDROID) +@@ -5873,7 +5873,7 @@ const FeatureEntry kFeatureEntries[] = { + flag_descriptions::kPointerLockOptionsDescription, kOsDesktop, + FEATURE_VALUE_TYPE(features::kPointerLockOptions)}, - #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ -- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) -+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) - {"webui-feedback", flag_descriptions::kWebuiFeedbackName, - flag_descriptions::kWebuiFeedbackDescription, kOsDesktop, - FEATURE_VALUE_TYPE(features::kWebUIFeedback)}, -@@ -6198,7 +6198,7 @@ const FeatureEntry kFeatureEntries[] = { - FEATURE_VALUE_TYPE(features::kMouseSubframeNoImplicitCapture)}, +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + {"enable-async-dns", flag_descriptions::kAsyncDnsName, + flag_descriptions::kAsyncDnsDescription, kOsWin | kOsLinux, + FEATURE_VALUE_TYPE(features::kAsyncDns)}, +@@ -6791,7 +6791,7 @@ const FeatureEntry kFeatureEntries[] = { + #endif // BUILDFLAG(IS_CHROMEOS) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) {"global-media-controls-modern-ui", flag_descriptions::kGlobalMediaControlsModernUIName, flag_descriptions::kGlobalMediaControlsModernUIDescription, -@@ -6912,7 +6912,7 @@ const FeatureEntry kFeatureEntries[] = { - #endif - - #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \ -- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) -+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) - {"incognito-clear-browsing-data-dialog-for-desktop", - flag_descriptions::kIncognitoClearBrowsingDataDialogForDesktopName, - flag_descriptions::kIncognitoClearBrowsingDataDialogForDesktopDescription, -@@ -7037,7 +7037,7 @@ const FeatureEntry kFeatureEntries[] = { +@@ -7651,7 +7651,7 @@ const FeatureEntry kFeatureEntries[] = { #endif #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) - {"commander", flag_descriptions::kCommanderName, - flag_descriptions::kCommanderDescription, kOsDesktop, - FEATURE_VALUE_TYPE(features::kCommander)}, -@@ -7291,7 +7291,7 @@ const FeatureEntry kFeatureEntries[] = { + {"quick-commands", flag_descriptions::kQuickCommandsName, + flag_descriptions::kQuickCommandsDescription, kOsDesktop, + FEATURE_VALUE_TYPE(features::kQuickCommands)}, +@@ -7950,7 +7950,7 @@ const FeatureEntry kFeatureEntries[] = { #if BUILDFLAG(IS_WIN) || \ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \ - BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) { "ui-debug-tools", flag_descriptions::kUIDebugToolsName, +@@ -8530,7 +8530,7 @@ const FeatureEntry kFeatureEntries[] = { + #endif + + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \ +- BUILDFLAG(IS_CHROMEOS_ASH) ++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD) + {"document-picture-in-picture-api", + flag_descriptions::kDocumentPictureInPictureApiName, + flag_descriptions::kDocumentPictureInPictureApiDescription, diff --git a/www/iridium/files/patch-chrome_browser_after__startup__task__utils.cc b/www/iridium/files/patch-chrome_browser_after__startup__task__utils.cc index aa489bc5dfa6..319c2721ae37 100644 --- a/www/iridium/files/patch-chrome_browser_after__startup__task__utils.cc +++ b/www/iridium/files/patch-chrome_browser_after__startup__task__utils.cc @@ -1,29 +1,11 @@ ---- chrome/browser/after_startup_task_utils.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/after_startup_task_utils.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/after_startup_task_utils.cc -@@ -25,7 +25,7 @@ - - // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch - // of lacros-chrome is complete. --#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) -+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) - #include "ui/views/linux_ui/linux_ui.h" - #endif - -@@ -111,7 +111,7 @@ void SetBrowserStartupIsComplete() { - +@@ -107,7 +107,7 @@ void SetBrowserStartupIsComplete() { + TRACE_EVENT0("startup", "SetBrowserStartupIsComplete"); g_startup_complete_flag.Get().Set(); #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_CHROMEOS) + BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // Process::Current().CreationTime() is not available on all platforms. const base::Time process_creation_time = base::Process::Current().CreationTime(); -@@ -130,7 +130,7 @@ void SetBrowserStartupIsComplete() { - - // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch - // of lacros-chrome is complete. --#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) -+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) - // Make sure we complete the startup notification sequence, or launchers will - // get confused by not receiving the expected message from the main process. - views::LinuxUI* linux_ui = views::LinuxUI::instance(); diff --git a/www/iridium/files/patch-chrome_browser_apps_platform__apps_api_music__manager__private_device__id__linux.cc b/www/iridium/files/patch-chrome_browser_apps_platform__apps_api_music__manager__private_device__id__linux.cc deleted file mode 100644 index 644ba8794a0e..000000000000 --- a/www/iridium/files/patch-chrome_browser_apps_platform__apps_api_music__manager__private_device__id__linux.cc +++ /dev/null @@ -1,71 +0,0 @@ ---- chrome/browser/apps/platform_apps/api/music_manager_private/device_id_linux.cc.orig 2022-03-28 18:11:04 UTC -+++ chrome/browser/apps/platform_apps/api/music_manager_private/device_id_linux.cc -@@ -4,6 +4,15 @@ - - #include "chrome/browser/apps/platform_apps/api/music_manager_private/device_id.h" - -+#include "build/build_config.h" -+ -+#if defined(OS_BSD) -+#include -+#include -+#include -+#include -+#endif -+ - #include - #include - #include -@@ -106,11 +115,33 @@ class MacAddressProcessor { - const char* const prefixes[], - size_t prefixes_count) { - const int MAC_LENGTH = 6; -+#if defined(OS_BSD) -+ struct ifaddrs *ifap, *ifinfo; -+#else - struct ifreq ifinfo; -+#endif - - memset(&ifinfo, 0, sizeof(ifinfo)); -- strncpy(ifinfo.ifr_name, ifaddr->ifa_name, sizeof(ifinfo.ifr_name) - 1); - -+#if defined(OS_BSD) -+ int result = getifaddrs(&ifap); -+ if (result != 0) -+ return true; -+ result = 1; // no MAC found yet -+ for (ifinfo = ifap; ifinfo != NULL; ifinfo = ifinfo->ifa_next) { -+ struct sockaddr* sa = ifinfo->ifa_addr; -+ if (sa->sa_family == AF_LINK && -+ !strncmp(ifinfo->ifa_name, ifaddr->ifa_name, -+ sizeof(ifinfo->ifa_name) - 1)) { -+ result = 0; -+ break; -+ } -+ } -+ -+ char mac_address[6]; -+ strncpy(mac_address, (const char*)LLADDR((struct sockaddr_dl*)ifinfo->ifa_addr), sizeof(mac_address)); -+#else -+ strncpy(ifinfo.ifr_name, ifaddr->ifa_name, sizeof(ifinfo.ifr_name) - 1); - int sd = socket(AF_INET, SOCK_DGRAM, 0); - int result = ioctl(sd, SIOCGIFHWADDR, &ifinfo); - close(sd); -@@ -120,11 +151,17 @@ class MacAddressProcessor { - - const char* mac_address = - static_cast(ifinfo.ifr_hwaddr.sa_data); -+#endif - if (!is_valid_mac_address_.Run(mac_address, MAC_LENGTH)) - return true; - -+#if defined(OS_BSD) -+ if (!IsValidPrefix(ifinfo->ifa_name, prefixes, prefixes_count)) -+ return true; -+#else - if (!IsValidPrefix(ifinfo.ifr_name, prefixes, prefixes_count)) - return true; -+#endif - - // Got one! - found_mac_address_ = diff --git a/www/iridium/files/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc b/www/iridium/files/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc index a4f222095c55..27d9c6172e70 100644 --- a/www/iridium/files/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc +++ b/www/iridium/files/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc @@ -1,20 +1,20 @@ ---- chrome/browser/apps/platform_apps/platform_app_launch.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/apps/platform_apps/platform_app_launch.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/apps/platform_apps/platform_app_launch.cc -@@ -18,7 +18,7 @@ - #include "extensions/common/constants.h" +@@ -20,7 +20,7 @@ #include "extensions/common/extension.h" --#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) -+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ +- BUILDFLAG(IS_FUCHSIA) ++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_window.h" -@@ -121,7 +121,7 @@ bool OpenExtensionApplicationTab(Profile* profile, con - return app_tab != nullptr; +@@ -124,7 +124,7 @@ bool OpenExtensionApplicationTab(Profile* profile, con } --#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) -+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ +- BUILDFLAG(IS_FUCHSIA) ++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) bool OpenDeprecatedApplicationPrompt(Profile* profile, const std::string& app_id) { if (!extensions::IsExtensionUnsupportedDeprecatedApp(profile, app_id)) diff --git a/www/iridium/files/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc b/www/iridium/files/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc index a0dd415e5b85..e1f056d7142f 100644 --- a/www/iridium/files/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc +++ b/www/iridium/files/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc @@ -1,11 +1,11 @@ ---- chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc -@@ -90,7 +90,7 @@ ChromeAutocompleteSchemeClassifier::GetInputTypeForSch +@@ -91,7 +91,7 @@ ChromeAutocompleteSchemeClassifier::GetInputTypeForSch return metrics::OmniboxInputType::QUERY; case ExternalProtocolHandler::UNKNOWN: { -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // Linux impl of GetApplicationNameForProtocol doesn't distinguish // between URL schemes with handers and those without. This will // make the default behaviour be search on Linux. diff --git a/www/iridium/files/patch-chrome_browser_background_background__mode__manager.cc b/www/iridium/files/patch-chrome_browser_background_background__mode__manager.cc index 590e8a3dc385..f1d83589da28 100644 --- a/www/iridium/files/patch-chrome_browser_background_background__mode__manager.cc +++ b/www/iridium/files/patch-chrome_browser_background_background__mode__manager.cc @@ -1,20 +1,11 @@ ---- chrome/browser/background/background_mode_manager.cc.orig 2022-04-03 12:23:22 UTC +--- chrome/browser/background/background_mode_manager.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/background/background_mode_manager.cc -@@ -376,7 +376,7 @@ void BackgroundModeManager::RegisterPrefs(PrefRegistry - registry->RegisterBooleanPref(prefs::kChromeCreatedLoginItem, false); - registry->RegisterBooleanPref(prefs::kMigratedLoginItemPref, false); - #endif -- registry->RegisterBooleanPref(prefs::kBackgroundModeEnabled, false); -+ registry->RegisterBooleanPref(prefs::kBackgroundModeEnabled, true); - } - - void BackgroundModeManager::RegisterProfile(Profile* profile) { -@@ -899,7 +899,7 @@ gfx::ImageSkia GetStatusTrayIcon() { +@@ -894,7 +894,7 @@ gfx::ImageSkia GetStatusTrayIcon() { return gfx::ImageSkia(); return family->CreateExact(size).AsImageSkia(); -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_PRODUCT_LOGO_128); #elif BUILDFLAG(IS_MAC) diff --git a/www/iridium/files/patch-chrome_browser_browser__features.cc b/www/iridium/files/patch-chrome_browser_browser__features.cc index 94453af65c33..9f627c06d171 100644 --- a/www/iridium/files/patch-chrome_browser_browser__features.cc +++ b/www/iridium/files/patch-chrome_browser_browser__features.cc @@ -1,11 +1,11 @@ ---- chrome/browser/browser_features.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/browser_features.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/browser_features.cc @@ -29,7 +29,7 @@ const base::Feature kColorProviderRedirectionForThemeP // the browser exits. - const base::Feature kDestroyProfileOnBrowserClose{ + const base::Feature kDestroyProfileOnBrowserClose { "DestroyProfileOnBrowserClose", -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) base::FEATURE_ENABLED_BY_DEFAULT }; #else diff --git a/www/iridium/files/patch-chrome_browser_browser__process__impl.cc b/www/iridium/files/patch-chrome_browser_browser__process__impl.cc index 74057c941fd9..95cee6f52e68 100644 --- a/www/iridium/files/patch-chrome_browser_browser__process__impl.cc +++ b/www/iridium/files/patch-chrome_browser_browser__process__impl.cc @@ -1,29 +1,29 @@ ---- chrome/browser/browser_process_impl.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/browser_process_impl.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/browser_process_impl.cc -@@ -208,7 +208,7 @@ +@@ -211,7 +211,7 @@ #include "components/enterprise/browser/controller/chrome_browser_cloud_management_controller.h" #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "chrome/browser/error_reporting/chrome_js_error_report_processor.h" // nogncheck #endif -@@ -1157,7 +1157,7 @@ void BrowserProcessImpl::PreMainMessageLoopRun() { +@@ -1167,7 +1167,7 @@ void BrowserProcessImpl::PreMainMessageLoopRun() { ApplyMetricsReportingPolicy(); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) ChromeJsErrorReportProcessor::Create(); #endif -@@ -1412,7 +1412,7 @@ void BrowserProcessImpl::Unpin() { +@@ -1426,7 +1426,7 @@ void BrowserProcessImpl::Unpin() { // Mac is currently not supported. // TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is // complete. -#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) +#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD) bool BrowserProcessImpl::IsRunningInBackground() const { // Check if browser is in the background. diff --git a/www/iridium/files/patch-chrome_browser_browser__process__impl.h b/www/iridium/files/patch-chrome_browser_browser__process__impl.h index 9e5a00c89bcb..15444c6285c4 100644 --- a/www/iridium/files/patch-chrome_browser_browser__process__impl.h +++ b/www/iridium/files/patch-chrome_browser_browser__process__impl.h @@ -1,11 +1,11 @@ ---- chrome/browser/browser_process_impl.h.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/browser_process_impl.h.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/browser_process_impl.h -@@ -367,7 +367,7 @@ class BrowserProcessImpl : public BrowserProcess, +@@ -363,7 +363,7 @@ class BrowserProcessImpl : public BrowserProcess, // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) +#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD) base::RepeatingTimer autoupdate_timer_; // Gets called by autoupdate timer to see if browser needs restart and can be diff --git a/www/iridium/files/patch-chrome_browser_browser__resources.grd b/www/iridium/files/patch-chrome_browser_browser__resources.grd new file mode 100644 index 000000000000..d8bff188f734 --- /dev/null +++ b/www/iridium/files/patch-chrome_browser_browser__resources.grd @@ -0,0 +1,11 @@ +--- chrome/browser/browser_resources.grd.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/browser_resources.grd +@@ -120,7 +120,7 @@ + + + +- ++ + + + diff --git a/www/iridium/files/patch-chrome_browser_chrome__browser__interface__binders.cc b/www/iridium/files/patch-chrome_browser_chrome__browser__interface__binders.cc index 2a946f8a4781..494c4e4dca4f 100644 --- a/www/iridium/files/patch-chrome_browser_chrome__browser__interface__binders.cc +++ b/www/iridium/files/patch-chrome_browser_chrome__browser__interface__binders.cc @@ -1,71 +1,71 @@ ---- chrome/browser/chrome_browser_interface_binders.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/chrome_browser_interface_binders.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/chrome_browser_interface_binders.cc -@@ -96,13 +96,13 @@ +@@ -113,13 +113,13 @@ #endif // BUILDFLAG(FULL_SAFE_BROWSING) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_CHROMEOS_ASH) + BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD) #include "chrome/browser/ui/webui/connectors_internals/connectors_internals.mojom.h" #include "chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.h" #endif #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) #include "chrome/browser/ui/webui/app_settings/web_app_settings_ui.h" #include "ui/webui/resources/cr_components/app_management/app_management.mojom.h" #endif -@@ -172,7 +172,7 @@ +@@ -188,7 +188,7 @@ #endif // BUILDFLAG(IS_ANDROID) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_CHROMEOS) + BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "chrome/browser/ui/webui/discards/discards.mojom.h" #include "chrome/browser/ui/webui/discards/discards_ui.h" #include "chrome/browser/ui/webui/discards/site_data.mojom.h" -@@ -665,7 +665,7 @@ void PopulateChromeFrameBinders( - #endif +@@ -780,7 +780,7 @@ void PopulateChromeFrameBinders( + #endif // BUILDFLAG(ENABLE_SPEECH_SERVICE) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_CHROMEOS) + BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) if (!render_frame_host->GetParent()) { map->Add( base::BindRepeating(&DraggableRegionsHostImpl::CreateIfAllowed)); -@@ -673,7 +673,7 @@ void PopulateChromeFrameBinders( +@@ -788,7 +788,7 @@ void PopulateChromeFrameBinders( #endif #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \ - BUILDFLAG(IS_WIN) + BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) if (base::FeatureList::IsEnabled(blink::features::kDesktopPWAsSubApps) && - !render_frame_host->GetParent()) { + render_frame_host->IsInPrimaryMainFrame()) { map->Add( -@@ -714,14 +714,14 @@ void PopulateChromeWebUIFrameBinders( +@@ -843,14 +843,14 @@ void PopulateChromeWebUIFrameBinders( SegmentationInternalsUI>(map); #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_CHROMEOS_ASH) + BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD) RegisterWebUIControllerInterfaceBinder< connectors_internals::mojom::PageHandler, enterprise_connectors::ConnectorsInternalsUI>(map); #endif #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) RegisterWebUIControllerInterfaceBinder< app_management::mojom::PageHandlerFactory, WebAppSettingsUI>(map); #endif -@@ -1040,7 +1040,7 @@ void PopulateChromeWebUIFrameBinders( - #endif +@@ -1235,7 +1235,7 @@ void PopulateChromeWebUIFrameBinders( + #endif // BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_CHROMEOS) + BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) RegisterWebUIControllerInterfaceBinder(map); diff --git a/www/iridium/files/patch-chrome_browser_chrome__browser__main.cc b/www/iridium/files/patch-chrome_browser_chrome__browser__main.cc index 8d1ec7ac986c..c08f0e351738 100644 --- a/www/iridium/files/patch-chrome_browser_chrome__browser__main.cc +++ b/www/iridium/files/patch-chrome_browser_chrome__browser__main.cc @@ -1,52 +1,52 @@ ---- chrome/browser/chrome_browser_main.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/chrome_browser_main.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/chrome_browser_main.cc -@@ -231,11 +231,11 @@ +@@ -239,11 +239,11 @@ // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) #include "chrome/browser/first_run/upgrade_util_linux.h" #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "components/crash/core/app/breakpad_linux.h" #include "components/crash/core/app/crashpad.h" #endif -@@ -270,7 +270,7 @@ - +@@ -279,7 +279,7 @@ // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. --#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ -+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \ - (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ +- BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_FUCHSIA) ++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) #include "chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker.h" #include "chrome/browser/metrics/desktop_session_duration/touch_mode_stats_tracker.h" -@@ -1007,7 +1007,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { - AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs); + #include "chrome/browser/profiles/profile_activity_metrics_recorder.h" +@@ -1025,7 +1025,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { + browser_creator_->AddFirstRunTabs(master_prefs_->new_tabs); } -#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // Create directory for user-level Native Messaging manifest files. This // makes it less likely that the directory will be created by third-party // software with incorrect owner or permission. See crbug.com/725513 . -@@ -1020,7 +1020,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { +@@ -1038,7 +1038,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { } #endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) // Set the product channel for crash reports. if (!crash_reporter::IsCrashpadEnabled()) { breakpad::SetChannelCrashKey( -@@ -1041,7 +1041,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { - +@@ -1060,7 +1060,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. --#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ -+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \ - (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ +- BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_FUCHSIA) ++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) metrics::DesktopSessionDurationTracker::Initialize(); ProfileActivityMetricsRecorder::Initialize(); + TouchModeStatsTracker::Initialize( diff --git a/www/iridium/files/patch-chrome_browser_chrome__browser__main__linux.cc b/www/iridium/files/patch-chrome_browser_chrome__browser__main__linux.cc index 51261e2c3142..639795f4c9fb 100644 --- a/www/iridium/files/patch-chrome_browser_chrome__browser__main__linux.cc +++ b/www/iridium/files/patch-chrome_browser_chrome__browser__main__linux.cc @@ -1,20 +1,28 @@ ---- chrome/browser/chrome_browser_main_linux.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/chrome_browser_main_linux.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/chrome_browser_main_linux.cc -@@ -57,7 +57,7 @@ ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLi +@@ -57,13 +57,15 @@ ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLi } void ChromeBrowserMainPartsLinux::PostCreateMainMessageLoop() { --#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) -+#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) || defined(OS_BSD) +-#if BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // No-op: Ash and Lacros Bluetooth DBusManager initialization depend on // FeatureList, and is done elsewhere. - #else -@@ -122,7 +122,7 @@ void ChromeBrowserMainPartsLinux::PostBrowserStart() { + #endif // BUILDFLAG(IS_CHROMEOS) + + #if !BUILDFLAG(IS_CHROMEOS) ++#if !BUILDFLAG(IS_BSD) + bluez::BluezDBusManager::Initialize(nullptr /* system_bus */); ++#endif + + // Set up crypt config. This needs to be done before anything starts the + // network service, as the raw encryption key needs to be shared with the +@@ -123,7 +125,7 @@ void ChromeBrowserMainPartsLinux::PostBrowserStart() { #endif // defined(USE_DBUS) && !BUILDFLAG(IS_CHROMEOS) void ChromeBrowserMainPartsLinux::PostDestroyThreads() { --#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) -+#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) || defined(OS_BSD) +-#if BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // No-op; per PostBrowserStart() comment, this is done elsewhere. #else bluez::BluezDBusManager::Shutdown(); diff --git a/www/iridium/files/patch-chrome_browser_chrome__content__browser__client.cc b/www/iridium/files/patch-chrome_browser_chrome__content__browser__client.cc index e95e330eed44..efd7b9f3a342 100644 --- a/www/iridium/files/patch-chrome_browser_chrome__content__browser__client.cc +++ b/www/iridium/files/patch-chrome_browser_chrome__content__browser__client.cc @@ -1,159 +1,150 @@ ---- chrome/browser/chrome_content_browser_client.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/chrome_content_browser_client.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/chrome_content_browser_client.cc -@@ -374,7 +374,7 @@ +@@ -386,7 +386,7 @@ + #include "components/user_manager/user_manager.h" #include "services/service_manager/public/mojom/interface_provider_spec.mojom.h" #include "storage/browser/file_system/external_mount_points.h" - #include "third_party/cros_system_api/switches/chrome_switches.h" -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) #include "chrome/browser/chrome_browser_main_linux.h" #elif BUILDFLAG(IS_ANDROID) #include "base/android/application_status_listener.h" -@@ -444,17 +444,17 @@ +@@ -467,17 +467,17 @@ // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) #include "chrome/browser/browser_switcher/browser_switcher_navigation_throttle.h" #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "components/crash/core/app/crash_switches.h" #include "components/crash/core/app/crashpad.h" #endif -#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD) #if !BUILDFLAG(IS_ANDROID) #include "base/debug/leak_annotations.h" #include "components/crash/core/app/breakpad_linux.h" -@@ -462,12 +462,12 @@ +@@ -485,12 +485,12 @@ #include "components/crash/content/browser/crash_handler_host_linux.h" #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) #include "chrome/browser/ui/webui/app_settings/web_app_settings_navigation_throttle.h" #endif #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \ - BUILDFLAG(IS_CHROMEOS_ASH) + BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD) #include "chrome/browser/enterprise/connectors/device_trust/navigation_throttle.h" #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || // BUILDFLAG(IS_CHROMEOS_ASH) -@@ -489,11 +489,11 @@ +@@ -514,11 +514,11 @@ // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h" #endif -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) #include "chrome/browser/chrome_browser_main_extra_parts_linux.h" #elif defined(USE_OZONE) #include "chrome/browser/chrome_browser_main_extra_parts_ozone.h" -@@ -880,7 +880,7 @@ blink::mojom::AutoplayPolicy GetAutoplayPolicyForWebCo +@@ -927,7 +927,7 @@ blink::mojom::AutoplayPolicy GetAutoplayPolicyForWebCo int GetCrashSignalFD(const base::CommandLine& command_line) { return crashpad::CrashHandlerHost::Get()->GetDeathSignalSocket(); } -#elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) +#elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD) breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( const std::string& process_type) { base::FilePath dumps_path; -@@ -1376,7 +1376,7 @@ ChromeContentBrowserClient::CreateBrowserMainParts( +@@ -1475,7 +1475,7 @@ ChromeContentBrowserClient::CreateBrowserMainParts(boo #elif BUILDFLAG(IS_CHROMEOS_LACROS) main_parts = std::make_unique( - std::move(parameters), &startup_data_); + is_integration_test, &startup_data_); -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) main_parts = std::make_unique( - std::move(parameters), &startup_data_); + is_integration_test, &startup_data_); #elif BUILDFLAG(IS_ANDROID) -@@ -1410,7 +1410,7 @@ ChromeContentBrowserClient::CreateBrowserMainParts( +@@ -1514,7 +1514,7 @@ ChromeContentBrowserClient::CreateBrowserMainParts(boo std::make_unique()); // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) main_parts->AddParts( std::make_unique()); #else -@@ -1427,7 +1427,7 @@ ChromeContentBrowserClient::CreateBrowserMainParts( +@@ -1535,7 +1535,7 @@ ChromeContentBrowserClient::CreateBrowserMainParts(boo main_parts->AddParts(std::make_unique()); #endif -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) main_parts->AddParts(std::make_unique()); #elif defined(USE_OZONE) main_parts->AddParts(std::make_unique()); -@@ -2101,7 +2101,7 @@ bool ChromeContentBrowserClient::AreDirectSocketsAllow - Profile* profile = Profile::FromBrowserContext(context); - return profile && profile->GetPrefs()->GetBoolean( - policy::policy_prefs::kEnableDirectSockets); --#elif BUILDFLAG(IS_LINUX) -+#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) - // There are currently no reliable way to determine managed status on Linux. - return false; - #elif BUILDFLAG(IS_MAC) -@@ -2190,6 +2190,8 @@ void ChromeContentBrowserClient::AppendExtraCommandLin +@@ -2304,6 +2304,8 @@ void ChromeContentBrowserClient::AppendExtraCommandLin #elif BUILDFLAG(IS_POSIX) #if BUILDFLAG(IS_ANDROID) bool enable_crash_reporter = true; +#elif BUILDFLAG(IS_BSD) + bool enable_crash_reporter = false; #else bool enable_crash_reporter = false; if (crash_reporter::IsCrashpadEnabled()) { -@@ -2498,7 +2500,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLin +@@ -2653,7 +2655,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLin ThreadProfilerConfiguration::Get()->AppendCommandLineSwitchForChildProcess( command_line); --#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) -+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) - // Processes may only query perf_event_open with the BPF sandbox disabled. - if (browser_command_line.HasSwitch(switches::kEnableThreadInstructionCount) && - command_line->HasSwitch(sandbox::policy::switches::kNoSandbox)) { -@@ -3880,7 +3882,7 @@ void ChromeContentBrowserClient::GetAdditionalFileSyst +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD) + // Opt into a hardened stack canary mitigation if it hasn't already been + // force-disabled. + if (!browser_command_line.HasSwitch(switches::kChangeStackGuardOnFork)) { +@@ -4096,7 +4098,7 @@ void ChromeContentBrowserClient::GetAdditionalFileSyst } } -#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD) void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( const base::CommandLine& command_line, int child_process_id, -@@ -4292,14 +4294,14 @@ ChromeContentBrowserClient::CreateThrottlesForNavigati +@@ -4540,14 +4542,14 @@ ChromeContentBrowserClient::CreateThrottlesForNavigati &throttles); } -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) MaybeAddThrottle( WebAppSettingsNavigationThrottle::MaybeCreateThrottleFor(handle), &throttles); #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \ - BUILDFLAG(IS_CHROMEOS_ASH) + BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD) MaybeAddThrottle(enterprise_connectors::DeviceTrustNavigationThrottle:: MaybeCreateThrottleFor(handle), &throttles); -@@ -4332,7 +4334,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigati +@@ -4580,7 +4582,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigati // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) MaybeAddThrottle(browser_switcher::BrowserSwitcherNavigationThrottle:: MaybeCreateThrottleFor(handle), diff --git a/www/iridium/files/patch-chrome_browser_chrome__content__browser__client.h b/www/iridium/files/patch-chrome_browser_chrome__content__browser__client.h index 775dde2be907..645762e24515 100644 --- a/www/iridium/files/patch-chrome_browser_chrome__content__browser__client.h +++ b/www/iridium/files/patch-chrome_browser_chrome__content__browser__client.h @@ -1,11 +1,11 @@ ---- chrome/browser/chrome_content_browser_client.h.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/chrome_content_browser_client.h.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/chrome_content_browser_client.h -@@ -417,7 +417,7 @@ class ChromeContentBrowserClient : public content::Con +@@ -436,7 +436,7 @@ class ChromeContentBrowserClient : public content::Con void OverridePageVisibilityState( content::RenderFrameHost* render_frame_host, content::PageVisibilityState* visibility_state) override; -#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD) void GetAdditionalMappedFilesForChildProcess( const base::CommandLine& command_line, int child_process_id, diff --git a/www/iridium/files/patch-chrome_browser_crash__upload__list_crash__upload__list.cc b/www/iridium/files/patch-chrome_browser_crash__upload__list_crash__upload__list.cc index a5772ad4a0f2..dfd8e3465e24 100644 --- a/www/iridium/files/patch-chrome_browser_crash__upload__list_crash__upload__list.cc +++ b/www/iridium/files/patch-chrome_browser_crash__upload__list_crash__upload__list.cc @@ -1,11 +1,11 @@ ---- chrome/browser/crash_upload_list/crash_upload_list.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/crash_upload_list/crash_upload_list.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/crash_upload_list/crash_upload_list.cc -@@ -52,7 +52,7 @@ scoped_refptr CreateCrashUploadList() { +@@ -50,7 +50,7 @@ scoped_refptr CreateCrashUploadList() { + // which isn't compatible with CrashUploadListCrashpad. crash_sender continues // to log uploads in CrashUploadList::kReporterLogFilename. // Linux is handled below. - #if !(BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) || \ -- BUILDFLAG(IS_LINUX)) -+ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) +-#if !(BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)) ++#if !(BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) if (crash_reporter::IsCrashpadEnabled()) { return new CrashUploadListCrashpad(); } diff --git a/www/iridium/files/patch-chrome_browser_defaults.cc b/www/iridium/files/patch-chrome_browser_defaults.cc index daff6ce7a409..209dcd00c766 100644 --- a/www/iridium/files/patch-chrome_browser_defaults.cc +++ b/www/iridium/files/patch-chrome_browser_defaults.cc @@ -1,11 +1,11 @@ ---- chrome/browser/defaults.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/defaults.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/defaults.cc -@@ -48,7 +48,7 @@ const bool kSyncAutoStarts = true; +@@ -52,7 +52,7 @@ const bool kSyncAutoStarts = true; const bool kSyncAutoStarts = false; #endif -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) const bool kScrollEventChangesTab = true; #else const bool kScrollEventChangesTab = false; diff --git a/www/iridium/files/patch-chrome_browser_dev__ui__browser__resources.grd b/www/iridium/files/patch-chrome_browser_dev__ui__browser__resources.grd index f7a7469be701..c2588411092a 100644 --- a/www/iridium/files/patch-chrome_browser_dev__ui__browser__resources.grd +++ b/www/iridium/files/patch-chrome_browser_dev__ui__browser__resources.grd @@ -1,11 +1,11 @@ ---- chrome/browser/dev_ui_browser_resources.grd.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/dev_ui_browser_resources.grd.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/dev_ui_browser_resources.grd -@@ -46,7 +46,7 @@ This file specifies browser resources for developer-fa - - +@@ -36,7 +36,7 @@ This file specifies browser resources for developer-fa + + -- -+ +- ++ - + diff --git a/www/iridium/files/patch-chrome_browser_download_chrome__download__manager__delegate.cc b/www/iridium/files/patch-chrome_browser_download_chrome__download__manager__delegate.cc index 211cb0a1028f..0c9cd7e4aac7 100644 --- a/www/iridium/files/patch-chrome_browser_download_chrome__download__manager__delegate.cc +++ b/www/iridium/files/patch-chrome_browser_download_chrome__download__manager__delegate.cc @@ -1,47 +1,38 @@ ---- chrome/browser/download/chrome_download_manager_delegate.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/download/chrome_download_manager_delegate.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/download/chrome_download_manager_delegate.cc -@@ -1541,7 +1541,7 @@ void ChromeDownloadManagerDelegate::OnDownloadTargetDe - target_info->is_filetype_handled_safely) - DownloadItemModel(item).SetShouldPreferOpeningInBrowser(true); - --#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) -+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) - if (item->GetOriginalMimeType() == "application/x-x509-user-cert") - DownloadItemModel(item).SetShouldPreferOpeningInBrowser(true); - #endif -@@ -1610,7 +1610,7 @@ void ChromeDownloadManagerDelegate::OnDownloadTargetDe +@@ -1552,7 +1552,7 @@ void ChromeDownloadManagerDelegate::OnDownloadTargetDe bool ChromeDownloadManagerDelegate::IsOpenInBrowserPreferreredForFile( const base::FilePath& path) { #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf"))) { return !download_prefs_->ShouldOpenPdfInSystemReader(); } -@@ -1718,7 +1718,7 @@ void ChromeDownloadManagerDelegate::CheckDownloadAllow +@@ -1668,7 +1668,7 @@ void ChromeDownloadManagerDelegate::CheckDownloadAllow content::CheckDownloadAllowedCallback check_download_allowed_cb) { DCHECK_CURRENTLY_ON(BrowserThread::UI); #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) // Don't download pdf if it is a file URL, as that might cause an infinite // download loop if Chrome is not the system pdf viewer. if (url.SchemeIsFile() && download_prefs_->ShouldOpenPdfInSystemReader()) { -@@ -1760,7 +1760,7 @@ std::unique_ptr +@@ -1710,7 +1710,7 @@ std::unique_ptr ChromeDownloadManagerDelegate::GetRenameHandlerForDownload( download::DownloadItem* download_item) { #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) return enterprise_connectors::FileSystemRenameHandler::CreateIfNeeded( download_item); #else -@@ -1776,7 +1776,7 @@ void ChromeDownloadManagerDelegate::CheckSavePackageAl +@@ -1726,7 +1726,7 @@ void ChromeDownloadManagerDelegate::CheckSavePackageAl DCHECK(download_item->IsSavePackageDownload()); #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) - if (!base::FeatureList::IsEnabled( - download::features::kAllowSavePackageScanning)) { - std::move(callback).Run(true); + absl::optional settings = + safe_browsing::DeepScanningRequest::ShouldUploadBinary(download_item); + diff --git a/www/iridium/files/patch-chrome_browser_download_download__commands.cc b/www/iridium/files/patch-chrome_browser_download_download__commands.cc index 3ba98e4147e4..f12179ed5955 100644 --- a/www/iridium/files/patch-chrome_browser_download_download__commands.cc +++ b/www/iridium/files/patch-chrome_browser_download_download__commands.cc @@ -1,20 +1,20 @@ ---- chrome/browser/download/download_commands.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/download/download_commands.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/download/download_commands.cc -@@ -27,7 +27,7 @@ +@@ -26,7 +26,7 @@ #include "ui/base/clipboard/scoped_clipboard_writer.h" #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" -@@ -168,7 +168,7 @@ void DownloadCommands::ExecuteCommand(Command command) +@@ -167,7 +167,7 @@ void DownloadCommands::ExecuteCommand(Command command) } #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) Browser* DownloadCommands::GetBrowser() const { if (!model_) diff --git a/www/iridium/files/patch-chrome_browser_download_download__commands.h b/www/iridium/files/patch-chrome_browser_download_download__commands.h index 98a6891d7a22..48fb7e08c9b1 100644 --- a/www/iridium/files/patch-chrome_browser_download_download__commands.h +++ b/www/iridium/files/patch-chrome_browser_download_download__commands.h @@ -1,11 +1,11 @@ ---- chrome/browser/download/download_commands.h.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/download/download_commands.h.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/download/download_commands.h -@@ -54,7 +54,7 @@ class DownloadCommands { +@@ -55,7 +55,7 @@ class DownloadCommands { void ExecuteCommand(Command command); #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) bool IsDownloadPdf() const; bool CanOpenPdfInSystemViewer() const; Browser* GetBrowser() const; diff --git a/www/iridium/files/patch-chrome_browser_download_download__file__picker.cc b/www/iridium/files/patch-chrome_browser_download_download__file__picker.cc new file mode 100644 index 000000000000..9b9a3e9b3e0d --- /dev/null +++ b/www/iridium/files/patch-chrome_browser_download_download__file__picker.cc @@ -0,0 +1,20 @@ +--- chrome/browser/download/download_file_picker.cc.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/download/download_file_picker.cc +@@ -16,7 +16,7 @@ + #include "content/public/browser/download_manager.h" + #include "content/public/browser/web_contents.h" + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) + #include "chrome/browser/ui/browser_list.h" + #include "chrome/browser/ui/browser_window.h" + #include "ui/aura/window.h" +@@ -84,7 +84,7 @@ DownloadFilePicker::DownloadFilePicker(download::Downl + // dialog in Linux (See SelectFileImpl() in select_file_dialog_linux_gtk.cc). + // and windows.Here we make owning_window host to browser current active + // window if it is null. https://crbug.com/1301898 +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) + if (!owning_window || !owning_window->GetHost()) { + owning_window = BrowserList::GetInstance() + ->GetLastActive() diff --git a/www/iridium/files/patch-chrome_browser_download_download__item__model.cc b/www/iridium/files/patch-chrome_browser_download_download__item__model.cc index 49f14ac32745..8d188458ea48 100644 --- a/www/iridium/files/patch-chrome_browser_download_download__item__model.cc +++ b/www/iridium/files/patch-chrome_browser_download_download__item__model.cc @@ -1,20 +1,29 @@ ---- chrome/browser/download/download_item_model.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/download/download_item_model.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/download/download_item_model.cc -@@ -640,7 +640,7 @@ bool DownloadItemModel::IsCommandChecked( +@@ -731,7 +731,7 @@ bool DownloadItemModel::IsCommandChecked( download_crx_util::IsExtensionDownload(*download_); case DownloadCommands::ALWAYS_OPEN_TYPE: #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) if (download_commands->CanOpenPdfInSystemViewer()) { DownloadPrefs* prefs = DownloadPrefs::FromBrowserContext(profile()); return prefs->ShouldOpenPdfInSystemReader(); -@@ -681,7 +681,7 @@ void DownloadItemModel::ExecuteCommand(DownloadCommand +@@ -773,7 +773,7 @@ void DownloadItemModel::ExecuteCommand(DownloadCommand DownloadCommands::ALWAYS_OPEN_TYPE); DownloadPrefs* prefs = DownloadPrefs::FromBrowserContext(profile()); #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) if (download_commands->CanOpenPdfInSystemViewer()) { prefs->SetShouldOpenPdfInSystemReader(!is_checked); SetShouldPreferOpeningInBrowser(is_checked); +@@ -1087,7 +1087,7 @@ void DownloadItemModel::DetermineAndSetShouldPreferOpe + return; + } + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) + if (download_->GetOriginalMimeType() == "application/x-x509-user-cert") { + SetShouldPreferOpeningInBrowser(true); + return; diff --git a/www/iridium/files/patch-chrome_browser_download_download__prefs.cc b/www/iridium/files/patch-chrome_browser_download_download__prefs.cc index fc8510595e77..154af636edab 100644 --- a/www/iridium/files/patch-chrome_browser_download_download__prefs.cc +++ b/www/iridium/files/patch-chrome_browser_download_download__prefs.cc @@ -1,99 +1,90 @@ ---- chrome/browser/download/download_prefs.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/download/download_prefs.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/download/download_prefs.cc @@ -13,6 +13,7 @@ #include "base/callback_helpers.h" #include "base/check.h" #include "base/cxx17_backports.h" +#include "base/command_line.h" #include "base/feature_list.h" #include "base/files/file_util.h" #include "base/no_destructor.h" -@@ -60,6 +61,10 @@ +@@ -61,6 +62,10 @@ #include "chrome/browser/ui/pdf/adobe_reader_info_win.h" #endif +#if BUILDFLAG(IS_OPENBSD) +#include "sandbox/policy/openbsd/sandbox_openbsd.h" +#endif + using content::BrowserContext; using content::BrowserThread; using content::DownloadManager; -@@ -70,7 +75,7 @@ namespace { +@@ -71,7 +76,7 @@ namespace { // Consider downloads 'dangerous' if they go to the home directory on Linux and // to the desktop on any platform. bool DownloadPathIsDangerous(const base::FilePath& download_path) { -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) base::FilePath home_dir = base::GetHomeDir(); if (download_path == home_dir) { return true; -@@ -168,7 +173,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profi +@@ -182,7 +187,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profi #endif // BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) should_open_pdf_in_system_reader_ = prefs->GetBoolean(prefs::kOpenPdfDownloadInSystemReader); #endif -@@ -287,7 +292,7 @@ void DownloadPrefs::RegisterProfilePrefs( - registry->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory, - default_download_path); +@@ -302,7 +307,7 @@ void DownloadPrefs::RegisterProfilePrefs( + registry->RegisterTimePref(prefs::kDownloadLastCompleteTime, + /*default_value=*/base::Time()); #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) registry->RegisterBooleanPref(prefs::kOpenPdfDownloadInSystemReader, false); #endif #if BUILDFLAG(IS_ANDROID) -@@ -421,7 +426,7 @@ bool DownloadPrefs::IsDownloadPathManaged() const { - - bool DownloadPrefs::IsAutoOpenByUserUsed() const { - #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ -- BUILDFLAG(IS_MAC) -+ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) - if (ShouldOpenPdfInSystemReader()) - return true; - #endif -@@ -436,7 +441,7 @@ bool DownloadPrefs::IsAutoOpenEnabled(const GURL& url, - DCHECK(extension[0] == base::FilePath::kExtensionSeparator); - extension.erase(0, 1); - #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ -- BUILDFLAG(IS_MAC) -+ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) - if (base::FilePath::CompareEqualIgnoreCase(extension, - FILE_PATH_LITERAL("pdf")) && - ShouldOpenPdfInSystemReader()) -@@ -491,7 +496,7 @@ void DownloadPrefs::DisableAutoOpenByUserBasedOnExtens +@@ -483,7 +488,7 @@ void DownloadPrefs::DisableAutoOpenByUserBasedOnExtens } #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) void DownloadPrefs::SetShouldOpenPdfInSystemReader(bool should_open) { if (should_open_pdf_in_system_reader_ == should_open) return; -@@ -513,7 +518,7 @@ bool DownloadPrefs::ShouldOpenPdfInSystemReader() cons +@@ -515,7 +520,7 @@ bool DownloadPrefs::ShouldOpenPdfInSystemReader() cons void DownloadPrefs::ResetAutoOpenByUser() { #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) SetShouldOpenPdfInSystemReader(false); #endif auto_open_by_user_.clear(); -@@ -653,7 +658,14 @@ base::FilePath DownloadPrefs::SanitizeDownloadTargetPa +@@ -546,7 +551,7 @@ void DownloadPrefs::SaveAutoOpenState() { + bool DownloadPrefs::CanPlatformEnableAutoOpenForPdf() const { + #if BUILDFLAG(IS_CHROMEOS) + return false; // There is no UI for auto-open on ChromeOS. +-#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) ++#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) + return ShouldOpenPdfInSystemReader(); + #else + return false; +@@ -670,7 +675,14 @@ base::FilePath DownloadPrefs::SanitizeDownloadTargetPa #else // If the stored download directory is an absolute path, we presume it's // correct; there's not really much more validation we can do here. +#if BUILDFLAG(IS_OPENBSD) + // If unveil(2) is used, force the file dialog directory to something we + // know is available. + auto* sandbox = sandbox::policy::SandboxLinux::GetInstance(); + if (!sandbox->unveil_initialized() && path.IsAbsolute()) +#else if (path.IsAbsolute()) +#endif return path; // When the default download directory is *not* an absolute path, we use the diff --git a/www/iridium/files/patch-chrome_browser_download_download__prefs.h b/www/iridium/files/patch-chrome_browser_download_download__prefs.h index 05fb541074b9..e920f9239b18 100644 --- a/www/iridium/files/patch-chrome_browser_download_download__prefs.h +++ b/www/iridium/files/patch-chrome_browser_download_download__prefs.h @@ -1,20 +1,20 @@ ---- chrome/browser/download/download_prefs.h.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/download/download_prefs.h.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/download/download_prefs.h -@@ -122,7 +122,7 @@ class DownloadPrefs { +@@ -125,7 +125,7 @@ class DownloadPrefs { void DisableAutoOpenByUserBasedOnExtension(const base::FilePath& file_name); #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) // Store the user preference to disk. If |should_open| is true, also disable // the built-in PDF plugin. If |should_open| is false, enable the PDF plugin. void SetShouldOpenPdfInSystemReader(bool should_open); -@@ -181,7 +181,7 @@ class DownloadPrefs { +@@ -185,7 +185,7 @@ class DownloadPrefs { std::unique_ptr auto_open_allowed_by_urls_; #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_MAC) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) bool should_open_pdf_in_system_reader_; #endif diff --git a/www/iridium/files/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc b/www/iridium/files/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc new file mode 100644 index 000000000000..e6d1c49f5703 --- /dev/null +++ b/www/iridium/files/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc @@ -0,0 +1,16 @@ +--- chrome/browser/enterprise/connectors/analysis/analysis_service_settings.cc.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/enterprise/connectors/analysis/analysis_service_settings.cc +@@ -142,11 +142,11 @@ AnalysisServiceSettings::AnalysisServiceSettings( + const char* verification_key = kKeyWindowsVerification; + #elif BUILDFLAG(IS_MAC) + const char* verification_key = kKeyMacVerification; +-#elif BUILDFLAG(IS_LINUX) ++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + const char* verification_key = kKeyLinuxVerification; + #endif + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + const base::Value::Dict& dict = settings_value.GetDict(); + const base::Value::List* signatures = + dict.FindListByDottedPath(verification_key); diff --git a/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc b/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc index 1a745951bc9a..f5bb819f9561 100644 --- a/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc +++ b/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc @@ -1,29 +1,43 @@ ---- chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.cc -@@ -12,7 +12,7 @@ - #include "components/keyed_service/content/browser_context_dependency_manager.h" +@@ -11,11 +11,11 @@ + #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/core/keyed_service.h" -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) #include "chrome/browser/browser_process.h" + #if BUILDFLAG(IS_MAC) + #include "chrome/browser/enterprise/connectors/device_trust/browser/mac_device_trust_connector_service.h" +-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) ++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) #include "chrome/browser/enterprise/connectors/device_trust/browser/browser_device_trust_connector_service.h" + #endif // BUILDFLAG(IS_MAC) #include "chrome/browser/policy/chrome_browser_policy_connector.h" -@@ -37,7 +37,7 @@ DeviceTrustConnectorService* DeviceTrustConnectorServi +@@ -40,7 +40,7 @@ DeviceTrustConnectorService* DeviceTrustConnectorServi bool DeviceTrustConnectorServiceFactory::ServiceIsCreatedWithBrowserContext() const { -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) return IsDeviceTrustConnectorFeatureEnabled(); #else return false; -@@ -58,7 +58,7 @@ KeyedService* DeviceTrustConnectorServiceFactory::Buil +@@ -59,7 +59,7 @@ KeyedService* DeviceTrustConnectorServiceFactory::Buil DeviceTrustConnectorService* service = nullptr; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) if (IsDeviceTrustConnectorFeatureEnabled()) { auto* key_manager = g_browser_process->browser_policy_connector() ->chrome_browser_cloud_management_controller() +@@ -67,7 +67,7 @@ KeyedService* DeviceTrustConnectorServiceFactory::Buil + #if BUILDFLAG(IS_MAC) + service = new MacDeviceTrustConnectorService( + key_manager, profile->GetPrefs(), g_browser_process->local_state()); +-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) ++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) + service = new BrowserDeviceTrustConnectorService(key_manager, + profile->GetPrefs()); + #endif // BUILDFLAG(IS_MAC) diff --git a/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc b/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc index 6f4bd21ea237..4fc9d6baf8d2 100644 --- a/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc +++ b/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc @@ -1,11 +1,11 @@ ---- chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.cc -@@ -21,7 +21,7 @@ - #include "components/policy/content/policy_blocklist_service.h" +@@ -22,7 +22,7 @@ + #include "components/policy/core/common/management/management_service.h" #include "content/public/browser/browser_context.h" -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) #include "chrome/browser/browser_process.h" #include "chrome/browser/enterprise/connectors/device_trust/attestation/desktop/desktop_attestation_service.h" #include "chrome/browser/policy/chrome_browser_policy_connector.h" diff --git a/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc b/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc new file mode 100644 index 000000000000..f1f86114fc4d --- /dev/null +++ b/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc @@ -0,0 +1,20 @@ +--- chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/key_rotation_command_factory.cc.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/key_rotation_command_factory.cc +@@ -13,7 +13,7 @@ + + #if BUILDFLAG(IS_WIN) + #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/win_key_rotation_command.h" +-#elif BUILDFLAG(IS_LINUX) ++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/linux_key_rotation_command.h" + #elif BUILDFLAG(IS_MAC) + #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/mac_key_rotation_command.h" +@@ -45,7 +45,7 @@ std::unique_ptr KeyRotationCommand + scoped_refptr url_loader_factory) { + #if BUILDFLAG(IS_WIN) + return std::make_unique(); +-#elif BUILDFLAG(IS_LINUX) ++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + return std::make_unique(url_loader_factory); + #elif BUILDFLAG(IS_MAC) + return std::make_unique(url_loader_factory); diff --git a/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc b/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc index bed7ce934607..60b3857d4abd 100644 --- a/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc +++ b/www/iridium/files/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc @@ -1,20 +1,20 @@ ---- chrome/browser/enterprise/connectors/device_trust/signals/signals_service_factory.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/enterprise/connectors/device_trust/signals/signals_service_factory.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/enterprise/connectors/device_trust/signals/signals_service_factory.cc -@@ -14,7 +14,7 @@ - #include "chrome/browser/enterprise/connectors/device_trust/signals/signals_service_impl.h" +@@ -15,7 +15,7 @@ #include "chrome/browser/profiles/profile.h" + #include "components/policy/core/common/management/management_service.h" -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) #include "base/check.h" #include "chrome/browser/enterprise/connectors/device_trust/signals/decorators/browser/browser_signals_decorator.h" #include "chrome/browser/policy/chrome_browser_policy_connector.h" -@@ -44,7 +44,7 @@ std::unique_ptr CreateSignalsService( +@@ -52,7 +52,7 @@ std::unique_ptr CreateSignalsService( decorators.push_back( std::make_unique(policy_blocklist_service)); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) - policy::ChromeBrowserPolicyConnector* browser_policy_connector = - g_browser_process->browser_policy_connector(); - DCHECK(browser_policy_connector); + policy::CloudPolicyStore* store = nullptr; + + // Managed device. diff --git a/www/iridium/files/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc b/www/iridium/files/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc new file mode 100644 index 000000000000..aca8bb196f9c --- /dev/null +++ b/www/iridium/files/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc @@ -0,0 +1,19 @@ +--- chrome/browser/enterprise/connectors/reporting/browser_crash_event_router.cc.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/enterprise/connectors/reporting/browser_crash_event_router.cc +@@ -18,14 +18,14 @@ + #include "chrome/common/chrome_paths.h" + #include "components/version_info/version_info.h" + +-#if !BUILDFLAG(IS_FUCHSIA) ++#if !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_BSD) + #include "components/crash/core/app/crashpad.h" + #include "third_party/crashpad/crashpad/client/crash_report_database.h" + #endif // !BUILDFLAG(IS_FUCHSIA) + + namespace enterprise_connectors { + +-#if !BUILDFLAG(IS_FUCHSIA) ++#if !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_BSD) + namespace { + // key names used when building the dictionary to pass to the real-time + // reporting API diff --git a/www/iridium/files/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.h b/www/iridium/files/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.h new file mode 100644 index 000000000000..8b0d93510578 --- /dev/null +++ b/www/iridium/files/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.h @@ -0,0 +1,20 @@ +--- chrome/browser/enterprise/connectors/reporting/browser_crash_event_router.h.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/enterprise/connectors/reporting/browser_crash_event_router.h +@@ -22,7 +22,7 @@ class BrowserCrashEventRouter + BrowserCrashEventRouter& operator=(const BrowserCrashEventRouter&) = delete; + ~BrowserCrashEventRouter() override; + +-#if !BUILDFLAG(IS_FUCHSIA) ++#if !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_BSD) + void OnCloudReportingLaunched( + enterprise_reporting::ReportScheduler* report_scheduler) override; + #endif // !BUILDFLAG(IS_FUCHSIA) +@@ -32,7 +32,7 @@ class BrowserCrashEventRouter + nullptr; + raw_ptr controller_ = nullptr; + +-#if !BUILDFLAG(IS_FUCHSIA) ++#if !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_BSD) + // ReportCrashes() checks the enterprise policy settings, retrieves crash + // reports from the crashpad local database and sends reports that have not + // been sent to the reporting server. diff --git a/www/iridium/files/patch-chrome_browser_extensions_BUILD.gn b/www/iridium/files/patch-chrome_browser_extensions_BUILD.gn index 37560db6f1c2..d390d215f8bd 100644 --- a/www/iridium/files/patch-chrome_browser_extensions_BUILD.gn +++ b/www/iridium/files/patch-chrome_browser_extensions_BUILD.gn @@ -1,13 +1,13 @@ ---- chrome/browser/extensions/BUILD.gn.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/extensions/BUILD.gn.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/extensions/BUILD.gn -@@ -1299,6 +1299,10 @@ static_library("extensions") { +@@ -1332,6 +1332,10 @@ static_library("extensions") { deps += [ "//chrome/services/printing/public/mojom" ] } + if (is_bsd) { + sources -= [ "api/image_writer_private/removable_storage_provider_linux.cc" ] + } + if (enable_service_discovery) { sources += [ "api/mdns/mdns_api.cc", diff --git a/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc b/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc index 71c1a2728610..bb8fb75590cd 100644 --- a/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc +++ b/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc @@ -1,29 +1,29 @@ ---- chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc @@ -24,7 +24,7 @@ #include "base/win/registry.h" #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "base/environment.h" #include "base/nix/xdg_util.h" #endif -@@ -208,7 +208,7 @@ base::FilePath GetEndpointVerificationDir() { +@@ -256,7 +256,7 @@ base::FilePath GetEndpointVerificationDir() { bool got_path = false; #if BUILDFLAG(IS_WIN) got_path = base::PathService::Get(base::DIR_LOCAL_APP_DATA, &path); -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) std::unique_ptr env(base::Environment::Create()); path = base::nix::GetXDGDirectory(env.get(), base::nix::kXdgConfigHomeEnvVar, base::nix::kDotConfigDir); -@@ -219,7 +219,7 @@ base::FilePath GetEndpointVerificationDir() { +@@ -267,7 +267,7 @@ base::FilePath GetEndpointVerificationDir() { if (!got_path) return path; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) path = path.AppendASCII("google"); #else path = path.AppendASCII("Google"); diff --git a/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc b/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc new file mode 100644 index 000000000000..d16ed579902c --- /dev/null +++ b/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc @@ -0,0 +1,11 @@ +--- chrome/browser/extensions/api/enterprise_reporting_private/conversion_utils.cc.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/extensions/api/enterprise_reporting_private/conversion_utils.cc +@@ -6,7 +6,7 @@ + + #include "build/build_config.h" + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + + #include + #include diff --git a/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h b/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h new file mode 100644 index 000000000000..25d560bc078a --- /dev/null +++ b/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h @@ -0,0 +1,11 @@ +--- chrome/browser/extensions/api/enterprise_reporting_private/conversion_utils.h.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/extensions/api/enterprise_reporting_private/conversion_utils.h +@@ -7,7 +7,7 @@ + + #include "build/build_config.h" + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + + #include + diff --git a/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc b/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc index 9e8b0249e655..519a666554c7 100644 --- a/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc +++ b/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc @@ -1,11 +1,38 @@ ---- chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc -@@ -155,7 +155,7 @@ EnterpriseReportingPrivateGetDeviceIdFunction:: +@@ -31,7 +31,7 @@ + #include "components/reporting/util/statusor.h" + #endif + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + #include "base/strings/string_util.h" + #include "chrome/browser/enterprise/signals/signals_aggregator_factory.h" + #include "chrome/browser/extensions/api/enterprise_reporting_private/conversion_utils.h" +@@ -155,7 +155,7 @@ api::enterprise_reporting_private::ContextInfo ToConte + return info; + } + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + + device_signals::SignalsAggregationRequest CreateAggregationRequest( + const std::string& user_id, +@@ -215,7 +215,7 @@ EnterpriseReportingPrivateGetDeviceIdFunction:: // getPersistentSecret -#if !BUILDFLAG(IS_LINUX) +#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD) EnterpriseReportingPrivateGetPersistentSecretFunction:: EnterpriseReportingPrivateGetPersistentSecretFunction() = default; +@@ -655,7 +655,7 @@ void EnterpriseReportingPrivateEnqueueRecordFunction:: + } + #endif + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + + // getFileSystemInfo + diff --git a/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h b/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h index a0b9e6578dba..459dd1553853 100644 --- a/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h +++ b/www/iridium/files/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h @@ -1,11 +1,29 @@ ---- chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h -@@ -45,7 +45,7 @@ class EnterpriseReportingPrivateGetDeviceIdFunction : +@@ -19,7 +19,7 @@ + #include "components/reporting/proto/synced/record.pb.h" + #include "components/reporting/proto/synced/record_constants.pb.h" + #include "components/reporting/util/statusor.h" +-#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + #include "components/device_signals/core/browser/signals_types.h" + #endif // BUILDFLAG(IS_CHROMEOS) + +@@ -54,7 +54,7 @@ class EnterpriseReportingPrivateGetDeviceIdFunction : ~EnterpriseReportingPrivateGetDeviceIdFunction() override; }; -#if !BUILDFLAG(IS_LINUX) +#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD) class EnterpriseReportingPrivateGetPersistentSecretFunction : public ExtensionFunction { +@@ -264,7 +264,7 @@ class EnterpriseReportingPrivateEnqueueRecordFunction + + #endif + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + + class EnterpriseReportingPrivateGetFileSystemInfoFunction + : public ExtensionFunction { diff --git a/www/iridium/files/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc b/www/iridium/files/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc index 64813d2cf340..5a02959f36c8 100644 --- a/www/iridium/files/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc +++ b/www/iridium/files/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc @@ -1,20 +1,20 @@ ---- chrome/browser/extensions/api/image_writer_private/removable_storage_provider.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/extensions/api/image_writer_private/removable_storage_provider.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/extensions/api/image_writer_private/removable_storage_provider.cc -@@ -22,6 +22,7 @@ static base::LazyInstancePostTask( FROM_HERE, -@@ -35,6 +36,9 @@ void RemovableStorageProvider::GetAllDevices(DeviceLis +@@ -34,6 +35,9 @@ void RemovableStorageProvider::GetAllDevices(DeviceLis base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, base::BindOnce(&RemovableStorageProvider::PopulateDeviceList), std::move(callback)); +#else + NOTIMPLEMENTED(); +#endif } // static diff --git a/www/iridium/files/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc b/www/iridium/files/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc index 28742ea1988b..1875d794c31a 100644 --- a/www/iridium/files/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc +++ b/www/iridium/files/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc @@ -1,20 +1,20 @@ ---- chrome/browser/extensions/api/settings_private/prefs_util.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/extensions/api/settings_private/prefs_util.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/extensions/api/settings_private/prefs_util.cc -@@ -182,7 +182,7 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlist +@@ -187,7 +187,7 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlist // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) (*s_allowlist)[::prefs::kUseCustomChromeFrame] = settings_api::PrefType::PREF_TYPE_BOOLEAN; #endif -@@ -196,7 +196,7 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlist +@@ -201,7 +201,7 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlist settings_api::PrefType::PREF_TYPE_NUMBER; // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) (*s_allowlist)[::prefs::kUsesSystemTheme] = settings_api::PrefType::PREF_TYPE_BOOLEAN; #endif diff --git a/www/iridium/files/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc b/www/iridium/files/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc index c2d7a575d820..d75962f3a55c 100644 --- a/www/iridium/files/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc +++ b/www/iridium/files/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc @@ -1,29 +1,29 @@ ---- chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc -@@ -30,7 +30,7 @@ +@@ -29,7 +29,7 @@ #include "extensions/browser/process_manager.h" #include "extensions/common/error_utils.h" -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "extensions/common/permissions/permissions_data.h" #endif -@@ -39,7 +39,7 @@ namespace { +@@ -38,7 +38,7 @@ namespace { bool CanEnableAudioDebugRecordingsFromExtension( const extensions::Extension* extension) { bool enabled_by_permissions = false; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) if (extension) { enabled_by_permissions = extension->permissions_data()->active_permissions().HasAPIPermission( @@ -580,7 +580,7 @@ void WebrtcLoggingPrivateStartEventLoggingFunction::Fi ExtensionFunction::ResponseAction WebrtcLoggingPrivateGetLogsDirectoryFunction::Run() { -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // Unlike other WebrtcLoggingPrivate functions that take a RequestInfo object, // this function shouldn't be called by a component extension on behalf of // some web code. It returns a DirectoryEntry for use directly in the calling diff --git a/www/iridium/files/patch-chrome_browser_extensions_browser__context__keyed__service__factories.cc b/www/iridium/files/patch-chrome_browser_extensions_browser__context__keyed__service__factories.cc index c98fc0f0510a..4ff312c9f9a5 100644 --- a/www/iridium/files/patch-chrome_browser_extensions_browser__context__keyed__service__factories.cc +++ b/www/iridium/files/patch-chrome_browser_extensions_browser__context__keyed__service__factories.cc @@ -1,20 +1,20 @@ ---- chrome/browser/extensions/browser_context_keyed_service_factories.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/extensions/browser_context_keyed_service_factories.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/extensions/browser_context_keyed_service_factories.cc -@@ -52,7 +52,7 @@ +@@ -53,7 +53,7 @@ #include "extensions/browser/api/networking_private/networking_private_delegate_factory.h" #include "ppapi/buildflags/buildflags.h" -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) #include "chrome/browser/extensions/api/system_indicator/system_indicator_manager_factory.h" #endif -@@ -124,7 +124,7 @@ void EnsureBrowserContextKeyedServiceFactoriesBuilt() +@@ -122,7 +122,7 @@ void EnsureBrowserContextKeyedServiceFactoriesBuilt() extensions::SettingsPrivateEventRouterFactory::GetInstance(); extensions::SettingsOverridesAPI::GetFactoryInstance(); - extensions::SignedInDevicesManager::GetFactoryInstance(); + extensions::SidePanelService::GetFactoryInstance(); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) extensions::SystemIndicatorManagerFactory::GetInstance(); #endif extensions::TabGroupsEventRouterFactory::GetInstance(); diff --git a/www/iridium/files/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.cc b/www/iridium/files/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.cc index 3e8b30e0e335..1e2ff2cddb93 100644 --- a/www/iridium/files/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.cc +++ b/www/iridium/files/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.cc @@ -1,11 +1,11 @@ ---- chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc -@@ -217,7 +217,7 @@ const struct { +@@ -254,7 +254,7 @@ const struct { {base::DIR_HOME, FILE_PATH_LITERAL("Library/Mobile Documents"), kDontBlockChildren}, #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // On Linux also block access to devices via /dev, as well as security // sensitive data in /sys and /proc. {kNoBasePathKey, FILE_PATH_LITERAL("/dev"), kBlockAllChildren}, diff --git a/www/iridium/files/patch-chrome_browser_first__run_first__run__internal.h b/www/iridium/files/patch-chrome_browser_first__run_first__run__internal.h index de61b89cd961..3eb6923fa7a0 100644 --- a/www/iridium/files/patch-chrome_browser_first__run_first__run__internal.h +++ b/www/iridium/files/patch-chrome_browser_first__run_first__run__internal.h @@ -1,11 +1,11 @@ ---- chrome/browser/first_run/first_run_internal.h.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/first_run/first_run_internal.h.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/first_run/first_run_internal.h -@@ -58,7 +58,7 @@ FirstRunState DetermineFirstRunState(bool has_sentinel +@@ -56,7 +56,7 @@ FirstRunState DetermineFirstRunState(bool has_sentinel + bool force_first_run, + bool no_first_run); - // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch - // of lacros-chrome is complete. --#if BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) -+#if BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD) +-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) // For testing, forces the first run dialog to either be shown or not. If not // called, the decision to show the dialog or not will be made by Chrome based // on a number of factors (such as install type, whether it's a Chrome-branded diff --git a/www/iridium/files/patch-chrome_browser_flag__descriptions.cc b/www/iridium/files/patch-chrome_browser_flag__descriptions.cc index 1c3cfa8f1871..974da531f97a 100644 --- a/www/iridium/files/patch-chrome_browser_flag__descriptions.cc +++ b/www/iridium/files/patch-chrome_browser_flag__descriptions.cc @@ -1,56 +1,65 @@ ---- chrome/browser/flag_descriptions.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/flag_descriptions.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/flag_descriptions.cc -@@ -5508,7 +5508,7 @@ const char kDownloadShelfWebUIDescription[] = +@@ -6226,7 +6226,7 @@ const char kSideSearchDSESupportDescription[] = // Random platform combinations ----------------------------------------------- - #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ -- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) -+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) - - const char kWebuiFeedbackName[] = "WebUI Feedback"; - const char kWebuiFeedbackDescription[] = -@@ -5519,7 +5519,7 @@ const char kWebuiFeedbackDescription[] = - // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) - #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) + const char kQuickCommandsName[] = "Quick Commands"; + const char kQuickCommandsDescription[] = + "Enable a text interface to browser features. Invoke with Ctrl-Space."; +@@ -6235,7 +6235,7 @@ const char kQuickCommandsDescription[] = + // BUILDFLAG(IS_FUCHSIA) - const char kCommanderName[] = "Commander"; - const char kCommanderDescription[] = -@@ -5545,7 +5545,7 @@ const char kWebShareDescription[] = + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ +- BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_CHROMEOS) ++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) + const char kFollowingFeedSidepanelName[] = "Following feed in the sidepanel"; + const char kFollowingFeedSidepanelDescription[] = + "Enables the following feed in the sidepanel."; +@@ -6249,7 +6249,7 @@ const char kWebShareDescription[] = "platforms."; #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) -#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) +#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD) const char kOzonePlatformHintChoiceDefault[] = "Default"; const char kOzonePlatformHintChoiceAuto[] = "Auto"; const char kOzonePlatformHintChoiceX11[] = "X11"; -@@ -5557,7 +5557,7 @@ const char kOzonePlatformHintDescription[] = - "\"X11\". \"Auto\" selects Wayland if possible, X11 otherwise. "; - #endif // BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) +@@ -6269,7 +6269,7 @@ const char kWebBluetoothConfirmPairingSupportDescripti + "Bluetooth"; + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) const char kCleanUndecryptablePasswordsLinuxName[] = "Cleanup local undecryptable passwords during initial sync flow"; const char kCleanUndecryptablePasswordsLinuxDescription[] = -@@ -5570,7 +5570,7 @@ const char kForcePasswordInitialSyncWhenDecryptionFail +@@ -6282,7 +6282,7 @@ const char kForcePasswordInitialSyncWhenDecryptionFail "storage and requests initial sync."; #endif // BUILDFLAG(IS_LINUX) -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) const char kSkipUndecryptablePasswordsName[] = "Skip undecryptable passwords to use the available decryptable " "passwords."; -@@ -5687,7 +5687,7 @@ const char kElasticOverscrollDescription[] = +@@ -6291,7 +6291,7 @@ const char kSkipUndecryptablePasswordsDescription[] = + "there are undecryptable ones."; + #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + const char kAsyncDnsName[] = "Async DNS resolver"; + const char kAsyncDnsDescription[] = "Enables the built-in DNS resolver."; + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) +@@ -6396,7 +6396,7 @@ const char kElasticOverscrollDescription[] = #if BUILDFLAG(IS_WIN) || \ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \ - BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) const char kUIDebugToolsName[] = "Debugging tools for UI"; const char kUIDebugToolsDescription[] = "Enables additional keyboard shortcuts to help debugging."; diff --git a/www/iridium/files/patch-chrome_browser_flag__descriptions.h b/www/iridium/files/patch-chrome_browser_flag__descriptions.h index 852395a2e121..66ef087962bd 100644 --- a/www/iridium/files/patch-chrome_browser_flag__descriptions.h +++ b/www/iridium/files/patch-chrome_browser_flag__descriptions.h @@ -1,47 +1,51 @@ ---- chrome/browser/flag_descriptions.h.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/flag_descriptions.h.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/flag_descriptions.h -@@ -3178,7 +3178,7 @@ extern const char kDownloadShelfWebUIDescription[]; +@@ -3574,7 +3574,7 @@ extern const char kSideSearchDSESupportDescription[]; // Random platform combinations ----------------------------------------------- - #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ -- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) -+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) - - extern const char kWebuiFeedbackName[]; - extern const char kWebuiFeedbackDescription[]; -@@ -3187,7 +3187,7 @@ extern const char kWebuiFeedbackDescription[]; - // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) - #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) + extern const char kQuickCommandsName[]; + extern const char kQuickCommandsDescription[]; - extern const char kCommanderName[]; - extern const char kCommanderDescription[]; -@@ -3206,7 +3206,7 @@ extern const char kWebShareName[]; - extern const char kWebShareDescription[]; - #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) +@@ -3591,7 +3591,7 @@ extern const char kWebBluetoothConfirmPairingSupportNa + extern const char kWebBluetoothConfirmPairingSupportDescription[]; + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) extern const char kOzonePlatformHintChoiceDefault[]; extern const char kOzonePlatformHintChoiceAuto[]; extern const char kOzonePlatformHintChoiceX11[]; -@@ -3222,7 +3222,7 @@ extern const char kForcePasswordInitialSyncWhenDecrypt +@@ -3607,18 +3607,18 @@ extern const char kForcePasswordInitialSyncWhenDecrypt extern const char kForcePasswordInitialSyncWhenDecryptionFailsDescription[]; #endif // BUILDFLAG(IS_LINUX) -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) extern const char kSkipUndecryptablePasswordsName[]; extern const char kSkipUndecryptablePasswordsDescription[]; #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) -@@ -3304,7 +3304,7 @@ extern const char kElasticOverscrollDescription[]; + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + extern const char kAsyncDnsName[]; + extern const char kAsyncDnsDescription[]; + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) + + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ +- BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_CHROMEOS) ++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) + extern const char kFollowingFeedSidepanelName[]; + extern const char kFollowingFeedSidepanelDescription[]; + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || +@@ -3695,7 +3695,7 @@ extern const char kElasticOverscrollDescription[]; #if BUILDFLAG(IS_WIN) || \ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \ - BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) extern const char kUIDebugToolsName[]; extern const char kUIDebugToolsDescription[]; - #endif + diff --git a/www/iridium/files/patch-chrome_browser_media_audio__service__util.cc b/www/iridium/files/patch-chrome_browser_media_audio__service__util.cc index 8c14cf584002..dbd5900ac03f 100644 --- a/www/iridium/files/patch-chrome_browser_media_audio__service__util.cc +++ b/www/iridium/files/patch-chrome_browser_media_audio__service__util.cc @@ -1,20 +1,20 @@ ---- chrome/browser/media/audio_service_util.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/media/audio_service_util.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/media/audio_service_util.cc @@ -21,7 +21,7 @@ namespace { -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \ (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)) bool GetPolicyOrFeature(const char* policy_name, const base::Feature& feature) { const policy::PolicyMap& policies = -@@ -41,7 +41,7 @@ bool GetPolicyOrFeature(const char* policy_name, const +@@ -40,7 +40,7 @@ bool GetPolicyOrFeature(const char* policy_name, const bool IsAudioServiceSandboxEnabled() { // TODO(crbug.com/1052397): Remove !IS_CHROMEOS_LACROS once lacros starts being // built with OS_CHROMEOS instead of OS_LINUX. -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \ (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)) return GetPolicyOrFeature(policy::key::kAudioSandboxEnabled, features::kAudioServiceSandbox); diff --git a/www/iridium/files/patch-chrome_browser_media_router_discovery_BUILD.gn b/www/iridium/files/patch-chrome_browser_media_router_discovery_BUILD.gn index c90a233b8f79..6413e1c86e81 100644 --- a/www/iridium/files/patch-chrome_browser_media_router_discovery_BUILD.gn +++ b/www/iridium/files/patch-chrome_browser_media_router_discovery_BUILD.gn @@ -1,11 +1,11 @@ ---- chrome/browser/media/router/discovery/BUILD.gn.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/media/router/discovery/BUILD.gn.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/media/router/discovery/BUILD.gn -@@ -94,7 +94,7 @@ static_library("discovery") { +@@ -79,7 +79,7 @@ static_library("discovery") { "media_sink_discovery_metrics.h", ] - if (is_linux || is_chromeos) { + if ((is_linux || is_chromeos) && !is_bsd) { sources += [ "discovery_network_list_wifi_linux.cc" ] } diff --git a/www/iridium/files/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc b/www/iridium/files/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc index 4f31027db3b6..6d6c37b1bd96 100644 --- a/www/iridium/files/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc +++ b/www/iridium/files/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc @@ -1,13 +1,13 @@ ---- chrome/browser/media/webrtc/webrtc_log_uploader.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/media/webrtc/webrtc_log_uploader.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/media/webrtc/webrtc_log_uploader.cc -@@ -363,6 +363,10 @@ void WebRtcLogUploader::SetupMultipart( +@@ -362,6 +362,10 @@ void WebRtcLogUploader::SetupMultipart( const char product[] = "Chrome_ChromeOS"; #elif BUILDFLAG(IS_FUCHSIA) const char product[] = "Chrome_Fuchsia"; +#elif defined(OS_OPENBSD) + const char product[] = "Chrome_OpenBSD"; +#elif defined(OS_FREEBSD) + const char product[] = "Chrome_FreeBSD"; #else #error Platform not supported. #endif diff --git a/www/iridium/files/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc b/www/iridium/files/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc index 87ebb9c6931f..88e0199ad9fb 100644 --- a/www/iridium/files/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc +++ b/www/iridium/files/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc @@ -1,33 +1,33 @@ ---- chrome/browser/media/webrtc/webrtc_logging_controller.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/media/webrtc/webrtc_logging_controller.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/media/webrtc/webrtc_logging_controller.cc -@@ -25,10 +25,10 @@ +@@ -24,10 +24,10 @@ #include "content/public/browser/browser_context.h" #include "content/public/browser/render_process_host.h" -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "content/public/browser/child_process_security_policy.h" #include "storage/browser/file_system/isolated_context.h" -#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) using webrtc_event_logging::WebRtcEventLogManager; -@@ -282,7 +282,7 @@ void WebRtcLoggingController::StartEventLogging( +@@ -281,7 +281,7 @@ void WebRtcLoggingController::StartEventLogging( web_app_id, callback); } -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) void WebRtcLoggingController::GetLogsDirectory( LogsDirectoryCallback callback, LogsDirectoryErrorCallback error_callback) { -@@ -328,7 +328,7 @@ void WebRtcLoggingController::GrantLogsDirectoryAccess +@@ -327,7 +327,7 @@ void WebRtcLoggingController::GrantLogsDirectoryAccess FROM_HERE, base::BindOnce(std::move(callback), file_system.id(), registered_name)); } -#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) void WebRtcLoggingController::OnRtpPacket( std::unique_ptr packet_header, diff --git a/www/iridium/files/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc b/www/iridium/files/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc index c83720399e82..dd9c42c7d272 100644 --- a/www/iridium/files/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc +++ b/www/iridium/files/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc @@ -1,23 +1,23 @@ ---- chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc -@@ -57,8 +57,10 @@ +@@ -58,8 +58,10 @@ // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) +#if !BUILDFLAG(IS_BSD) #include +#endif #include "base/linux_util.h" #include "base/strings/string_split.h" -@@ -223,7 +225,7 @@ void RecordStartupMetrics() { +@@ -516,7 +518,7 @@ void RecordStartupMetrics() { // Record whether Chrome is the default browser or not. // Disabled on Linux due to hanging browser tests, see crbug.com/1216328. -#if !BUILDFLAG(IS_LINUX) +#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD) shell_integration::DefaultWebClientState default_state = shell_integration::GetDefaultBrowser(); base::UmaHistogramEnumeration("DefaultBrowser.State", default_state, diff --git a/www/iridium/files/patch-chrome_browser_metrics_chrome__metrics__service__client.cc b/www/iridium/files/patch-chrome_browser_metrics_chrome__metrics__service__client.cc index dc9485b16cbe..86455309a176 100644 --- a/www/iridium/files/patch-chrome_browser_metrics_chrome__metrics__service__client.cc +++ b/www/iridium/files/patch-chrome_browser_metrics_chrome__metrics__service__client.cc @@ -1,29 +1,47 @@ ---- chrome/browser/metrics/chrome_metrics_service_client.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/metrics/chrome_metrics_service_client.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/metrics/chrome_metrics_service_client.cc -@@ -773,7 +773,7 @@ void ChromeMetricsServiceClient::RegisterMetricsServic +@@ -174,7 +174,7 @@ + #include "chrome/notification_helper/notification_helper_constants.h" + #endif + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + #include "components/metrics/motherboard_metrics_provider.h" + #endif + +@@ -721,7 +721,7 @@ void ChromeMetricsServiceClient::RegisterMetricsServic + metrics_service_->RegisterMetricsProvider( + std::make_unique()); + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + metrics_service_->RegisterMetricsProvider( + std::make_unique()); + #endif +@@ -798,7 +798,7 @@ void ChromeMetricsServiceClient::RegisterMetricsServic // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) metrics_service_->RegisterMetricsProvider( std::make_unique()); -@@ -869,7 +869,7 @@ void ChromeMetricsServiceClient::RegisterMetricsServic +@@ -890,7 +890,7 @@ void ChromeMetricsServiceClient::RegisterMetricsServic std::make_unique()); #endif -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) metrics_service_->RegisterMetricsProvider( metrics::CreateDesktopSessionMetricsProvider()); #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX) -@@ -1045,7 +1045,7 @@ bool ChromeMetricsServiceClient::RegisterForProfileEve +@@ -1073,7 +1073,7 @@ bool ChromeMetricsServiceClient::RegisterForProfileEve #endif // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) // This creates the DesktopProfileSessionDurationsServices if it didn't exist // already. diff --git a/www/iridium/files/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc b/www/iridium/files/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc new file mode 100644 index 000000000000..a2b475fb749f --- /dev/null +++ b/www/iridium/files/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc @@ -0,0 +1,11 @@ +--- chrome/browser/metrics/power/process_metrics_recorder_util.cc.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/metrics/power/process_metrics_recorder_util.cc +@@ -59,7 +59,7 @@ void RecordProcessHistograms(const char* histogram_suf + const ProcessMonitor::Metrics& metrics) { + RecordAverageCPUUsage(histogram_suffix, metrics.cpu_usage); + #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ +- BUILDFLAG(IS_AIX) ++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) + base::UmaHistogramCounts10000( + base::StrCat({"PerformanceMonitor.IdleWakeups2.", histogram_suffix}), + metrics.idle_wakeups); diff --git a/www/iridium/files/patch-chrome_browser_metrics_power_process__monitor.cc b/www/iridium/files/patch-chrome_browser_metrics_power_process__monitor.cc new file mode 100644 index 000000000000..ed6557e14480 --- /dev/null +++ b/www/iridium/files/patch-chrome_browser_metrics_power_process__monitor.cc @@ -0,0 +1,29 @@ +--- chrome/browser/metrics/power/process_monitor.cc.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/metrics/power/process_monitor.cc +@@ -64,7 +64,7 @@ ProcessMonitor::Metrics SampleMetrics(base::ProcessMet + #endif + + #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ +- BUILDFLAG(IS_AIX) ++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) + metrics.idle_wakeups = process_metrics.GetIdleWakeupsPerSecond(); + #endif + #if BUILDFLAG(IS_MAC) +@@ -81,7 +81,7 @@ void ScaleMetrics(ProcessMonitor::Metrics* metrics, do + metrics->cpu_usage *= factor; + + #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ +- BUILDFLAG(IS_AIX) ++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) + metrics->idle_wakeups *= factor; + #endif + +@@ -130,7 +130,7 @@ ProcessMonitor::Metrics& operator+=(ProcessMonitor::Me + lhs.cpu_usage += rhs.cpu_usage; + + #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ +- BUILDFLAG(IS_AIX) ++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) + lhs.idle_wakeups += rhs.idle_wakeups; + #endif + diff --git a/www/iridium/files/patch-chrome_browser_performance__monitor_process__monitor.h b/www/iridium/files/patch-chrome_browser_metrics_power_process__monitor.h similarity index 61% rename from www/iridium/files/patch-chrome_browser_performance__monitor_process__monitor.h rename to www/iridium/files/patch-chrome_browser_metrics_power_process__monitor.h index 90a31ee2631a..fef39301f47c 100644 --- a/www/iridium/files/patch-chrome_browser_performance__monitor_process__monitor.h +++ b/www/iridium/files/patch-chrome_browser_metrics_power_process__monitor.h @@ -1,11 +1,11 @@ ---- chrome/browser/performance_monitor/process_monitor.h.orig 2022-04-01 07:48:30 UTC -+++ chrome/browser/performance_monitor/process_monitor.h -@@ -52,7 +52,7 @@ class ProcessMonitor { +--- chrome/browser/metrics/power/process_monitor.h.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/metrics/power/process_monitor.h +@@ -70,7 +70,7 @@ class ProcessMonitor : public content::BrowserChildPro double cpu_usage = 0.0; #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ - BUILDFLAG(IS_AIX) + BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) // Returns the number of average idle cpu wakeups per second since the last // time the metric was sampled. int idle_wakeups = 0; diff --git a/www/iridium/files/patch-chrome_browser_net_system__network__context__manager.cc b/www/iridium/files/patch-chrome_browser_net_system__network__context__manager.cc index 89a5cd56d727..0d99aec179ed 100644 --- a/www/iridium/files/patch-chrome_browser_net_system__network__context__manager.cc +++ b/www/iridium/files/patch-chrome_browser_net_system__network__context__manager.cc @@ -1,38 +1,38 @@ ---- chrome/browser/net/system_network_context_manager.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/net/system_network_context_manager.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/net/system_network_context_manager.cc -@@ -84,7 +84,7 @@ +@@ -91,7 +91,7 @@ // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) #include "chrome/common/chrome_paths_internal.h" #include "chrome/grit/chromium_strings.h" #include "ui/base/l10n/l10n_util.h" -@@ -144,7 +144,7 @@ network::mojom::HttpAuthDynamicParamsPtr CreateHttpAut +@@ -173,7 +173,7 @@ network::mojom::HttpAuthDynamicParamsPtr CreateHttpAut auth_dynamic_params->basic_over_http_enabled = local_state->GetBoolean(prefs::kBasicAuthOverHttpEnabled); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) auth_dynamic_params->delegate_by_kdc_policy = local_state->GetBoolean(prefs::kAuthNegotiateDelegateByKdcPolicy); #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) -@@ -377,7 +377,7 @@ SystemNetworkContextManager::SystemNetworkContextManag +@@ -484,7 +484,7 @@ SystemNetworkContextManager::SystemNetworkContextManag pref_change_registrar_.Add(prefs::kAllHttpAuthSchemesAllowedForOrigins, auth_pref_callback); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) pref_change_registrar_.Add(prefs::kAuthNegotiateDelegateByKdcPolicy, auth_pref_callback); #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) -@@ -437,7 +437,7 @@ void SystemNetworkContextManager::RegisterPrefs(PrefRe - registry->RegisterStringPref(prefs::kAuthServerAllowlist, std::string()); - registry->RegisterStringPref(prefs::kAuthNegotiateDelegateAllowlist, - std::string()); +@@ -556,7 +556,7 @@ void SystemNetworkContextManager::RegisterPrefs(PrefRe + registry->RegisterBooleanPref(prefs::kKerberosEnabled, false); + #endif // BUILDFLAG(IS_CHROMEOS_LACROS) + -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) registry->RegisterBooleanPref(prefs::kAuthNegotiateDelegateByKdcPolicy, false); #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) diff --git a/www/iridium/files/patch-chrome_browser_new__tab__page_new__tab__page__util.cc b/www/iridium/files/patch-chrome_browser_new__tab__page_new__tab__page__util.cc new file mode 100644 index 000000000000..a89356fbdc99 --- /dev/null +++ b/www/iridium/files/patch-chrome_browser_new__tab__page_new__tab__page__util.cc @@ -0,0 +1,11 @@ +--- chrome/browser/new_tab_page/new_tab_page_util.cc.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/new_tab_page/new_tab_page_util.cc +@@ -11,7 +11,7 @@ + + namespace { + bool IsOsSupportedForRecipe() { +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + return true; + #else + return false; diff --git a/www/iridium/files/patch-chrome_browser_notifications_notification__display__service__impl.cc b/www/iridium/files/patch-chrome_browser_notifications_notification__display__service__impl.cc index 0874da625e53..db2fa7fcfd2d 100644 --- a/www/iridium/files/patch-chrome_browser_notifications_notification__display__service__impl.cc +++ b/www/iridium/files/patch-chrome_browser_notifications_notification__display__service__impl.cc @@ -1,38 +1,38 @@ ---- chrome/browser/notifications/notification_display_service_impl.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/notifications/notification_display_service_impl.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/notifications/notification_display_service_impl.cc @@ -32,7 +32,7 @@ #endif #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \ - BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) #include "chrome/browser/send_tab_to_self/desktop_notification_handler.h" #include "chrome/browser/sharing/sharing_notification_handler.h" #endif @@ -65,7 +65,7 @@ NotificationDisplayServiceImpl* NotificationDisplaySer // static void NotificationDisplayServiceImpl::RegisterProfilePrefs( user_prefs::PrefRegistrySyncable* registry) { -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) - registry->RegisterBooleanPref(prefs::kAllowNativeNotifications, true); registry->RegisterBooleanPref(prefs::kAllowSystemNotifications, true); #endif -@@ -82,7 +82,7 @@ NotificationDisplayServiceImpl::NotificationDisplaySer + } +@@ -81,7 +81,7 @@ NotificationDisplayServiceImpl::NotificationDisplaySer std::make_unique()); #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \ - BUILDFLAG(IS_WIN) + BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) AddNotificationHandler( NotificationHandler::Type::SEND_TAB_TO_SELF, std::make_unique( -@@ -90,7 +90,7 @@ NotificationDisplayServiceImpl::NotificationDisplaySer +@@ -89,7 +89,7 @@ NotificationDisplayServiceImpl::NotificationDisplaySer #endif #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \ - BUILDFLAG(IS_WIN) + BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) AddNotificationHandler( NotificationHandler::Type::TAILORED_SECURITY, std::make_unique()); diff --git a/www/iridium/files/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc b/www/iridium/files/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc index 1c0a6176e495..0d1c471f4e10 100644 --- a/www/iridium/files/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc +++ b/www/iridium/files/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc @@ -1,11 +1,11 @@ ---- chrome/browser/password_manager/password_reuse_manager_factory.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/password_manager/password_reuse_manager_factory.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/password_manager/password_reuse_manager_factory.cc -@@ -94,7 +94,7 @@ KeyedService* PasswordReuseManagerFactory::BuildServic +@@ -92,7 +92,7 @@ KeyedService* PasswordReuseManagerFactory::BuildServic // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_CHROMEOS_LACROS) + BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) std::unique_ptr notifier = std::make_unique( IdentityManagerFactory::GetForProfile(profile)); diff --git a/www/iridium/files/patch-chrome_browser_performance__manager_policies_high__pmf__discard__policy.cc b/www/iridium/files/patch-chrome_browser_performance__manager_policies_high__pmf__discard__policy.cc deleted file mode 100644 index f963880d0ace..000000000000 --- a/www/iridium/files/patch-chrome_browser_performance__manager_policies_high__pmf__discard__policy.cc +++ /dev/null @@ -1,20 +0,0 @@ ---- chrome/browser/performance_manager/policies/high_pmf_discard_policy.cc.orig 2022-03-28 18:11:04 UTC -+++ chrome/browser/performance_manager/policies/high_pmf_discard_policy.cc -@@ -17,7 +17,7 @@ - #include "content/public/browser/browser_task_traits.h" - #include "content/public/browser/browser_thread.h" - --#if !BUILDFLAG(IS_LINUX) -+#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD) - #include "base/memory/memory_pressure_monitor.h" - #endif - -@@ -122,7 +122,7 @@ void HighPMFDiscardPolicy::OnProcessMemoryMetricsAvail - - if (should_discard) { - discard_attempt_in_progress_ = true; --#if !BUILDFLAG(IS_LINUX) -+#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD) - // Record the memory pressure level before discarding a tab. - content::GetUIThreadTaskRunner({})->PostTask( - FROM_HERE, base::BindOnce([]() { diff --git a/www/iridium/files/patch-chrome_browser_performance__monitor_process__metrics__recorder__util.cc b/www/iridium/files/patch-chrome_browser_performance__monitor_process__metrics__recorder__util.cc deleted file mode 100644 index c9bb97b3ea66..000000000000 --- a/www/iridium/files/patch-chrome_browser_performance__monitor_process__metrics__recorder__util.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- chrome/browser/performance_monitor/process_metrics_recorder_util.cc.orig 2022-04-01 07:48:30 UTC -+++ chrome/browser/performance_monitor/process_metrics_recorder_util.cc -@@ -39,7 +39,7 @@ void RecordProcessHistograms(const char* histogram_suf - metrics.cpu_usage * kCPUUsageFactor, kCPUUsageHistogramMin, - kCPUUsageHistogramMax, kCPUUsageHistogramBucketCount); - #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ -- BUILDFLAG(IS_AIX) -+ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) - base::UmaHistogramCounts10000( - base::JoinString({"PerformanceMonitor.IdleWakeups.", histogram_suffix}, - ""), diff --git a/www/iridium/files/patch-chrome_browser_performance__monitor_process__monitor.cc b/www/iridium/files/patch-chrome_browser_performance__monitor_process__monitor.cc deleted file mode 100644 index 6d5d461621f2..000000000000 --- a/www/iridium/files/patch-chrome_browser_performance__monitor_process__monitor.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- chrome/browser/performance_monitor/process_monitor.cc.orig 2022-03-28 18:11:04 UTC -+++ chrome/browser/performance_monitor/process_monitor.cc -@@ -82,7 +82,7 @@ ProcessMonitor::Metrics& operator+=(ProcessMonitor::Me - lhs.cpu_usage += rhs.cpu_usage; - - #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ -- BUILDFLAG(IS_AIX) -+ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) - lhs.idle_wakeups += rhs.idle_wakeups; - #endif - diff --git a/www/iridium/files/patch-chrome_browser_platform__util__linux.cc b/www/iridium/files/patch-chrome_browser_platform__util__linux.cc index bb36e6f76119..8a2d6bccdc86 100644 --- a/www/iridium/files/patch-chrome_browser_platform__util__linux.cc +++ b/www/iridium/files/patch-chrome_browser_platform__util__linux.cc @@ -1,12 +1,12 @@ ---- chrome/browser/platform_util_linux.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/platform_util_linux.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/platform_util_linux.cc -@@ -298,7 +298,9 @@ void RunCommand(const std::string& command, +@@ -295,7 +295,9 @@ void RunCommand(const std::string& command, base::LaunchOptions options; options.current_directory = working_directory; +#if !defined(OS_BSD) options.allow_new_privs = true; +#endif // xdg-open can fall back on mailcap which eventually might plumb through // to a command that needs a terminal. Set the environment variable telling // it that we definitely don't have a terminal available and that it should diff --git a/www/iridium/files/patch-chrome_browser_plugins_plugins__resource__service.cc b/www/iridium/files/patch-chrome_browser_plugins_plugins__resource__service.cc deleted file mode 100644 index 871a3d42b99c..000000000000 --- a/www/iridium/files/patch-chrome_browser_plugins_plugins__resource__service.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- chrome/browser/plugins/plugins_resource_service.cc.orig 2022-03-28 18:11:04 UTC -+++ chrome/browser/plugins/plugins_resource_service.cc -@@ -62,7 +62,7 @@ GURL GetPluginsServerURL() { - filename = "plugins_win.json"; - #elif BUILDFLAG(IS_CHROMEOS_ASH) - filename = "plugins_chromeos.json"; --#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) -+#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) - filename = "plugins_linux.json"; - #elif BUILDFLAG(IS_MAC) - filename = "plugins_mac.json"; diff --git a/www/iridium/files/patch-chrome_browser_policy_browser__signin__policy__handler.cc b/www/iridium/files/patch-chrome_browser_policy_browser__signin__policy__handler.cc index 966f352f40af..4548084bdef9 100644 --- a/www/iridium/files/patch-chrome_browser_policy_browser__signin__policy__handler.cc +++ b/www/iridium/files/patch-chrome_browser_policy_browser__signin__policy__handler.cc @@ -1,11 +1,11 @@ ---- chrome/browser/policy/browser_signin_policy_handler.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/policy/browser_signin_policy_handler.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/policy/browser_signin_policy_handler.cc -@@ -43,7 +43,7 @@ void BrowserSigninPolicyHandler::ApplyPolicySettings(c - const base::Value* value = policies.GetValue(policy_name()); +@@ -44,7 +44,7 @@ void BrowserSigninPolicyHandler::ApplyPolicySettings(c + policies.GetValue(policy_name(), base::Value::Type::INTEGER); switch (static_cast(value->GetInt())) { case BrowserSigninMode::kForced: -#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) +#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD) prefs->SetValue(prefs::kForceBrowserSignin, base::Value(true)); #endif [[fallthrough]]; diff --git a/www/iridium/files/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc b/www/iridium/files/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc index f3bba5c3ea6a..e68847803722 100644 --- a/www/iridium/files/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc +++ b/www/iridium/files/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc @@ -1,38 +1,38 @@ ---- chrome/browser/policy/chrome_browser_cloud_management_controller_desktop.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/policy/chrome_browser_cloud_management_controller_desktop.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/policy/chrome_browser_cloud_management_controller_desktop.cc -@@ -46,7 +46,7 @@ +@@ -47,7 +47,7 @@ #include "chrome/browser/policy/browser_dm_token_storage_mac.h" #endif // BUILDFLAG(IS_MAC) -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "chrome/browser/policy/browser_dm_token_storage_linux.h" #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) -@@ -55,7 +55,7 @@ +@@ -56,7 +56,7 @@ #include "chrome/install_static/install_util.h" #endif // BUILDFLAG(IS_WIN) -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) #include "chrome/browser/enterprise/connectors/device_trust/device_trust_features.h" #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/device_trust_key_manager_impl.h" #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/key_rotation_launcher.h" -@@ -88,7 +88,7 @@ void ChromeBrowserCloudManagementControllerDesktop:: +@@ -89,7 +89,7 @@ void ChromeBrowserCloudManagementControllerDesktop:: #if BUILDFLAG(IS_MAC) storage_delegate = std::make_unique(); -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) storage_delegate = std::make_unique(); #elif BUILDFLAG(IS_WIN) storage_delegate = std::make_unique(); -@@ -243,7 +243,7 @@ ChromeBrowserCloudManagementControllerDesktop::CreateC +@@ -244,7 +244,7 @@ ChromeBrowserCloudManagementControllerDesktop::CreateC std::unique_ptr ChromeBrowserCloudManagementControllerDesktop::CreateDeviceTrustKeyManager() { -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) if (enterprise_connectors::IsDeviceTrustConnectorFeatureEnabled()) { auto key_rotation_launcher = enterprise_connectors::KeyRotationLauncher::Create( diff --git a/www/iridium/files/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc b/www/iridium/files/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc index a674a17985df..00174075da4d 100644 --- a/www/iridium/files/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc +++ b/www/iridium/files/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc @@ -1,47 +1,129 @@ ---- chrome/browser/policy/configuration_policy_handler_list_factory.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/policy/configuration_policy_handler_list_factory.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/policy/configuration_policy_handler_list_factory.cc -@@ -1456,7 +1456,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = +@@ -189,12 +189,12 @@ + #include "components/spellcheck/browser/pref_names.h" + #endif // BUILDFLAG(ENABLE_SPELLCHECK) + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + #include "components/device_signals/core/browser/pref_names.h" + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) + + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ +- BUILDFLAG(IS_FUCHSIA) ++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) + #include "chrome/browser/web_applications/policy/web_app_settings_policy_handler.h" + #endif + +@@ -725,7 +725,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = + prefs::kManagedDefaultGeolocationSetting, + base::Value::Type::INTEGER }, + #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) \ +- || BUILDFLAG(IS_FUCHSIA) ++ || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) + { key::kRequireOnlineRevocationChecksForLocalAnchors, + prefs::kCertRevocationCheckingRequiredLocalAnchors, + base::Value::Type::BOOLEAN }, +@@ -1330,7 +1330,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = base::Value::Type::BOOLEAN }, - #endif // !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_CHROMEOS) + #endif // BUILDFLAG(IS_CHROMEOS_ASH) + +-#if BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + { key::kGSSAPILibraryName, + prefs::kGSSAPILibraryName, + base::Value::Type::STRING }, +@@ -1400,18 +1400,18 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = + prefs::kTotalMemoryLimitMb, + base::Value::Type::INTEGER }, + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + { key::kBackgroundModeEnabled, + prefs::kBackgroundModeEnabled, + base::Value::Type::BOOLEAN }, + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + { key::kUnmanagedDeviceSignalsConsentFlowEnabled, + device_signals::prefs::kUnmanagedDeviceSignalsConsentFlowEnabled, + base::Value::Type::BOOLEAN }, + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) \ +- || BUILDFLAG(IS_FUCHSIA) ++ || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) + { key::kDefaultBrowserSettingEnabled, + prefs::kDefaultBrowserSettingEnabled, + base::Value::Type::BOOLEAN }, +@@ -1424,7 +1424,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) + // || BUILDFLAG(IS_FUCHSIA) + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) \ +- || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) ++ || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) + { key::kAutoplayAllowed, + prefs::kAutoplayAllowed, + base::Value::Type::BOOLEAN }, +@@ -1609,7 +1609,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = + base::Value::Type::BOOLEAN }, + #endif // BUILDFLAG(IS_CHROMEOS) -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) { key::kAuthNegotiateDelegateByKdcPolicy, prefs::kAuthNegotiateDelegateByKdcPolicy, base::Value::Type::BOOLEAN }, -@@ -1565,7 +1565,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = - base::Value::Type::BOOLEAN }, +@@ -1668,7 +1668,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = #endif // BUILDFLAG(IS_CHROMEOS_ASH) --#if BUILDFLAG(ENABLE_EXTENSIONS) && (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)) -+#if BUILDFLAG(ENABLE_EXTENSIONS) && (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) + #if BUILDFLAG(ENABLE_EXTENSIONS) && (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) \ +- || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA)) ++ || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA)) || BUILDFLAG(IS_BSD) { key::kChromeAppsEnabled, extensions::pref_names::kChromeAppsEnabled, base::Value::Type::BOOLEAN }, -@@ -1885,7 +1885,7 @@ std::unique_ptr BuildH - #endif // BUILDFLAG(IS_ANDROID) +@@ -2007,7 +2007,7 @@ std::unique_ptr BuildH + key::kBrowsingDataLifetime, browsing_data::prefs::kBrowsingDataLifetime, + chrome_schema)); - #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \ -- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) -+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) - handlers->AddHandler( - std::make_unique< - enterprise_connectors::EnterpriseConnectorsPolicyHandler>( -@@ -2256,7 +2256,7 @@ std::unique_ptr BuildH - SimpleSchemaValidatingPolicyHandler::MANDATORY_ALLOWED)); +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) + handlers->AddHandler(std::make_unique()); + handlers->AddHandler(std::make_unique()); + #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) +@@ -2036,7 +2036,7 @@ std::unique_ptr BuildH + std::vector> + signin_legacy_policies; + #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \ +- BUILDFLAG(IS_LINUX) ++ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + signin_legacy_policies.push_back(std::make_unique( + key::kForceBrowserSignin, prefs::kForceBrowserSignin, + base::Value::Type::BOOLEAN)); +@@ -2369,7 +2369,7 @@ std::unique_ptr BuildH + chrome_schema)); #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ - BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) - handlers->AddHandler(std::make_unique( - key::kWebAppSettings, prefs::kWebAppSettings, chrome_schema, - SCHEMA_ALLOW_UNKNOWN, -@@ -2287,7 +2287,7 @@ std::unique_ptr BuildH - policy::key::kSpellcheckLanguageBlocklist)); + handlers->AddHandler( + std::make_unique(chrome_schema)); + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || +@@ -2382,7 +2382,7 @@ std::unique_ptr BuildH + #endif + + #if BUILDFLAG(ENABLE_SPELLCHECK) +-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) ++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) + handlers->AddHandler(std::make_unique()); + handlers->AddHandler( + std::make_unique( +@@ -2390,7 +2390,7 @@ std::unique_ptr BuildH + #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) #endif // BUILDFLAG(ENABLE_SPELLCHECK) -#if BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) - handlers->AddHandler(std::make_unique( - std::make_unique(key::kAllowNativeNotifications, - prefs::kAllowNativeNotifications, + handlers->AddHandler(std::make_unique( + key::kAllowSystemNotifications, prefs::kAllowSystemNotifications, + base::Value::Type::BOOLEAN)); diff --git a/www/iridium/files/patch-chrome_browser_prefs_browser__prefs.cc b/www/iridium/files/patch-chrome_browser_prefs_browser__prefs.cc index 71d0e148e2ed..1d9062af2193 100644 --- a/www/iridium/files/patch-chrome_browser_prefs_browser__prefs.cc +++ b/www/iridium/files/patch-chrome_browser_prefs_browser__prefs.cc @@ -1,46 +1,44 @@ ---- chrome/browser/prefs/browser_prefs.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/prefs/browser_prefs.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/prefs/browser_prefs.cc -@@ -418,14 +418,14 @@ +@@ -439,14 +439,14 @@ #include "components/os_crypt/os_crypt.h" #endif --#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ -+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \ - (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)) +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) #include "chrome/browser/web_applications/url_handler_prefs.h" + #include "components/device_signals/core/browser/pref_names.h" #endif // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) #include "chrome/browser/browser_switcher/browser_switcher_prefs.h" #endif -@@ -1139,7 +1139,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) - // TODO(crbug/1169547) Remove `BUILDFLAG(IS_CHROMEOS_LACROS)` once the - // migration is complete. - #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \ -- BUILDFLAG(IS_CHROMEOS_LACROS) -+ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) - enterprise_connectors::RegisterLocalPrefs(registry); - #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) - -@@ -1171,7 +1171,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) +@@ -1214,7 +1214,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) #endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) #endif // BUILDFLAG(IS_WIN) --#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ -+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \ - (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)) +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) web_app::url_handler_prefs::RegisterLocalStatePrefs(registry); + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) + +@@ -1531,13 +1531,13 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySync + safe_browsing::PostCleanupSettingsResetter::RegisterProfilePrefs(registry); #endif -@@ -1469,7 +1469,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySync + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + device_signals::RegisterProfilePrefs(registry); + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) browser_switcher::BrowserSwitcherPrefs::RegisterProfilePrefs(registry); #endif diff --git a/www/iridium/files/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc b/www/iridium/files/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc index 39fffee9b1ed..61db7e1db227 100644 --- a/www/iridium/files/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc +++ b/www/iridium/files/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc @@ -1,11 +1,11 @@ ---- chrome/browser/prefs/pref_service_incognito_allowlist.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/prefs/pref_service_incognito_allowlist.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/prefs/pref_service_incognito_allowlist.cc -@@ -139,7 +139,7 @@ const char* const kPersistentPrefNames[] = { +@@ -138,7 +138,7 @@ const char* const kPersistentPrefNames[] = { // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) // Toggleing custom frames affects all open windows in the profile, hence // should be written to the regular profile when changed in incognito mode. prefs::kUseCustomChromeFrame, diff --git a/www/iridium/files/patch-chrome_browser_printing_print__backend__service__manager.cc b/www/iridium/files/patch-chrome_browser_printing_print__backend__service__manager.cc new file mode 100644 index 000000000000..e70f88886f80 --- /dev/null +++ b/www/iridium/files/patch-chrome_browser_printing_print__backend__service__manager.cc @@ -0,0 +1,29 @@ +--- chrome/browser/printing/print_backend_service_manager.cc.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/printing/print_backend_service_manager.cc +@@ -481,7 +481,7 @@ absl::optional PrintBackendServiceManager::R + query_clients_.insert(client_id); + break; + case ClientType::kQueryWithUi: +-#if !BUILDFLAG(IS_LINUX) ++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD) + if (!query_with_ui_clients_.empty()) + return absl::nullopt; + #endif +@@ -706,7 +706,7 @@ PrintBackendServiceManager::DetermineIdleTimeoutUpdate + break; + + case ClientType::kQueryWithUi: +-#if BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + // No need to update if there were other query with UI clients. + if (query_with_ui_clients_.size() > 1) + return absl::nullopt; +@@ -763,7 +763,7 @@ PrintBackendServiceManager::DetermineIdleTimeoutUpdate + return kNoClientsRegisteredResetOnIdleTimeout; + + case ClientType::kQueryWithUi: +-#if BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + // No need to update if there were other query with UI clients. + if (!query_with_ui_clients_.empty()) + return absl::nullopt; diff --git a/www/iridium/files/patch-chrome_browser_printing_print__job__worker.cc b/www/iridium/files/patch-chrome_browser_printing_print__job__worker.cc index 9b23520a2036..d7c98e82f669 100644 --- a/www/iridium/files/patch-chrome_browser_printing_print__job__worker.cc +++ b/www/iridium/files/patch-chrome_browser_printing_print__job__worker.cc @@ -1,11 +1,11 @@ ---- chrome/browser/printing/print_job_worker.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/printing/print_job_worker.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/printing/print_job_worker.cc -@@ -225,7 +225,7 @@ void PrintJobWorker::UpdatePrintSettings(base::Value n +@@ -195,7 +195,7 @@ void PrintJobWorker::SetSettings(base::Value::Dict new crash_key = std::make_unique( print_backend->GetPrinterDriverInfo(printer_name)); -#if BUILDFLAG(IS_LINUX) && defined(USE_CUPS) +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(USE_CUPS) PrinterBasicInfo basic_info; if (print_backend->GetPrinterBasicInfo(printer_name, &basic_info) == mojom::ResultCode::kSuccess) { diff --git a/www/iridium/files/patch-chrome_browser_process__singleton__posix.cc b/www/iridium/files/patch-chrome_browser_process__singleton__posix.cc index 741ea318daa3..e91ae056c8f0 100644 --- a/www/iridium/files/patch-chrome_browser_process__singleton__posix.cc +++ b/www/iridium/files/patch-chrome_browser_process__singleton__posix.cc @@ -1,35 +1,20 @@ ---- chrome/browser/process_singleton_posix.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/process_singleton_posix.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/process_singleton_posix.cc -@@ -98,12 +98,12 @@ +@@ -97,7 +97,7 @@ #include "net/base/network_interfaces.h" #include "ui/base/l10n/l10n_util.h" -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "chrome/browser/ui/process_singleton_dialog_linux.h" #endif - #if defined(TOOLKIT_VIEWS) && \ -- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) -+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)) - #include "ui/views/linux_ui/linux_ui.h" - #endif - -@@ -357,7 +357,7 @@ bool DisplayProfileInUseError(const base::FilePath& lo +@@ -351,7 +351,7 @@ bool DisplayProfileInUseError(const base::FilePath& lo if (g_disable_prompt) return g_user_opted_unlock_in_use_profile; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) std::u16string relaunch_button_text = l10n_util::GetStringUTF16(IDS_PROFILE_IN_USE_LINUX_RELAUNCH); return ShowProcessSingletonDialog(error, relaunch_button_text); -@@ -926,7 +926,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::Notif - return PROCESS_NONE; - } else if (strncmp(buf, kACKToken, base::size(kACKToken) - 1) == 0) { - #if defined(TOOLKIT_VIEWS) && \ -- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) -+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)) - // Likely NULL in unit tests. - views::LinuxUI* linux_ui = views::LinuxUI::instance(); - if (linux_ui) diff --git a/www/iridium/files/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc b/www/iridium/files/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc index 6ef951573943..b2fb081d187e 100644 --- a/www/iridium/files/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc +++ b/www/iridium/files/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc @@ -1,11 +1,25 @@ ---- chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc -@@ -393,7 +393,7 @@ void ChromeBrowserMainExtraPartsProfiles:: +@@ -255,7 +255,7 @@ + #include "chrome/browser/ui/cocoa/screentime/screentime_features.h" + #endif + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + #include "chrome/browser/enterprise/idle/idle_service_factory.h" + #endif + +@@ -435,11 +435,11 @@ void ChromeBrowserMainExtraPartsProfiles:: #endif // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) metrics::DesktopProfileSessionDurationsServiceFactory::GetInstance(); #endif +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + enterprise_idle::IdleServiceFactory::GetInstance(); + #endif + ModelTypeStoreServiceFactory::GetInstance(); diff --git a/www/iridium/files/patch-chrome_browser_profiles_profile__impl.cc b/www/iridium/files/patch-chrome_browser_profiles_profile__impl.cc index ef57e867a8ec..d9914b5b7e9b 100644 --- a/www/iridium/files/patch-chrome_browser_profiles_profile__impl.cc +++ b/www/iridium/files/patch-chrome_browser_profiles_profile__impl.cc @@ -1,31 +1,31 @@ ---- chrome/browser/profiles/profile_impl.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/profiles/profile_impl.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/profiles/profile_impl.cc -@@ -263,6 +263,10 @@ +@@ -261,6 +261,10 @@ #include "chrome/browser/spellchecker/spellcheck_service.h" #endif +#if BUILDFLAG(IS_OPENBSD) +#include "sandbox/policy/openbsd/sandbox_openbsd.h" +#endif + using bookmarks::BookmarkModel; using content::BrowserThread; using content::DownloadManagerDelegate; -@@ -848,7 +852,17 @@ void ProfileImpl::DoFinalInit(CreateMode create_mode) +@@ -851,7 +855,17 @@ void ProfileImpl::DoFinalInit(CreateMode create_mode) } base::FilePath ProfileImpl::last_selected_directory() { +#if BUILDFLAG(IS_OPENBSD) + // If unveil(2) is used, force the file dialog directory to something we + // know is available. + auto* sandbox = sandbox::policy::SandboxLinux::GetInstance(); + if (sandbox->unveil_initialized()) + return GetPrefs()->GetFilePath(prefs::kDownloadDefaultDirectory); + else + return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); +#else return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); +#endif } void ProfileImpl::set_last_selected_directory(const base::FilePath& path) { diff --git a/www/iridium/files/patch-chrome_browser_profiles_profiles__state.cc b/www/iridium/files/patch-chrome_browser_profiles_profiles__state.cc index 9bfb5778baf3..fc540d87a49f 100644 --- a/www/iridium/files/patch-chrome_browser_profiles_profiles__state.cc +++ b/www/iridium/files/patch-chrome_browser_profiles_profiles__state.cc @@ -1,11 +1,11 @@ ---- chrome/browser/profiles/profiles_state.cc.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/profiles/profiles_state.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/profiles/profiles_state.cc -@@ -176,7 +176,7 @@ bool IsGuestModeRequested(const base::CommandLine& com +@@ -181,7 +181,7 @@ bool IsGuestModeRequested(const base::CommandLine& com PrefService* local_state, bool show_warning) { #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \ - BUILDFLAG(IS_MAC) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) DCHECK(local_state); // Check if guest mode enforcement commandline switch or policy are provided. diff --git a/www/iridium/files/patch-chrome_browser_renderer__preferences__util.cc b/www/iridium/files/patch-chrome_browser_renderer__preferences__util.cc index a4e5f01fb39e..e7fa42eb5039 100644 --- a/www/iridium/files/patch-chrome_browser_renderer__preferences__util.cc +++ b/www/iridium/files/patch-chrome_browser_renderer__preferences__util.cc @@ -1,29 +1,29 @@ ---- chrome/browser/renderer_preferences_util.cc.orig 2022-04-01 07:48:30 UTC +--- chrome/browser/renderer_preferences_util.cc.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/renderer_preferences_util.cc @@ -37,7 +37,7 @@ #include "ui/views/controls/textfield/textfield.h" #endif --#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) -+#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)) +-#if defined(USE_AURA) && BUILDFLAG(IS_LINUX) ++#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service_factory.h" - #include "ui/views/linux_ui/linux_ui.h" + #include "ui/linux/linux_ui.h" @@ -159,7 +159,7 @@ void UpdateFromSystemSettings(blink::RendererPreferenc prefs->caret_blink_interval = views::Textfield::GetCaretBlinkInterval(); #endif --#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) -+#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)) - views::LinuxUI* linux_ui = views::LinuxUI::instance(); +-#if defined(USE_AURA) && BUILDFLAG(IS_LINUX) ++#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) + ui::LinuxUi* linux_ui = ui::LinuxUi::instance(); if (linux_ui) { if (ThemeServiceFactory::GetForProfile(profile)->UsingSystemTheme()) { @@ -179,7 +179,7 @@ void UpdateFromSystemSettings(blink::RendererPreferenc #endif #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ - BUILDFLAG(IS_WIN) + BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) content::UpdateFontRendererPreferencesFromSystemSettings(prefs); #endif diff --git a/www/iridium/files/patch-chrome_browser_resources_sandbox__internals_sandbox__internals.ts b/www/iridium/files/patch-chrome_browser_resources_sandbox__internals_sandbox__internals.ts new file mode 100644 index 000000000000..fdca0e8e76b0 --- /dev/null +++ b/www/iridium/files/patch-chrome_browser_resources_sandbox__internals_sandbox__internals.ts @@ -0,0 +1,29 @@ +--- chrome/browser/resources/sandbox_internals/sandbox_internals.ts.orig 2022-10-05 07:34:01 UTC ++++ chrome/browser/resources/sandbox_internals/sandbox_internals.ts +@@ -2,7 +2,7 @@ + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + +-// ++// + import './strings.m.js'; + + import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; +@@ -121,7 +121,7 @@ function androidHandler() { + } + // + +-// ++// + + /** + * Adds a status row that reports either Yes or No. +@@ -182,7 +182,7 @@ document.addEventListener('DOMContentLoaded', () => { + // + androidHandler(); + // +- // ++ // + linuxHandler(); + // + }); diff --git a/www/iridium/files/patch-chrome_browser_resources_settings_appearance__page_appearance__browser__proxy.ts b/www/iridium/files/patch-chrome_browser_resources_settings_appearance__page_appearance__browser__proxy.ts index 87c58b4470e0..606bb92511a8 100644 --- a/www/iridium/files/patch-chrome_browser_resources_settings_appearance__page_appearance__browser__proxy.ts +++ b/www/iridium/files/patch-chrome_browser_resources_settings_appearance__page_appearance__browser__proxy.ts @@ -1,20 +1,20 @@ ---- chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.ts.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.ts.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.ts @@ -16,7 +16,7 @@ export interface AppearanceBrowserProxy { useDefaultTheme(): void; -- // -+ // +- // ++ // useSystemTheme(): void; // @@ -44,7 +44,7 @@ export class AppearanceBrowserProxyImpl implements App chrome.send('useDefaultTheme'); } -- // -+ // +- // ++ // useSystemTheme() { chrome.send('useSystemTheme'); } diff --git a/www/iridium/files/patch-chrome_browser_resources_settings_appearance__page_appearance__page.html b/www/iridium/files/patch-chrome_browser_resources_settings_appearance__page_appearance__page.html index dfceea09ee48..c1e1690188b5 100644 --- a/www/iridium/files/patch-chrome_browser_resources_settings_appearance__page_appearance__page.html +++ b/www/iridium/files/patch-chrome_browser_resources_settings_appearance__page_appearance__page.html @@ -1,29 +1,29 @@ ---- chrome/browser/resources/settings/appearance_page/appearance_page.html.orig 2022-03-28 18:11:04 UTC +--- chrome/browser/resources/settings/appearance_page/appearance_page.html.orig 2022-10-05 07:34:01 UTC +++ chrome/browser/resources/settings/appearance_page/appearance_page.html @@ -27,7 +27,7 @@ -- -+ +- ++ -- -+ +- ++ + + +- ++ diff --git a/www/iridium/files/patch-sandbox_BUILD.gn b/www/iridium/files/patch-sandbox_BUILD.gn index ac6dfe163bf8..f886ae7b3745 100644 --- a/www/iridium/files/patch-sandbox_BUILD.gn +++ b/www/iridium/files/patch-sandbox_BUILD.gn @@ -1,11 +1,11 @@ ---- sandbox/BUILD.gn.orig 2022-03-28 18:11:04 UTC +--- sandbox/BUILD.gn.orig 2022-10-05 07:34:01 UTC +++ sandbox/BUILD.gn -@@ -27,7 +27,7 @@ group("sandbox") { +@@ -49,7 +49,7 @@ group("sandbox") { "//sandbox/mac:system_services", "//sandbox/mac/mojom", ] - } else if (is_linux || is_chromeos || is_android) { + } else if ((is_linux && !is_bsd) || is_chromeos || is_android) { public_deps = [ "//sandbox/linux:sandbox" ] } } diff --git a/www/iridium/files/patch-sandbox_policy_BUILD.gn b/www/iridium/files/patch-sandbox_policy_BUILD.gn index bbb00666a56a..07da53d91662 100644 --- a/www/iridium/files/patch-sandbox_policy_BUILD.gn +++ b/www/iridium/files/patch-sandbox_policy_BUILD.gn @@ -1,39 +1,39 @@ ---- sandbox/policy/BUILD.gn.orig 2022-03-28 18:11:04 UTC +--- sandbox/policy/BUILD.gn.orig 2022-10-05 07:34:01 UTC +++ sandbox/policy/BUILD.gn -@@ -35,7 +35,7 @@ component("policy") { +@@ -36,7 +36,7 @@ component("policy") { "//sandbox/policy/mojom", ] - public_deps = [] + public_deps = [ "//sandbox:common" ] - if (is_linux || is_chromeos) { + if ((is_linux || is_chromeos) && !is_bsd) { sources += [ "linux/bpf_audio_policy_linux.cc", "linux/bpf_audio_policy_linux.h", -@@ -88,6 +88,27 @@ component("policy") { +@@ -95,6 +95,27 @@ component("policy") { "//sandbox/linux:sandbox_services", "//sandbox/linux:seccomp_bpf", "//sandbox/linux:suid_sandbox_client", + ] + } + if (is_openbsd) { + sources += [ + "openbsd/sandbox_openbsd.cc", + "openbsd/sandbox_openbsd.h", + ] + deps += [ + "//sandbox:sandbox_buildflags", + "//ui/gfx/x", + ] + libs = [ "util" ] + } + if (is_freebsd) { + sources += [ + "freebsd/sandbox_freebsd.cc", + "freebsd/sandbox_freebsd.h", + ] + deps += [ + "//sandbox:sandbox_buildflags", + "//ui/gfx/x", ] } if (is_chromeos_ash) { diff --git a/www/iridium/files/patch-sandbox_policy_features.cc b/www/iridium/files/patch-sandbox_policy_features.cc index 5fa4be837913..87f3ff7eb452 100644 --- a/www/iridium/files/patch-sandbox_policy_features.cc +++ b/www/iridium/files/patch-sandbox_policy_features.cc @@ -1,14 +1,14 @@ ---- sandbox/policy/features.cc.orig 2022-03-28 18:11:04 UTC +--- sandbox/policy/features.cc.orig 2022-10-05 07:34:01 UTC +++ sandbox/policy/features.cc -@@ -16,7 +16,11 @@ namespace features { +@@ -14,7 +14,11 @@ namespace sandbox::policy::features { // Enables network service sandbox. // (Only causes an effect when feature kNetworkService is enabled.) const base::Feature kNetworkServiceSandbox{"NetworkServiceSandbox", +#if BUILDFLAG(IS_BSD) + base::FEATURE_ENABLED_BY_DEFAULT}; +#else base::FEATURE_DISABLED_BY_DEFAULT}; +#endif #endif // !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_FUCHSIA) #if BUILDFLAG(IS_WIN) diff --git a/www/iridium/files/patch-sandbox_policy_freebsd_sandbox__freebsd.cc b/www/iridium/files/patch-sandbox_policy_freebsd_sandbox__freebsd.cc index 61c39df7211e..b0b85e079d73 100644 --- a/www/iridium/files/patch-sandbox_policy_freebsd_sandbox__freebsd.cc +++ b/www/iridium/files/patch-sandbox_policy_freebsd_sandbox__freebsd.cc @@ -1,250 +1,256 @@ ---- sandbox/policy/freebsd/sandbox_freebsd.cc.orig 2022-03-28 18:11:04 UTC +--- sandbox/policy/freebsd/sandbox_freebsd.cc.orig 2022-10-05 07:34:01 UTC +++ sandbox/policy/freebsd/sandbox_freebsd.cc -@@ -0,0 +1,247 @@ +@@ -0,0 +1,253 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "sandbox/policy/openbsd/sandbox_openbsd.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "base/bind.h" +#include "base/callback_helpers.h" +#include "base/command_line.h" +#include "base/debug/stack_trace.h" +#include "base/feature_list.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/files/scoped_file.h" +#include "base/logging.h" +#include "base/memory/singleton.h" +#include "base/path_service.h" +#include "base/posix/eintr_wrapper.h" +#include "base/strings/string_number_conversions.h" +#include "base/system/sys_info.h" ++#include "base/threading/thread.h" +#include "base/time/time.h" +#include "build/build_config.h" +#include "sandbox/constants.h" +#include "sandbox/linux/services/credentials.h" +#include "sandbox/linux/services/namespace_sandbox.h" +#include "sandbox/linux/services/proc_util.h" +#include "sandbox/linux/services/resource_limits.h" +#include "sandbox/linux/services/thread_helpers.h" +#include "sandbox/linux/syscall_broker/broker_command.h" +#include "sandbox/linux/syscall_broker/broker_process.h" +#include "sandbox/policy/sandbox.h" +#include "sandbox/policy/sandbox_type.h" +#include "sandbox/policy/mojom/sandbox.mojom.h" +#include "sandbox/policy/switches.h" +#include "sandbox/sandbox_buildflags.h" + +#if BUILDFLAG(USING_SANITIZER) +#include +#endif + +#if defined(USE_NSS_CERTS) +#include "crypto/nss_util.h" +#endif + +#include "ui/gfx/x/connection.h" +#include "ui/gfx/font_util.h" + +#include + +#define MAXTOKENS 3 + +#define _UNVEIL_MAIN "/etc/iridium/unveil.main"; +#define _UNVEIL_RENDERER "/etc/iridium/unveil.renderer"; +#define _UNVEIL_GPU "/etc/iridium/unveil.gpu"; +#define _UNVEIL_PLUGIN "/etc/iridium/unveil.plugin"; +#define _UNVEIL_UTILITY "/etc/iridium/unveil.utility"; +#define _UNVEIL_UTILITY_NETWORK "/etc/iridium/unveil.utility_network"; +#define _UNVEIL_UTILITY_AUDIO "/etc/iridium/unveil.utility_audio"; +#define _UNVEIL_UTILITY_VIDEO "/etc/iridium/unveil.utility_video"; + +namespace sandbox { +namespace policy { + +SandboxLinux::SandboxLinux() + : sandbox_status_flags_(kInvalid), + pre_initialized_(false), + initialize_sandbox_ran_(false), + broker_process_(nullptr) { +} + +SandboxLinux::~SandboxLinux() { + if (pre_initialized_) { + CHECK(initialize_sandbox_ran_); + } +} + +SandboxLinux* SandboxLinux::GetInstance() { + SandboxLinux* instance = base::Singleton::get(); + CHECK(instance); + return instance; +} + ++void SandboxLinux::StopThread(base::Thread* thread) { ++ DCHECK(thread); ++ thread->Stop(); ++} ++ +void SandboxLinux::PreinitializeSandbox(sandbox::mojom::Sandbox sandbox_type) { + CHECK(!pre_initialized_); +#if BUILDFLAG(USING_SANITIZER) + // Sanitizers need to open some resources before the sandbox is enabled. + // This should not fork, not launch threads, not open a directory. + __sanitizer_sandbox_on_notify(sanitizer_args()); + sanitizer_args_.reset(); +#endif + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + const std::string process_type = + command_line->GetSwitchValueASCII(switches::kProcessType); + + base::SysInfo::AmountOfPhysicalMemory(); + base::SysInfo::NumberOfProcessors(); + +#if defined(USE_NSS_CERTS) + // The main process has to initialize the ~/.pki dir which won't work + // after unveil(2). + if (process_type.empty()) + crypto::EnsureNSSInit(); +#endif + + // cache the XErrorDB by forcing a read on it + { + auto* connection = x11::Connection::Get(); + auto* display = connection->GetXlibDisplay().display(); + + char buf[1]; -+ XGetErrorDatabaseText(display, "XProtoError", "0", "", buf, base::size(buf)); ++ XGetErrorDatabaseText(display, "XProtoError", "0", "", buf, std::size(buf)); + } + + if (process_type.empty()) { + base::FilePath cache_directory, local_directory; + + base::PathService::Get(base::DIR_CACHE, &cache_directory); + base::PathService::Get(base::DIR_HOME, &local_directory); + + cache_directory = cache_directory.AppendASCII("iridium"); + local_directory = local_directory.AppendASCII(".local").AppendASCII("share").AppendASCII("applications"); + + if (!base::CreateDirectory(cache_directory)) { + LOG(ERROR) << "Failed to create " << cache_directory.value() << " directory."; + } + + if (!base::CreateDirectory(local_directory)) { + LOG(ERROR) << "Failed to create " << local_directory.value() << " directory."; + } + } + + if (process_type == switches::kRendererProcess) + gfx::InitializeFonts(); + + pre_initialized_ = true; +} + +bool SandboxLinux::InitializeSandbox(sandbox::mojom::Sandbox sandbox_type, + SandboxLinux::PreSandboxHook hook, + const Options& options) { + DCHECK(!initialize_sandbox_ran_); + initialize_sandbox_ran_ = true; + + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + const std::string process_type = + command_line->GetSwitchValueASCII(switches::kProcessType); + + if (command_line->HasSwitch(switches::kNoSandbox)) + return true; + + VLOG(1) << "SandboxLinux::InitializeSandbox: process_type=" + << process_type << " sandbox_type=" << GetSandboxTypeInEnglish(sandbox_type); + + // Only one thread is running, pre-initialize if not already done. + if (!pre_initialized_) + PreinitializeSandbox(sandbox_type); + + // Attempt to limit the future size of the address space of the process. + int error = 0; + const bool limited_as = LimitAddressSpace(&error); + if (error) { + // Restore errno. Internally to |LimitAddressSpace|, the errno due to + // setrlimit may be lost. + errno = error; + PCHECK(limited_as); + } + + return true; +} + +bool SandboxLinux::LimitAddressSpace(int* error) { +#if !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) && \ + !defined(THREAD_SANITIZER) && !defined(LEAK_SANITIZER) + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + if (SandboxTypeFromCommandLine(*command_line) == sandbox::mojom::Sandbox::kNoSandbox) { + return false; + } + + // Unfortunately, it does not appear possible to set RLIMIT_AS such that it + // will both (a) be high enough to support V8's and WebAssembly's address + // space requirements while also (b) being low enough to mitigate exploits + // using integer overflows that require large allocations, heap spray, or + // other memory-hungry attack modes. + + *error = sandbox::ResourceLimits::Lower( + RLIMIT_DATA, static_cast(sandbox::kDataSizeLimit)); + + // Cache the resource limit before turning on the sandbox. + base::SysInfo::AmountOfVirtualMemory(); + base::SysInfo::MaxSharedMemorySize(); + + return *error == 0; +#else + base::SysInfo::AmountOfVirtualMemory(); + return false; +#endif // !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) && + // !defined(THREAD_SANITIZER) && !defined(LEAK_SANITIZER) +} + +// static +std::string SandboxLinux::GetSandboxTypeInEnglish(sandbox::mojom::Sandbox sandbox_type) { + switch (sandbox_type) { + case sandbox::mojom::Sandbox::kNoSandbox: + return "Unsandboxed"; + case sandbox::mojom::Sandbox::kRenderer: + return "Renderer"; + case sandbox::mojom::Sandbox::kUtility: + return "Utility"; + case sandbox::mojom::Sandbox::kGpu: + return "GPU"; + case sandbox::mojom::Sandbox::kPpapi: + return "PPAPI"; + case sandbox::mojom::Sandbox::kNetwork: + return "Network"; + case sandbox::mojom::Sandbox::kCdm: + return "CDM"; + case sandbox::mojom::Sandbox::kPrintCompositor: + return "Print Compositor"; + case sandbox::mojom::Sandbox::kAudio: + return "Audio"; + case sandbox::mojom::Sandbox::kSpeechRecognition: + return "Speech Recognition"; + case sandbox::mojom::Sandbox::kService: + return "Service"; + case sandbox::mojom::Sandbox::kVideoCapture: + return "Video Capture"; + default: + return "Unknown"; + } +} + +} // namespace policy +} // namespace sandbox diff --git a/www/iridium/files/patch-sandbox_policy_mojom_sandbox.mojom b/www/iridium/files/patch-sandbox_policy_mojom_sandbox.mojom index 2e3391593673..be313e92a12f 100644 --- a/www/iridium/files/patch-sandbox_policy_mojom_sandbox.mojom +++ b/www/iridium/files/patch-sandbox_policy_mojom_sandbox.mojom @@ -1,15 +1,15 @@ ---- sandbox/policy/mojom/sandbox.mojom.orig 2022-03-28 18:11:04 UTC +--- sandbox/policy/mojom/sandbox.mojom.orig 2022-10-05 07:34:01 UTC +++ sandbox/policy/mojom/sandbox.mojom -@@ -68,6 +68,12 @@ enum Sandbox { +@@ -72,6 +72,12 @@ enum Sandbox { [EnableIf=is_fuchsia] kVideoCapture, + [EnableIf=is_openbsd] + kVideoCapture, + + [EnableIf=is_freebsd] + kVideoCapture, + // Allows access to file contents and Windows APIs for parsing icons from PE // files. [EnableIf=is_win] diff --git a/www/iridium/files/patch-sandbox_policy_openbsd_sandbox__openbsd.cc b/www/iridium/files/patch-sandbox_policy_openbsd_sandbox__openbsd.cc index 007eefd5cb24..089b476617e8 100644 --- a/www/iridium/files/patch-sandbox_policy_openbsd_sandbox__openbsd.cc +++ b/www/iridium/files/patch-sandbox_policy_openbsd_sandbox__openbsd.cc @@ -1,410 +1,416 @@ ---- sandbox/policy/openbsd/sandbox_openbsd.cc.orig 2022-03-28 18:11:04 UTC +--- sandbox/policy/openbsd/sandbox_openbsd.cc.orig 2022-10-05 07:34:01 UTC +++ sandbox/policy/openbsd/sandbox_openbsd.cc -@@ -0,0 +1,407 @@ +@@ -0,0 +1,413 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "sandbox/policy/openbsd/sandbox_openbsd.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "base/bind.h" +#include "base/callback_helpers.h" +#include "base/command_line.h" +#include "base/debug/stack_trace.h" +#include "base/feature_list.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/files/scoped_file.h" +#include "base/logging.h" +#include "base/memory/singleton.h" +#include "base/path_service.h" +#include "base/posix/eintr_wrapper.h" +#include "base/strings/string_number_conversions.h" +#include "base/system/sys_info.h" ++#include "base/threading/thread.h" +#include "base/time/time.h" +#include "build/build_config.h" +#include "sandbox/constants.h" +#include "sandbox/linux/services/credentials.h" +#include "sandbox/linux/services/namespace_sandbox.h" +#include "sandbox/linux/services/proc_util.h" +#include "sandbox/linux/services/resource_limits.h" +#include "sandbox/linux/services/thread_helpers.h" +#include "sandbox/linux/syscall_broker/broker_command.h" +#include "sandbox/linux/syscall_broker/broker_process.h" +#include "sandbox/policy/sandbox.h" +#include "sandbox/policy/sandbox_type.h" +#include "sandbox/policy/mojom/sandbox.mojom.h" +#include "sandbox/policy/switches.h" +#include "sandbox/sandbox_buildflags.h" + +#if BUILDFLAG(USING_SANITIZER) +#include +#endif + +#if defined(USE_NSS_CERTS) +#include "crypto/nss_util.h" +#endif + +#include "third_party/boringssl/src/include/openssl/crypto.h" + +#include "ui/gfx/x/connection.h" +#include "ui/gfx/font_util.h" + +#include + +#define MAXTOKENS 3 + +#define _UNVEIL_MAIN "/etc/iridium/unveil.main"; +#define _UNVEIL_RENDERER "/etc/iridium/unveil.renderer"; +#define _UNVEIL_GPU "/etc/iridium/unveil.gpu"; +#define _UNVEIL_PLUGIN "/etc/iridium/unveil.plugin"; +#define _UNVEIL_UTILITY "/etc/iridium/unveil.utility"; +#define _UNVEIL_UTILITY_NETWORK "/etc/iridium/unveil.utility_network"; +#define _UNVEIL_UTILITY_AUDIO "/etc/iridium/unveil.utility_audio"; +#define _UNVEIL_UTILITY_VIDEO "/etc/iridium/unveil.utility_video"; + +namespace sandbox { +namespace policy { + +SandboxLinux::SandboxLinux() + : unveil_initialized_(false), + sandbox_status_flags_(kInvalid), + pre_initialized_(false), + initialize_sandbox_ran_(false), + broker_process_(nullptr) { +} + +SandboxLinux::~SandboxLinux() { + if (pre_initialized_) { + CHECK(initialize_sandbox_ran_); + } +} + +SandboxLinux* SandboxLinux::GetInstance() { + SandboxLinux* instance = base::Singleton::get(); + CHECK(instance); + return instance; +} + ++void SandboxLinux::StopThread(base::Thread* thread) { ++ DCHECK(thread); ++ thread->Stop(); ++} ++ +void SandboxLinux::PreinitializeSandbox(sandbox::mojom::Sandbox sandbox_type) { + CHECK(!pre_initialized_); +#if BUILDFLAG(USING_SANITIZER) + // Sanitizers need to open some resources before the sandbox is enabled. + // This should not fork, not launch threads, not open a directory. + __sanitizer_sandbox_on_notify(sanitizer_args()); + sanitizer_args_.reset(); +#endif + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + const std::string process_type = + command_line->GetSwitchValueASCII(switches::kProcessType); + + base::SysInfo::AmountOfPhysicalMemory(); + base::SysInfo::NumberOfProcessors(); + base::SysInfo::CPUModelName(); + +#if defined(USE_NSS_CERTS) + // The main process has to initialize the ~/.pki dir which won't work + // after unveil(2). + if (process_type.empty()) + crypto::EnsureNSSInit(); +#endif + + if (process_type.empty()) + CRYPTO_pre_sandbox_init(); + + // cache the XErrorDB by forcing a read on it + { + auto* connection = x11::Connection::Get(); + auto* display = connection->GetXlibDisplay().display(); + + char buf[1]; -+ XGetErrorDatabaseText(display, "XProtoError", "0", "", buf, base::size(buf)); ++ XGetErrorDatabaseText(display, "XProtoError", "0", "", buf, std::size(buf)); + } + + if (process_type.empty()) { + base::FilePath cache_directory, local_directory; + + base::PathService::Get(base::DIR_CACHE, &cache_directory); + base::PathService::Get(base::DIR_HOME, &local_directory); + + cache_directory = cache_directory.AppendASCII("iridium"); + local_directory = local_directory.AppendASCII(".local").AppendASCII("share").AppendASCII("applications"); + + if (!base::CreateDirectory(cache_directory)) { + LOG(ERROR) << "Failed to create " << cache_directory.value() << " directory."; + } + + if (!base::CreateDirectory(local_directory)) { + LOG(ERROR) << "Failed to create " << local_directory.value() << " directory."; + } + } + + if (process_type == switches::kRendererProcess) + gfx::InitializeFonts(); + + if (!command_line->HasSwitch(switches::kDisableUnveil)) + SetUnveil(process_type, sandbox_type); + + pre_initialized_ = true; +} + +bool SandboxLinux::SetPledge(const char *pstring, const char *ppath) { + FILE *fp; + char *s = NULL; + size_t len = 0; + ssize_t read; + + if (pstring != NULL) { + if (pledge(pstring, NULL) == -1) + goto err; + } else if (ppath != NULL) { + fp = fopen(ppath, "r"); + if (fp != NULL) { + while ((read = getline(&s, &len, fp)) != -1 ) { + if (s[strlen(s)-1] == '\n') + s[strlen(s)-1] = '\0'; + if (pledge(s, NULL) == -1) + goto err; + } + fclose(fp); + } else { + LOG(ERROR) << "fopen() failed, errno: " << errno; + return false; + } + } + return true; +err: + LOG(ERROR) << "pledge() failed, errno: " << errno; + return false; +} + +bool SandboxLinux::SetUnveil(const std::string process_type, sandbox::mojom::Sandbox sandbox_type) { + FILE *fp; + char *s = NULL, *cp = NULL, *home = NULL, **ap, *tokens[MAXTOKENS]; + char path[PATH_MAX]; + const char *ufile; + size_t len = 0, lineno = 0; + + if (process_type.empty()) { + ufile = _UNVEIL_MAIN; + } else if (process_type == switches::kRendererProcess) { + ufile = _UNVEIL_RENDERER; + } else if (process_type == switches::kGpuProcess) { + ufile = _UNVEIL_GPU; + } else if (process_type == switches::kPpapiPluginProcess) { + ufile = _UNVEIL_PLUGIN; + } else if (process_type == switches::kUtilityProcess) { + if (sandbox_type == sandbox::mojom::Sandbox::kNetwork) { + ufile = _UNVEIL_UTILITY_NETWORK; + } else if (sandbox_type == sandbox::mojom::Sandbox::kAudio) { + ufile = _UNVEIL_UTILITY_AUDIO; + } else if (sandbox_type == sandbox::mojom::Sandbox::kVideoCapture) { + ufile = _UNVEIL_UTILITY_VIDEO; + } else { + ufile = _UNVEIL_UTILITY; + } + } + + fp = fopen(ufile, "r"); + if (fp != NULL) { + while (!feof(fp)) { + if ((s = fparseln(fp, &len, &lineno, NULL, + FPARSELN_UNESCCOMM | FPARSELN_UNESCCONT)) == NULL) { + if (ferror(fp)) { + LOG(ERROR) << "ferror(), errno: " << errno; + _exit(1); + } else { + continue; + } + } + cp = s; + cp += strspn(cp, " \t\n"); /* eat whitespace */ + if (cp[0] == '\0') + continue; + + for (ap = tokens; ap < &tokens[MAXTOKENS - 1] && + (*ap = strsep(&cp, " \t")) != NULL;) { + if (**ap != '\0') + ap++; + } + *ap = NULL; + + if (tokens[1] == NULL) { + LOG(ERROR) << ufile << ": line " << lineno << ": must supply value to " << s; + _exit(1); + } + + if (tokens[0][0] == '~') { + if ((home = getenv("HOME")) == NULL || *home == '\0') { + LOG(ERROR) << "failed to get home"; + _exit(1); + } + memmove(tokens[0], tokens[0] + 1, strlen(tokens[0])); + strncpy(path, home, sizeof(path) - 1); + path[sizeof(path) - 1] = '\0'; + strncat(path, tokens[0], sizeof(path) - 1 - strlen(path)); + } else { + strncpy(path, tokens[0], sizeof(path) - 1); + path[sizeof(path) - 1] = '\0'; + } + + if (unveil(path, tokens[1]) == -1) { + LOG(ERROR) << "failed unveiling " << path << " with permissions " << tokens[1]; + _exit(1); + } else { + VLOG(1) << "unveiling " << path << " with permissions " << tokens[1]; + } + } + fclose(fp); + } else { + LOG(ERROR) << "failed to open " << ufile << " errno: " << errno; + _exit(1); + } + + unveil_initialized_ = true; + + return true; +} + +bool SandboxLinux::unveil_initialized() const { + return unveil_initialized_; +} + +bool SandboxLinux::InitializeSandbox(sandbox::mojom::Sandbox sandbox_type, + SandboxLinux::PreSandboxHook hook, + const Options& options) { + DCHECK(!initialize_sandbox_ran_); + initialize_sandbox_ran_ = true; + + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + const std::string process_type = + command_line->GetSwitchValueASCII(switches::kProcessType); + + if (command_line->HasSwitch(switches::kNoSandbox)) + return true; + + VLOG(1) << "SandboxLinux::InitializeSandbox: process_type=" + << process_type << " sandbox_type=" << GetSandboxTypeInEnglish(sandbox_type); + + // Only one thread is running, pre-initialize if not already done. + if (!pre_initialized_) + PreinitializeSandbox(sandbox_type); + + // Attempt to limit the future size of the address space of the process. + int error = 0; + const bool limited_as = LimitAddressSpace(&error); + if (error) { + // Restore errno. Internally to |LimitAddressSpace|, the errno due to + // setrlimit may be lost. + errno = error; + PCHECK(limited_as); + } + + if (process_type.empty()) { + // XXX use a file for listing pledges of the main process for now + // XXX not having the file is not a fatal error + SetPledge(NULL, "/etc/iridium/pledge.main"); + } else if (process_type == switches::kRendererProcess) { + // prot_exec needed by v8 + // flock needed by sqlite3 locking + SetPledge("stdio rpath flock prot_exec recvfd sendfd ps", NULL); + } else if (process_type == switches::kGpuProcess) { + SetPledge("stdio rpath cpath wpath getpw drm prot_exec recvfd sendfd tmppath", NULL); + } else if (process_type == switches::kPpapiPluginProcess) { + // prot_exec needed by v8 + SetPledge("stdio rpath prot_exec recvfd sendfd", NULL); + } else if (process_type == switches::kUtilityProcess) { + if (sandbox_type == sandbox::mojom::Sandbox::kAudio) + SetPledge(NULL, "/etc/iridium/pledge.utility_audio"); + else if (sandbox_type == sandbox::mojom::Sandbox::kNetwork) + SetPledge(NULL, "/etc/iridium/pledge.utility_network"); + else if (sandbox_type == sandbox::mojom::Sandbox::kVideoCapture) + SetPledge(NULL, "/etc/iridium/pledge.utility_video"); + else + SetPledge("stdio rpath cpath wpath fattr flock sendfd recvfd prot_exec", NULL); + } else { + LOG(ERROR) << "non-pledge()'d process: " << process_type; + return false; + } + + return true; +} + +bool SandboxLinux::LimitAddressSpace(int* error) { +#if !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) && \ + !defined(THREAD_SANITIZER) && !defined(LEAK_SANITIZER) + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + if (SandboxTypeFromCommandLine(*command_line) == sandbox::mojom::Sandbox::kNoSandbox) { + return false; + } + + // Unfortunately, it does not appear possible to set RLIMIT_AS such that it + // will both (a) be high enough to support V8's and WebAssembly's address + // space requirements while also (b) being low enough to mitigate exploits + // using integer overflows that require large allocations, heap spray, or + // other memory-hungry attack modes. + + *error = sandbox::ResourceLimits::Lower( + RLIMIT_DATA, static_cast(sandbox::kDataSizeLimit)); + + // Cache the resource limit before turning on the sandbox. + base::SysInfo::AmountOfVirtualMemory(); + base::SysInfo::MaxSharedMemorySize(); + + return *error == 0; +#else + base::SysInfo::AmountOfVirtualMemory(); + return false; +#endif // !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) && + // !defined(THREAD_SANITIZER) && !defined(LEAK_SANITIZER) +} + +// static +std::string SandboxLinux::GetSandboxTypeInEnglish(sandbox::mojom::Sandbox sandbox_type) { + switch (sandbox_type) { + case sandbox::mojom::Sandbox::kNoSandbox: + return "Unsandboxed"; + case sandbox::mojom::Sandbox::kRenderer: + return "Renderer"; + case sandbox::mojom::Sandbox::kUtility: + return "Utility"; + case sandbox::mojom::Sandbox::kGpu: + return "GPU"; + case sandbox::mojom::Sandbox::kPpapi: + return "PPAPI"; + case sandbox::mojom::Sandbox::kNetwork: + return "Network"; + case sandbox::mojom::Sandbox::kCdm: + return "CDM"; + case sandbox::mojom::Sandbox::kPrintCompositor: + return "Print Compositor"; + case sandbox::mojom::Sandbox::kAudio: + return "Audio"; + case sandbox::mojom::Sandbox::kSpeechRecognition: + return "Speech Recognition"; + case sandbox::mojom::Sandbox::kService: + return "Service"; + case sandbox::mojom::Sandbox::kVideoCapture: + return "Video Capture"; + default: + return "Unknown"; + } +} + +} // namespace policy +} // namespace sandbox diff --git a/www/iridium/files/patch-sandbox_policy_sandbox__type.cc b/www/iridium/files/patch-sandbox_policy_sandbox__type.cc index f7b0eb212ef9..dcd8ba9be830 100644 --- a/www/iridium/files/patch-sandbox_policy_sandbox__type.cc +++ b/www/iridium/files/patch-sandbox_policy_sandbox__type.cc @@ -1,38 +1,70 @@ ---- sandbox/policy/sandbox_type.cc.orig 2022-03-28 18:11:04 UTC +--- sandbox/policy/sandbox_type.cc.orig 2022-10-05 07:34:01 UTC +++ sandbox/policy/sandbox_type.cc @@ -39,7 +39,7 @@ bool IsUnsandboxedSandboxType(Sandbox sandbox_type) { #endif case Sandbox::kAudio: return false; -#if BUILDFLAG(IS_FUCHSIA) +#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) case Sandbox::kVideoCapture: return false; #endif -@@ -122,7 +122,7 @@ void SetCommandLineFlagsForSandboxType(base::CommandLi +@@ -62,7 +62,7 @@ bool IsUnsandboxedSandboxType(Sandbox sandbox_type) { + case Sandbox::kMirroring: + case Sandbox::kNaClLoader: + #endif +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD) + case Sandbox::kHardwareVideoDecoding: + #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) + #if BUILDFLAG(IS_CHROMEOS_ASH) +@@ -127,7 +127,7 @@ void SetCommandLineFlagsForSandboxType(base::CommandLi #endif case Sandbox::kPrintCompositor: case Sandbox::kAudio: -#if BUILDFLAG(IS_FUCHSIA) +#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) case Sandbox::kVideoCapture: #endif #if BUILDFLAG(IS_WIN) -@@ -247,7 +247,7 @@ std::string StringFromUtilitySandboxType(Sandbox sandb +@@ -138,7 +138,7 @@ void SetCommandLineFlagsForSandboxType(base::CommandLi + case Sandbox::kMediaFoundationCdm: + case Sandbox::kWindowsSystemProxyResolver: + #endif // BUILDFLAG(IS_WIN) +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD) + case Sandbox::kHardwareVideoDecoding: + #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) + #if BUILDFLAG(IS_CHROMEOS_ASH) +@@ -257,7 +257,7 @@ std::string StringFromUtilitySandboxType(Sandbox sandb return switches::kUtilitySandbox; case Sandbox::kAudio: return switches::kAudioSandbox; -#if BUILDFLAG(IS_FUCHSIA) +#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) case Sandbox::kVideoCapture: return switches::kVideoCaptureSandbox; #endif -@@ -355,7 +355,7 @@ sandbox::mojom::Sandbox UtilitySandboxTypeFromString( - return Sandbox::kAudio; - if (sandbox_string == switches::kSpeechRecognitionSandbox) - return Sandbox::kSpeechRecognition; +@@ -287,7 +287,7 @@ std::string StringFromUtilitySandboxType(Sandbox sandb + case Sandbox::kMirroring: + return switches::kMirroringSandbox; + #endif +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD) + case Sandbox::kHardwareVideoDecoding: + return switches::kHardwareVideoDecodingSandbox; + #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) +@@ -375,11 +375,11 @@ sandbox::mojom::Sandbox UtilitySandboxTypeFromString( + if (sandbox_string == switches::kScreenAISandbox) + return Sandbox::kScreenAI; + #endif -#if BUILDFLAG(IS_FUCHSIA) +#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) if (sandbox_string == switches::kVideoCaptureSandbox) return Sandbox::kVideoCapture; #endif +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD) + if (sandbox_string == switches::kHardwareVideoDecodingSandbox) + return Sandbox::kHardwareVideoDecoding; + #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) diff --git a/www/iridium/files/patch-sandbox_policy_switches.cc b/www/iridium/files/patch-sandbox_policy_switches.cc index 3df244b702f1..980397d2e4d1 100644 --- a/www/iridium/files/patch-sandbox_policy_switches.cc +++ b/www/iridium/files/patch-sandbox_policy_switches.cc @@ -1,13 +1,22 @@ ---- sandbox/policy/switches.cc.orig 2022-03-28 18:11:04 UTC +--- sandbox/policy/switches.cc.orig 2022-10-05 07:34:01 UTC +++ sandbox/policy/switches.cc -@@ -95,7 +95,9 @@ const char kGpuSandboxFailuresFatal[] = "gpu-sandbox-f +@@ -54,7 +54,7 @@ const char kWindowsSystemProxyResolverSandbox[] = "pro + const char kMirroringSandbox[] = "mirroring"; + #endif // BUILDFLAG(IS_MAC) + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD) + const char kHardwareVideoDecodingSandbox[] = "hardware_video_decoding"; + #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) + +@@ -101,7 +101,9 @@ const char kGpuSandboxFailuresFatal[] = "gpu-sandbox-f // Meant to be used as a browser-level switch for testing purposes only. const char kNoSandbox[] = "no-sandbox"; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +const char kDisableUnveil[] = "disable-unveil"; + +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // Instructs the zygote to launch without a sandbox. Processes forked from this // type of zygote will apply their own custom sandboxes later. const char kNoZygoteSandbox[] = "no-zygote-sandbox"; diff --git a/www/iridium/files/patch-sandbox_policy_switches.h b/www/iridium/files/patch-sandbox_policy_switches.h index b1c31829d3fc..b36f19c01e01 100644 --- a/www/iridium/files/patch-sandbox_policy_switches.h +++ b/www/iridium/files/patch-sandbox_policy_switches.h @@ -1,12 +1,21 @@ ---- sandbox/policy/switches.h.orig 2022-03-28 18:11:04 UTC +--- sandbox/policy/switches.h.orig 2022-10-05 07:34:01 UTC +++ sandbox/policy/switches.h -@@ -71,7 +71,8 @@ SANDBOX_POLICY_EXPORT extern const char kDisableSetuid +@@ -56,7 +56,7 @@ SANDBOX_POLICY_EXPORT extern const char kWindowsSystem + SANDBOX_POLICY_EXPORT extern const char kMirroringSandbox[]; + #endif // BUILDFLAG(IS_MAC) + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD) + SANDBOX_POLICY_EXPORT extern const char kHardwareVideoDecodingSandbox[]; + #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) + +@@ -78,7 +78,8 @@ SANDBOX_POLICY_EXPORT extern const char kDisableSetuid SANDBOX_POLICY_EXPORT extern const char kGpuSandboxAllowSysVShm[]; SANDBOX_POLICY_EXPORT extern const char kGpuSandboxFailuresFatal[]; SANDBOX_POLICY_EXPORT extern const char kNoSandbox[]; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +SANDBOX_POLICY_EXPORT extern const char kDisableUnveil[]; +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) SANDBOX_POLICY_EXPORT extern const char kNoZygoteSandbox[]; #endif #if BUILDFLAG(IS_WIN) diff --git a/www/iridium/files/patch-services_cert__verifier_cert__verifier__creation.cc b/www/iridium/files/patch-services_cert__verifier_cert__verifier__creation.cc index 0332cb93a1db..00242505f4bb 100644 --- a/www/iridium/files/patch-services_cert__verifier_cert__verifier__creation.cc +++ b/www/iridium/files/patch-services_cert__verifier_cert__verifier__creation.cc @@ -1,30 +1,28 @@ ---- services/cert_verifier/cert_verifier_creation.cc.orig 2022-03-28 18:11:04 UTC +--- services/cert_verifier/cert_verifier_creation.cc.orig 2022-10-05 07:34:01 UTC +++ services/cert_verifier/cert_verifier_creation.cc -@@ -86,7 +86,7 @@ scoped_refptr CreateCertVerifyPro - scoped_refptr CreateOldDefaultWithoutCaching( - scoped_refptr cert_net_fetcher) { - scoped_refptr verify_proc; --#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) -+#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) - verify_proc = - net::CertVerifyProc::CreateBuiltinVerifyProc(std::move(cert_net_fetcher)); +@@ -12,7 +12,7 @@ + #include "net/cert_net/cert_net_fetcher_url_request.h" + #include "net/net_buildflags.h" + +-#if BUILDFLAG(BUILTIN_CERT_VERIFIER_FEATURE_SUPPORTED) || \ ++#if BUILDFLAG(BUILTIN_CERT_VERIFIER_FEATURE_SUPPORTED) || BUILDFLAG(IS_BSD) || \ + BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) + #include "net/cert/cert_verify_proc_builtin.h" + #include "net/cert/internal/system_trust_store.h" +@@ -119,7 +119,7 @@ class OldDefaultCertVerifyProcFactory : public net::Ce + user_slot_restriction_ ? crypto::ScopedPK11Slot(PK11_ReferenceSlot( + user_slot_restriction_.get())) + : nullptr)); +-#elif BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) ++#elif BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + verify_proc = net::CreateCertVerifyProcBuiltin( + std::move(cert_net_fetcher), net::CreateSslSystemTrustStore()); #else -@@ -104,7 +104,7 @@ scoped_refptr CreateNewDefaultWit - scoped_refptr cert_net_fetcher) { - scoped_refptr verify_proc; - #if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) && \ -- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)) -+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)) - verify_proc = net::CreateCertVerifyProcBuiltin( - std::move(cert_net_fetcher), net::CreateSslSystemTrustStoreChromeRoot()); - #elif BUILDFLAG(BUILTIN_CERT_VERIFIER_FEATURE_SUPPORTED) -@@ -122,7 +122,8 @@ bool IsUsingCertNetFetcher() { +@@ -294,6 +294,7 @@ bool IsUsingChromeRootStore( + bool IsUsingCertNetFetcher() { #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || \ ++ BUILDFLAG(IS_BSD) || \ BUILDFLAG(TRIAL_COMPARISON_CERT_VERIFIER_SUPPORTED) || \ -- BUILDFLAG(BUILTIN_CERT_VERIFIER_FEATURE_SUPPORTED) -+ BUILDFLAG(BUILTIN_CERT_VERIFIER_FEATURE_SUPPORTED) || \ -+ BUILDFLAG(IS_BSD) - return true; - #else - return false; + BUILDFLAG(BUILTIN_CERT_VERIFIER_FEATURE_SUPPORTED) || \ + BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) diff --git a/www/iridium/files/patch-services_device_compute__pressure_cpu__probe.cc b/www/iridium/files/patch-services_device_compute__pressure_cpu__probe.cc new file mode 100644 index 000000000000..f61493ec4929 --- /dev/null +++ b/www/iridium/files/patch-services_device_compute__pressure_cpu__probe.cc @@ -0,0 +1,10 @@ +--- services/device/compute_pressure/cpu_probe.cc.orig 2022-10-05 07:34:01 UTC ++++ services/device/compute_pressure/cpu_probe.cc +@@ -63,6 +63,7 @@ std::unique_ptr CpuProbe::Create() { + #elif BUILDFLAG(IS_MAC) + return CpuProbeMac::Create(); + #else ++ NOTIMPLEMENTED(); + return std::make_unique(); + #endif // BUILDFLAG(IS_ANDROID) + } diff --git a/www/iridium/files/patch-services_device_hid_hid__connection__fido.cc b/www/iridium/files/patch-services_device_hid_hid__connection__fido.cc index 58707abb3e41..cf540ae9bf1a 100644 --- a/www/iridium/files/patch-services_device_hid_hid__connection__fido.cc +++ b/www/iridium/files/patch-services_device_hid_hid__connection__fido.cc @@ -1,201 +1,200 @@ ---- services/device/hid/hid_connection_fido.cc.orig 2022-03-28 18:11:04 UTC +--- services/device/hid/hid_connection_fido.cc.orig 2022-10-05 07:34:01 UTC +++ services/device/hid/hid_connection_fido.cc -@@ -0,0 +1,198 @@ +@@ -0,0 +1,197 @@ +// Copyright (c) 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/device/hid/hid_connection_fido.h" + +#include "base/bind.h" +#include "base/files/file_descriptor_watcher_posix.h" +#include "base/location.h" +#include "base/numerics/safe_math.h" +#include "base/posix/eintr_wrapper.h" -+#include "base/task/post_task.h" +#include "base/task/single_thread_task_runner.h" +#include "base/threading/scoped_blocking_call.h" +#include "base/threading/thread_restrictions.h" +#include "base/threading/thread_task_runner_handle.h" +#include "components/device_event_log/device_event_log.h" +#include "services/device/hid/hid_service.h" + +namespace device { + +class HidConnectionFido::BlockingTaskHelper { +public: + BlockingTaskHelper(base::ScopedFD fd, + scoped_refptr device_info, + base::WeakPtr connection) + : fd_(std::move(fd)), + // Report buffers must always have room for the report ID. + report_buffer_size_(device_info->max_input_report_size() + 1), + has_report_id_(device_info->has_report_id()), connection_(connection), + origin_task_runner_(base::ThreadTaskRunnerHandle::Get()) { + DETACH_FROM_SEQUENCE(sequence_checker_); + } + + BlockingTaskHelper(const BlockingTaskHelper&) = delete; + BlockingTaskHelper& operator=(const BlockingTaskHelper&) = delete; + + ~BlockingTaskHelper() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } + + // Starts the FileDescriptorWatcher that reads input events from the device. + // Must be called on a thread that has a base::MessageLoopForIO. + void Start() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + base::internal::AssertBlockingAllowed(); + + file_watcher_ = base::FileDescriptorWatcher::WatchReadable( + fd_.get(), base::BindRepeating(&BlockingTaskHelper::OnFileCanReadWithoutBlocking, + base::Unretained(this))); + } + + void Write(scoped_refptr buffer, + WriteCallback callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + base::ScopedBlockingCall scoped_blocking_call( + FROM_HERE, base::BlockingType::MAY_BLOCK); + + auto data = buffer->front(); + size_t size = buffer->size(); + // if report id is 0, it shouldn't be included + if (data[0] == 0) { + data++; + size--; + } + + ssize_t result = HANDLE_EINTR(write(fd_.get(), data, size)); + bool success = static_cast(result) == size; + if (!success) { + HID_LOG(EVENT) << "HID write failed: " << result << " != " << size; + } + origin_task_runner_->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), success)); + } + + void GetFeatureReport(uint8_t report_id, + scoped_refptr buffer, + ReadCallback callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + base::ScopedBlockingCall scoped_blocking_call( + FROM_HERE, base::BlockingType::MAY_BLOCK); + HID_PLOG(EVENT) << "GendFeatureReport not implemented on OpenBSD"; + origin_task_runner_->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), false, nullptr, 0)); + } + + void SendFeatureReport(scoped_refptr buffer, + WriteCallback callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + HID_PLOG(EVENT) << "SendFeatureReport not implemented on OpenBSD"; + origin_task_runner_->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), false)); + } + +private: + void OnFileCanReadWithoutBlocking() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + scoped_refptr buffer( + new base::RefCountedBytes(report_buffer_size_)); + unsigned char *data = buffer->front(); + size_t length = report_buffer_size_; + if (!has_report_id_) { + // OpenBSD will not prefix the buffer with a report ID if report IDs are + // not used by the device. Prefix the buffer with 0. + *data++ = 0; + length--; + } + + ssize_t bytes_read = HANDLE_EINTR(read(fd_.get(), data, length)); + if (bytes_read < 0) { + if (errno != EAGAIN) { + HID_PLOG(EVENT) << "Read failed"; + // This assumes that the error is unrecoverable and disables reading + // from the device until it has been re-opened. + // TODO(reillyg): Investigate starting and stopping the file descriptor + // watcher in response to pending read requests so that per-request + // errors can be returned to the client. + file_watcher_.reset(); + } + return; + } + if (!has_report_id_) { + // Behave as if the byte prefixed above as the the report ID was read. + bytes_read++; + } + + origin_task_runner_->PostTask( + FROM_HERE, base::BindOnce(&HidConnectionFido::ProcessInputReport, + connection_, buffer, bytes_read)); + } + + SEQUENCE_CHECKER(sequence_checker_); + base::ScopedFD fd_; + const size_t report_buffer_size_; + const bool has_report_id_; + base::WeakPtr connection_; + const scoped_refptr origin_task_runner_; + std::unique_ptr file_watcher_; +}; + +HidConnectionFido::HidConnectionFido( + scoped_refptr device_info, base::ScopedFD fd, + scoped_refptr blocking_task_runner, + bool allow_protected_reports, bool allow_fido_reports) + : HidConnection(device_info, allow_protected_reports, allow_fido_reports), + blocking_task_runner_(std::move(blocking_task_runner)), + weak_factory_(this), + helper_(std::make_unique( + std::move(fd), device_info, weak_factory_.GetWeakPtr())) { + blocking_task_runner_->PostTask( + FROM_HERE, base::BindOnce(&BlockingTaskHelper::Start, + base::Unretained(helper_.get()))); +} + +HidConnectionFido::~HidConnectionFido() = default; + +void HidConnectionFido::PlatformClose() { + // By closing the device on the blocking task runner 1) the requirement that + // base::ScopedFD is destroyed on a thread where I/O is allowed is satisfied + // and 2) any tasks posted to this task runner that refer to this file will + // complete before it is closed. + blocking_task_runner_->DeleteSoon(FROM_HERE, helper_.release()); +} + +void HidConnectionFido::PlatformWrite( + scoped_refptr buffer, WriteCallback callback) { + blocking_task_runner_->PostTask( + FROM_HERE, base::BindOnce(&BlockingTaskHelper::Write, + base::Unretained(helper_.get()), buffer, + std::move(callback))); +} + +void HidConnectionFido::PlatformGetFeatureReport(uint8_t report_id, + ReadCallback callback) { + // The first byte of the destination buffer is the report ID being requested + // and is overwritten by the feature report. + DCHECK_GT(device_info()->max_feature_report_size(), 0u); + scoped_refptr buffer( + new base::RefCountedBytes(device_info()->max_feature_report_size() + 1)); + if (report_id != 0) + buffer->data()[0] = report_id; + + blocking_task_runner_->PostTask( + FROM_HERE, base::BindOnce(&BlockingTaskHelper::GetFeatureReport, + base::Unretained(helper_.get()), report_id, + buffer, std::move(callback))); +} + +void HidConnectionFido::PlatformSendFeatureReport( + scoped_refptr buffer, WriteCallback callback) { + base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, + base::BlockingType::MAY_BLOCK); + blocking_task_runner_->PostTask( + FROM_HERE, base::BindOnce(&BlockingTaskHelper::SendFeatureReport, + base::Unretained(helper_.get()), buffer, + std::move(callback))); +} + +} // namespace device diff --git a/www/iridium/files/patch-services_device_hid_hid__connection__freebsd.cc b/www/iridium/files/patch-services_device_hid_hid__connection__freebsd.cc index 8801006fe07d..be16331619fa 100644 --- a/www/iridium/files/patch-services_device_hid_hid__connection__freebsd.cc +++ b/www/iridium/files/patch-services_device_hid_hid__connection__freebsd.cc @@ -1,246 +1,245 @@ ---- services/device/hid/hid_connection_freebsd.cc.orig 2022-03-28 18:11:04 UTC +--- services/device/hid/hid_connection_freebsd.cc.orig 2022-10-05 07:34:01 UTC +++ services/device/hid/hid_connection_freebsd.cc -@@ -0,0 +1,243 @@ +@@ -0,0 +1,242 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/device/hid/hid_connection_freebsd.h" + +#include +#include + +#include "base/bind.h" +#include "base/files/file_descriptor_watcher_posix.h" +#include "base/location.h" +#include "base/numerics/safe_math.h" +#include "base/posix/eintr_wrapper.h" +#include "base/strings/stringprintf.h" -+#include "base/task/post_task.h" +#include "base/task/single_thread_task_runner.h" +#include "base/threading/scoped_blocking_call.h" +#include "base/threading/thread_restrictions.h" +#include "base/threading/thread_task_runner_handle.h" +#include "components/device_event_log/device_event_log.h" +#include "services/device/hid/hid_service.h" + +namespace device { + +class HidConnectionFreeBSD::BlockingTaskRunnerHelper { + public: + BlockingTaskRunnerHelper(base::ScopedFD fd, + scoped_refptr device_info, + base::WeakPtr connection) + : fd_(std::move(fd)), + connection_(connection), + origin_task_runner_(base::ThreadTaskRunnerHandle::Get()) { + DETACH_FROM_SEQUENCE(sequence_checker_); + // Report buffers must always have room for the report ID. + report_buffer_size_ = device_info->max_input_report_size() + 1; + has_report_id_ = device_info->has_report_id(); + } + + BlockingTaskRunnerHelper(const BlockingTaskRunnerHelper&) = delete; + BlockingTaskRunnerHelper& operator=(const BlockingTaskRunnerHelper&) = delete; + + ~BlockingTaskRunnerHelper() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } + + // Starts the FileDescriptorWatcher that reads input events from the device. + // Must be called on a thread that has a base::MessageLoopForIO. + void Start() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + base::internal::AssertBlockingAllowed(); + + file_watcher_ = base::FileDescriptorWatcher::WatchReadable( + fd_.get(), base::BindRepeating(&BlockingTaskRunnerHelper::OnFileCanReadWithoutBlocking, + base::Unretained(this))); + } + + void Write(scoped_refptr buffer, + WriteCallback callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + base::ScopedBlockingCall scoped_blocking_call( + FROM_HERE, base::BlockingType::MAY_BLOCK); + + auto data = buffer->front(); + size_t size = buffer->size(); + // if report id is 0, it shouldn't be included + if (data[0] == 0) { + data++; + size--; + } + + ssize_t result = HANDLE_EINTR(write(fd_.get(), data, size)); + if (result < 0) { + HID_PLOG(EVENT) << "Write failed"; + origin_task_runner_->PostTask(FROM_HERE, base::BindOnce(std::move(callback), false)); + } else { + if (static_cast(result) != size) + HID_LOG(EVENT) << "Incomplete HID write: " << result << " != " << size; + origin_task_runner_->PostTask(FROM_HERE, base::BindOnce(std::move(callback), true)); + } + } + + void GetFeatureReport(uint8_t report_id, + scoped_refptr buffer, + ReadCallback callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + base::ScopedBlockingCall scoped_blocking_call( + FROM_HERE, base::BlockingType::MAY_BLOCK); + struct usb_gen_descriptor ugd; + ugd.ugd_report_type = UHID_FEATURE_REPORT; + ugd.ugd_data = buffer->front(); + ugd.ugd_maxlen = buffer->size(); + int result = HANDLE_EINTR( + ioctl(fd_.get(), USB_GET_REPORT, &ugd)); + if (result < 0) { + HID_PLOG(EVENT) << "Failed to get feature report"; + origin_task_runner_->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), false, nullptr, 0)); + } else if (result == 0) { + HID_LOG(EVENT) << "Get feature result too short."; + origin_task_runner_->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), false, nullptr, 0)); + } else { + origin_task_runner_->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), true, buffer, result)); + } + } + + void SendFeatureReport(scoped_refptr buffer, + WriteCallback callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + struct usb_gen_descriptor ugd; + ugd.ugd_report_type = UHID_FEATURE_REPORT; + ugd.ugd_data = buffer->front(); + ugd.ugd_maxlen = buffer->size(); + // FreeBSD does not require report id if it's not used + if (buffer->front()[0] == 0) { + ugd.ugd_data = buffer->front() + 1; + ugd.ugd_maxlen = buffer->size() - 1; + } else { + ugd.ugd_data = buffer->front(); + ugd.ugd_maxlen = buffer->size(); + } + int result = HANDLE_EINTR( + ioctl(fd_.get(), USB_SET_REPORT, &ugd)); + if (result < 0) { + HID_PLOG(EVENT) << "Failed to send feature report"; + origin_task_runner_->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), false)); + } else { + origin_task_runner_->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), true)); + } + } + + private: + void OnFileCanReadWithoutBlocking() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + scoped_refptr buffer(new base::RefCountedBytes(report_buffer_size_)); + unsigned char* data = buffer->front(); + size_t length = report_buffer_size_; + if (!has_report_id_) { + // FreeBSD will not prefix the buffer with a report ID if report IDs are not + // used by the device. Prefix the buffer with 0. + *data++ = 0; + length--; + } + + ssize_t bytes_read = HANDLE_EINTR(read(fd_.get(), data, length)); + if (bytes_read < 0) { + if (errno != EAGAIN) { + HID_PLOG(EVENT) << "Read failed"; + // This assumes that the error is unrecoverable and disables reading + // from the device until it has been re-opened. + // TODO(reillyg): Investigate starting and stopping the file descriptor + // watcher in response to pending read requests so that per-request + // errors can be returned to the client. + file_watcher_.reset(); + } + return; + } + if (!has_report_id_) { + // Behave as if the byte prefixed above as the the report ID was read. + bytes_read++; + } + + origin_task_runner_->PostTask( + FROM_HERE, base::BindOnce(&HidConnectionFreeBSD::ProcessInputReport, + connection_, buffer, bytes_read)); + } + + SEQUENCE_CHECKER(sequence_checker_); + base::ScopedFD fd_; + size_t report_buffer_size_; + bool has_report_id_; + base::WeakPtr connection_; + const scoped_refptr origin_task_runner_; + std::unique_ptr file_watcher_; +}; + +HidConnectionFreeBSD::HidConnectionFreeBSD( + scoped_refptr device_info, + base::ScopedFD fd, + scoped_refptr blocking_task_runner, + bool allow_protected_reports, + bool allow_fido_reports) + : HidConnection(device_info, allow_protected_reports, allow_fido_reports), + helper_(nullptr, base::OnTaskRunnerDeleter(blocking_task_runner)), + blocking_task_runner_(std::move(blocking_task_runner)) { + helper_.reset(new BlockingTaskRunnerHelper(std::move(fd), device_info, + weak_factory_.GetWeakPtr())); + blocking_task_runner_->PostTask( + FROM_HERE, base::BindOnce(&BlockingTaskRunnerHelper::Start, + base::Unretained(helper_.get()))); +} + +HidConnectionFreeBSD::~HidConnectionFreeBSD() {} + +void HidConnectionFreeBSD::PlatformClose() { + // By closing the device on the blocking task runner 1) the requirement that + // base::ScopedFD is destroyed on a thread where I/O is allowed is satisfied + // and 2) any tasks posted to this task runner that refer to this file will + // complete before it is closed. + blocking_task_runner_->DeleteSoon(FROM_HERE, helper_.release()); +} + +void HidConnectionFreeBSD::PlatformWrite(scoped_refptr buffer, + WriteCallback callback) { + + blocking_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&BlockingTaskRunnerHelper::Write, base::Unretained(helper_.get()), + buffer, std::move(callback))); +} + +void HidConnectionFreeBSD::PlatformGetFeatureReport(uint8_t report_id, + ReadCallback callback) { + // The first byte of the destination buffer is the report ID being requested + // and is overwritten by the feature report. + DCHECK_GT(device_info()->max_feature_report_size(), 0u); + scoped_refptr buffer( + new base::RefCountedBytes(device_info()->max_feature_report_size() + 1)); + if (report_id != 0) + buffer->data()[0] = report_id; + + blocking_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&BlockingTaskRunnerHelper::GetFeatureReport, + base::Unretained(helper_.get()), report_id, + buffer, std::move(callback))); +} + +void HidConnectionFreeBSD::PlatformSendFeatureReport( + scoped_refptr buffer, + WriteCallback callback) { + base::ScopedBlockingCall scoped_blocking_call( + FROM_HERE, base::BlockingType::MAY_BLOCK); + blocking_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&BlockingTaskRunnerHelper::SendFeatureReport, + base::Unretained(helper_.get()), buffer, std::move(callback))); +} + +} // namespace device diff --git a/www/iridium/files/patch-services_device_hid_hid__service.cc b/www/iridium/files/patch-services_device_hid_hid__service.cc index 5764d14b5adc..2ebbeeed6fc1 100644 --- a/www/iridium/files/patch-services_device_hid_hid__service.cc +++ b/www/iridium/files/patch-services_device_hid_hid__service.cc @@ -1,24 +1,24 @@ ---- services/device/hid/hid_service.cc.orig 2022-03-28 18:11:04 UTC +--- services/device/hid/hid_service.cc.orig 2022-10-05 07:34:01 UTC +++ services/device/hid/hid_service.cc -@@ -18,6 +18,10 @@ +@@ -19,6 +19,10 @@ #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(USE_UDEV) #include "services/device/hid/hid_service_linux.h" +#elif BUILDFLAG(IS_OPENBSD) +#include "services/device/hid/hid_service_fido.h" +#elif BUILDFLAG(IS_FREEBSD) +#include "services/device/hid/hid_service_freebsd.h" #elif BUILDFLAG(IS_MAC) #include "services/device/hid/hid_service_mac.h" #elif BUILDFLAG(IS_WIN) -@@ -61,6 +65,10 @@ constexpr base::TaskTraits HidService::kBlockingTaskTr +@@ -62,6 +66,10 @@ constexpr base::TaskTraits HidService::kBlockingTaskTr std::unique_ptr HidService::Create() { #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(USE_UDEV) return base::WrapUnique(new HidServiceLinux()); +#elif BUILDFLAG(IS_OPENBSD) + return base::WrapUnique(new HidServiceFido()); +#elif BUILDFLAG(IS_FREEBSD) + return base::WrapUnique(new HidServiceFreeBSD()); #elif BUILDFLAG(IS_MAC) return base::WrapUnique(new HidServiceMac()); #elif BUILDFLAG(IS_WIN) diff --git a/www/iridium/files/patch-services_device_hid_hid__service__fido.cc b/www/iridium/files/patch-services_device_hid_hid__service__fido.cc index c2bc53d40a8b..b283d736f9f7 100644 --- a/www/iridium/files/patch-services_device_hid_hid__service__fido.cc +++ b/www/iridium/files/patch-services_device_hid_hid__service__fido.cc @@ -1,331 +1,330 @@ ---- services/device/hid/hid_service_fido.cc.orig 2022-03-28 18:11:04 UTC +--- services/device/hid/hid_service_fido.cc.orig 2022-10-05 07:34:01 UTC +++ services/device/hid/hid_service_fido.cc -@@ -0,0 +1,328 @@ +@@ -0,0 +1,327 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/device/hid/hid_service_fido.h" + +#include +#include +#include +#include +#include +#include + +// TODO: remove once the missing guard in fido.h is fixed upstream. +extern "C" { +#include +} + +#include +#include +#include + +#include "base/bind.h" +#include "base/files/file.h" +#include "base/files/file_descriptor_watcher_posix.h" +#include "base/files/file_enumerator.h" +#include "base/location.h" +#include "base/logging.h" +#include "base/posix/eintr_wrapper.h" +#include "base/task/single_thread_task_runner.h" +#include "base/task/thread_pool.h" +#include "base/stl_util.h" +#include "base/strings/pattern.h" +#include "base/strings/string_split.h" +#include "base/strings/string_util.h" +#include "base/strings/stringprintf.h" +#include "base/strings/sys_string_conversions.h" -+#include "base/task/post_task.h" +#include "base/threading/scoped_blocking_call.h" +#include "base/threading/thread_task_runner_handle.h" +#include "components/device_event_log/device_event_log.h" +#include "services/device/hid/hid_connection_fido.h" + +namespace device { + +namespace { + +struct ConnectParams { + ConnectParams(scoped_refptr device_info, + HidService::ConnectCallback callback) + : device_info(std::move(device_info)), callback(std::move(callback)), + task_runner(base::ThreadTaskRunnerHandle::Get()), + blocking_task_runner(base::ThreadPool::CreateSequencedTaskRunner( + HidService::kBlockingTaskTraits)) {} + ~ConnectParams() {} + + scoped_refptr device_info; + HidService::ConnectCallback callback; + scoped_refptr task_runner; + scoped_refptr blocking_task_runner; + base::ScopedFD fd; + bool allow_protected_reports; + bool allow_fido_reports; +}; + +void CreateConnection(std::unique_ptr params) { + DCHECK(params->fd.is_valid()); + std::move(params->callback).Run(base::MakeRefCounted( + std::move(params->device_info), std::move(params->fd), + std::move(params->blocking_task_runner), params->allow_protected_reports, + params->allow_fido_reports)); +} + +void FinishOpen(std::unique_ptr params) { + scoped_refptr task_runner = params->task_runner; + + task_runner->PostTask(FROM_HERE, + base::BindOnce(&CreateConnection, std::move(params))); +} + +bool terrible_ping_kludge(int fd, const std::string &path) { + u_char data[256]; + int i, n; + struct pollfd pfd; + + for (i = 0; i < 4; i++) { + memset(data, 0, sizeof(data)); + /* broadcast channel ID */ + data[1] = 0xff; + data[2] = 0xff; + data[3] = 0xff; + data[4] = 0xff; + /* Ping command */ + data[5] = 0x81; + /* One byte ping only, Vasili */ + data[6] = 0; + data[7] = 1; + HID_LOG(EVENT) << "send ping " << i << " " << path; + if (write(fd, data, 64) == -1) { + HID_PLOG(ERROR) << "write " << path; + return false; + } + HID_LOG(EVENT) << "wait reply " << path; + memset(&pfd, 0, sizeof(pfd)); + pfd.fd = fd; + pfd.events = POLLIN; + if ((n = poll(&pfd, 1, 100)) == -1) { + HID_PLOG(EVENT) << "poll " << path; + return false; + } else if (n == 0) { + HID_LOG(EVENT) << "timed out " << path; + continue; + } + if (read(fd, data, 64) == -1) { + HID_PLOG(ERROR) << "read " << path; + return false; + } + /* + * Ping isn't always supported on the broadcast channel, + * so we might get an error, but we don't care - we're + * synched now. + */ + HID_LOG(EVENT) << "got reply " << path; + return true; + } + HID_LOG(ERROR) << "no response " << path; + return false; +} + +void OpenOnBlockingThread(std::unique_ptr params) { + base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, + base::BlockingType::MAY_BLOCK); + scoped_refptr task_runner = params->task_runner; + + const auto &device_node = params->device_info->device_node(); + base::FilePath device_path(device_node); + int flags = + base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE; + base::File device_file(device_path, flags); + if (!device_file.IsValid()) { + HID_LOG(EVENT) << "Failed to open '" << device_node << "': " + << base::File::ErrorToString(device_file.error_details()); + task_runner->PostTask(FROM_HERE, base::BindOnce(std::move(params->callback), nullptr)); + return; + } + if (!terrible_ping_kludge(device_file.GetPlatformFile(), device_node)) { + HID_LOG(EVENT) << "Failed to ping " << device_node; + task_runner->PostTask(FROM_HERE, base::BindOnce(std::move(params->callback), nullptr)); + return; + } + params->fd.reset(device_file.TakePlatformFile()); + FinishOpen(std::move(params)); +} + +// HID report descriptor for U2F interface. Copied from: +// https://chromium.googlesource.com/chromiumos/platform2/+/c6c7e4e54fce11932fedaa3ea10236bf75d85a2b%5E%21/u2fd/u2fhid.cc +// Apparently Chromium wants to see these bytes, but OpenBSD fido(4) +// devices prohibit USB_GET_REPORT_DESC ioctl that could be used to +// get the bytes from the USB device. +constexpr uint8_t kU2fReportDesc[] = { + 0x06, 0xD0, 0xF1, /* Usage Page (FIDO Alliance), FIDO_USAGE_PAGE */ + 0x09, 0x01, /* Usage (U2F HID Auth. Device) FIDO_USAGE_U2FHID */ + 0xA1, 0x01, /* Collection (Application), HID_APPLICATION */ + 0x09, 0x20, /* Usage (Input Report Data), FIDO_USAGE_DATA_IN */ + 0x15, 0x00, /* Logical Minimum (0) */ + 0x26, 0xFF, 0x00, /* Logical Maximum (255) */ + 0x75, 0x08, /* Report Size (8) */ + 0x95, 0x40, /* Report Count (64), HID_INPUT_REPORT_BYTES */ + 0x81, 0x02, /* Input (Data, Var, Abs), Usage */ + 0x09, 0x21, /* Usage (Output Report Data), FIDO_USAGE_DATA_OUT */ + 0x15, 0x00, /* Logical Minimum (0) */ + 0x26, 0xFF, 0x00, /* Logical Maximum (255) */ + 0x75, 0x08, /* Report Size (8) */ + 0x95, 0x40, /* Report Count (64), HID_OUTPUT_REPORT_BYTES */ + 0x91, 0x02, /* Output (Data, Var, Abs), Usage */ + 0xC0 /* End Collection */ +}; + +} // namespace + +class HidServiceFido::BlockingTaskHelper { +public: + BlockingTaskHelper(base::WeakPtr service) + : service_(std::move(service)), + task_runner_(base::ThreadTaskRunnerHandle::Get()) { + DETACH_FROM_SEQUENCE(sequence_checker_); + } + + BlockingTaskHelper(const BlockingTaskHelper&) = delete; + BlockingTaskHelper& operator=(const BlockingTaskHelper&) = delete; + + ~BlockingTaskHelper() = default; + + void Start() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + base::ScopedBlockingCall scoped_blocking_call( + FROM_HERE, base::BlockingType::MAY_BLOCK); + + fido_dev_info_t *devlist = NULL; + fido_dev_t *dev = NULL; + size_t devlist_len = 0, i; + const char *path; + int r; + const int MAX_FIDO_DEVICES = 256; + + if ((devlist = fido_dev_info_new(MAX_FIDO_DEVICES)) == NULL) { + HID_LOG(ERROR) << "fido_dev_info_new failed"; + goto out; + } + if ((r = fido_dev_info_manifest(devlist, MAX_FIDO_DEVICES, &devlist_len)) != + FIDO_OK) { + HID_LOG(ERROR) << "fido_dev_info_manifest: " << fido_strerr(r); + goto out; + } + + HID_LOG(EVENT) << "fido_dev_info_manifest found " << devlist_len + << " device(s)"; + + for (i = 0; i < devlist_len; i++) { + const fido_dev_info_t *di = fido_dev_info_ptr(devlist, i); + if (di == NULL) { + HID_LOG(ERROR) << "fido_dev_info_ptr " << i << " failed"; + continue; + } + if ((path = fido_dev_info_path(di)) == NULL) { + HID_LOG(ERROR) << "fido_dev_info_path " << i << " failed"; + continue; + } + HID_LOG(EVENT) << "trying device " << i << ": " << path; + if ((dev = fido_dev_new()) == NULL) { + HID_LOG(ERROR) << "fido_dev_new failed"; + continue; + } + if ((r = fido_dev_open(dev, path)) != FIDO_OK) { + HID_LOG(ERROR) << "fido_dev_open failed " << path; + fido_dev_free(&dev); + continue; + } + OnDeviceAdded(di); + fido_dev_close(dev); + fido_dev_free(&dev); + } + + out: + if (devlist != NULL) + fido_dev_info_free(&devlist, MAX_FIDO_DEVICES); + + task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&HidServiceFido::FirstEnumerationComplete, service_)); + } + + void OnDeviceAdded(const fido_dev_info_t *di) { + auto null_as_empty = [](const char *r) -> std::string { + return (r != nullptr) ? r : ""; + }; + std::string device_node(null_as_empty(fido_dev_info_path(di))); + std::vector report_descriptor( + kU2fReportDesc, kU2fReportDesc + sizeof(kU2fReportDesc)); + scoped_refptr device_info(new HidDeviceInfo( + device_node, /*physical_device_id=*/"", fido_dev_info_vendor(di), + fido_dev_info_product(di), null_as_empty(fido_dev_info_product_string(di)), + null_as_empty(fido_dev_info_manufacturer_string(di)), + device::mojom::HidBusType::kHIDBusTypeUSB, report_descriptor, + device_node)); + + task_runner_->PostTask(FROM_HERE, base::BindOnce(&HidServiceFido::AddDevice, + service_, device_info)); + } + + void OnDeviceRemoved(std::string device_node) { + base::ScopedBlockingCall scoped_blocking_call( + FROM_HERE, base::BlockingType::MAY_BLOCK); + task_runner_->PostTask(FROM_HERE, base::BindOnce(&HidServiceFido::RemoveDevice, + service_, device_node)); + } + +private: + SEQUENCE_CHECKER(sequence_checker_); + + // This weak pointer is only valid when checked on this task runner. + base::WeakPtr service_; + scoped_refptr task_runner_; +}; + +HidServiceFido::HidServiceFido() + : task_runner_(base::ThreadTaskRunnerHandle::Get()), + blocking_task_runner_( + base::ThreadPool::CreateSequencedTaskRunner(kBlockingTaskTraits)), + weak_factory_(this), helper_(std::make_unique( + weak_factory_.GetWeakPtr())) { + blocking_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&BlockingTaskHelper::Start, base::Unretained(helper_.get()))); +} + +HidServiceFido::~HidServiceFido() { + blocking_task_runner_->DeleteSoon(FROM_HERE, helper_.release()); +} + +base::WeakPtr HidServiceFido::GetWeakPtr() { + return weak_factory_.GetWeakPtr(); +} + +void HidServiceFido::Connect(const std::string &device_guid, + bool allow_protected_reports, + bool allow_fido_reports, + ConnectCallback callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + const auto &map_entry = devices().find(device_guid); + if (map_entry == devices().end()) { + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), nullptr)); + return; + } + + scoped_refptr device_info = map_entry->second; + + auto params = std::make_unique(device_info, std::move(callback)); + + scoped_refptr blocking_task_runner = + params->blocking_task_runner; + blocking_task_runner->PostTask( + FROM_HERE, base::BindOnce(&OpenOnBlockingThread, std::move(params))); +} + +} // namespace device diff --git a/www/iridium/files/patch-services_device_hid_hid__service__freebsd.cc b/www/iridium/files/patch-services_device_hid_hid__service__freebsd.cc index 622a7530317b..01a91421f240 100644 --- a/www/iridium/files/patch-services_device_hid_hid__service__freebsd.cc +++ b/www/iridium/files/patch-services_device_hid_hid__service__freebsd.cc @@ -1,401 +1,400 @@ ---- services/device/hid/hid_service_freebsd.cc.orig 2022-03-28 18:11:04 UTC +--- services/device/hid/hid_service_freebsd.cc.orig 2022-10-05 07:34:01 UTC +++ services/device/hid/hid_service_freebsd.cc -@@ -0,0 +1,398 @@ +@@ -0,0 +1,397 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/device/hid/hid_service_freebsd.h" + +#include +#include +#include +#include + +#include +#include +#include + +#include "base/bind.h" +#include "base/files/file_descriptor_watcher_posix.h" +#include "base/files/file_enumerator.h" +#include "base/files/file_util.h" +#include "base/files/file.h" +#include "base/location.h" +#include "base/logging.h" +#include "base/posix/eintr_wrapper.h" +#include "base/stl_util.h" +#include "base/strings/pattern.h" +#include "base/strings/stringprintf.h" +#include "base/strings/sys_string_conversions.h" +#include "base/strings/string_util.h" +#include "base/strings/string_split.h" -+#include "base/task/post_task.h" +#include "base/task/single_thread_task_runner.h" +#include "base/task/thread_pool.h" +#include "base/threading/scoped_blocking_call.h" +#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/thread_restrictions.h" +#include "components/device_event_log/device_event_log.h" +#include "services/device/hid/hid_connection_freebsd.h" + +const int kMaxPermissionChecks = 5; + +namespace device { + +struct HidServiceFreeBSD::ConnectParams { + ConnectParams(scoped_refptr device_info, + bool allow_protected_reports, + bool allow_fido_reports, + ConnectCallback callback) + : device_info(std::move(device_info)), + allow_protected_reports(allow_protected_reports), + allow_fido_reports(allow_fido_reports), + callback(std::move(callback)), + task_runner(base::ThreadTaskRunnerHandle::Get()), + blocking_task_runner( + base::ThreadPool::CreateSequencedTaskRunner(kBlockingTaskTraits)) {} + ~ConnectParams() {} + + scoped_refptr device_info; + bool allow_protected_reports; + bool allow_fido_reports; + ConnectCallback callback; + scoped_refptr task_runner; + scoped_refptr blocking_task_runner; + base::ScopedFD fd; +}; + +class HidServiceFreeBSD::BlockingTaskRunnerHelper { + public: + BlockingTaskRunnerHelper(base::WeakPtr service) + : service_(std::move(service)), + task_runner_(base::ThreadTaskRunnerHandle::Get()) { + DETACH_FROM_SEQUENCE(sequence_checker_); + + timer_.reset(new base::RepeatingTimer()); + devd_buffer_ = new net::IOBufferWithSize(1024); + } + + BlockingTaskRunnerHelper(const BlockingTaskRunnerHelper&) = delete; + BlockingTaskRunnerHelper& operator=(const BlockingTaskRunnerHelper&) = delete; + + ~BlockingTaskRunnerHelper() { + } + + void Start() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + const base::FilePath kDevRoot("/dev"); + const std::string kUHIDPattern("/dev/uhid*"); + + base::FileEnumerator enumerator(kDevRoot, false, base::FileEnumerator::FILES); + do { + const base::FilePath next_device_path(enumerator.Next()); + const std::string next_device = next_device_path.value(); + if (next_device.empty()) + break; + + if (base::MatchPattern(next_device, kUHIDPattern)) + OnDeviceAdded(next_device.substr(5)); + } while (true); + + SetupDevdMonitor(); + + task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&HidServiceFreeBSD::FirstEnumerationComplete, service_)); + } + + bool HaveReadWritePermissions(std::string device_id) { + std::string device_node = "/dev/" + device_id; + base::internal::AssertBlockingAllowed(); + + base::FilePath device_path(device_node); + base::File device_file; + int flags = + base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE; + device_file.Initialize(device_path, flags); + if (!device_file.IsValid()) + return false; + + return true; + } + + void OnDeviceAdded(std::string device_id) { + base::ScopedBlockingCall scoped_blocking_call( + FROM_HERE, base::BlockingType::MAY_BLOCK); + std::string device_node = "/dev/" + device_id; + uint16_t vendor_id = 0xffff; + uint16_t product_id = 0xffff; + std::string product_name = ""; + std::string serial_number = ""; + + std::vector report_descriptor; + + base::internal::AssertBlockingAllowed(); + + base::FilePath device_path(device_node); + base::File device_file; + int flags = + base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE; + device_file.Initialize(device_path, flags); + if (!device_file.IsValid()) { + HID_LOG(ERROR) << "Failed to open '" << device_node + << "': " + << base::File::ErrorToString(device_file.error_details()); + return; + } + + base::ScopedFD fd; + fd.reset(device_file.TakePlatformFile()); + + struct usb_gen_descriptor ugd; + ugd.ugd_data = NULL; + ugd.ugd_maxlen = 0xffff; + int result = HANDLE_EINTR( + ioctl(fd.get(), USB_GET_REPORT_DESC, &ugd)); + + if (result < 0) { + HID_LOG(ERROR) << "Failed to get report descriptor size"; + return; + } + + report_descriptor.resize(ugd.ugd_actlen); + + ugd.ugd_data = report_descriptor.data(); + ugd.ugd_maxlen = ugd.ugd_actlen; + result = HANDLE_EINTR( + ioctl(fd.get(), USB_GET_REPORT_DESC, &ugd)); + + if (result < 0) { + HID_LOG(ERROR) << "Failed to get report descriptor"; + return; + } + + scoped_refptr device_info(new HidDeviceInfo( + device_id, + /*physical_device_id*/"", + vendor_id, + product_id, + product_name, + serial_number, + device::mojom::HidBusType::kHIDBusTypeUSB, + report_descriptor, + device_node)); + + task_runner_->PostTask(FROM_HERE, base::BindOnce(&HidServiceFreeBSD::AddDevice, + service_, device_info)); + } + + void OnDeviceRemoved(std::string device_id) { + base::ScopedBlockingCall scoped_blocking_call( + FROM_HERE, base::BlockingType::MAY_BLOCK); + task_runner_->PostTask( + FROM_HERE, base::BindOnce(&HidServiceFreeBSD::RemoveDevice, service_, + device_id)); + } + + private: + + void CheckPendingPermissionChange() { + base::internal::AssertBlockingAllowed(); + std::map::iterator it; + for (it = permissions_checks_attempts_.begin(); it != permissions_checks_attempts_.end();) { + std::string device_name = it->first; + bool keep = true; + if (HaveReadWritePermissions(device_name)) { + OnDeviceAdded(device_name); + keep = false; + } + else if (it->second-- <= 0) { + HID_LOG(ERROR) << "Still don't have write permissions to '" << device_name + << "' after " << kMaxPermissionChecks << " attempts"; + keep = false; + } + + if (keep) + ++it; + else + permissions_checks_attempts_.erase(it++); + } + + if (permissions_checks_attempts_.empty()) + timer_->Stop(); + } + + void SetupDevdMonitor() { + base::internal::AssertBlockingAllowed(); + + int devd_fd = socket(AF_UNIX, SOCK_SEQPACKET, 0); + if (devd_fd < 0) + return; + + struct sockaddr_un sa; + + sa.sun_family = AF_UNIX; + strlcpy(sa.sun_path, "/var/run/devd.seqpacket.pipe", sizeof(sa.sun_path)); + if (connect(devd_fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) { + close(devd_fd); + return; + } + + devd_fd_.reset(devd_fd); + file_watcher_ = base::FileDescriptorWatcher::WatchReadable( + devd_fd_.get(), base::BindRepeating(&BlockingTaskRunnerHelper::OnDevdMessageCanBeRead, + base::Unretained(this))); + } + + void OnDevdMessageCanBeRead() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + ssize_t bytes_read = HANDLE_EINTR(recv(devd_fd_.get(), devd_buffer_->data(), + devd_buffer_->size() - 1, MSG_WAITALL)); + if (bytes_read < 0) { + if (errno != EAGAIN) { + HID_LOG(ERROR) << "Read failed"; + file_watcher_.reset(); + } + return; + } + + devd_buffer_->data()[bytes_read] = 0; + char *data = devd_buffer_->data(); + // It may take some time for devd to change permissions + // on /dev/uhidX node. So do not fail immediately if + // open fail. Retry each second for kMaxPermissionChecks + // times before giving up entirely + if (base::StartsWith(data, "+uhid", base::CompareCase::SENSITIVE)) { + std::vector parts = base::SplitString( + data, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + if (!parts.empty()) { + std::string device_name = parts[0].substr(1); // skip '+' + if (HaveReadWritePermissions(device_name)) + OnDeviceAdded(parts[0].substr(1)); + else { + // Do not re-add to checks + if (permissions_checks_attempts_.find(device_name) == permissions_checks_attempts_.end()) { + permissions_checks_attempts_.insert(std::pair(device_name, kMaxPermissionChecks)); + timer_->Start(FROM_HERE, base::Seconds(1), + this, &BlockingTaskRunnerHelper::CheckPendingPermissionChange); + } + } + } + } + + if (base::StartsWith(data, "-uhid", base::CompareCase::SENSITIVE)) { + std::vector parts = base::SplitString( + data, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + if (!parts.empty()) { + std::string device_name = parts[0].substr(1); // skip '-' + auto it = permissions_checks_attempts_.find(device_name); + if (it != permissions_checks_attempts_.end()) { + permissions_checks_attempts_.erase(it); + if (permissions_checks_attempts_.empty()) + timer_->Stop(); + } + OnDeviceRemoved(parts[0].substr(1)); + } + } + } + + SEQUENCE_CHECKER(sequence_checker_); + + // This weak pointer is only valid when checked on this task runner. + base::WeakPtr service_; + scoped_refptr task_runner_; + std::unique_ptr file_watcher_; + std::unique_ptr timer_; + base::ScopedFD devd_fd_; + scoped_refptr devd_buffer_; + std::map permissions_checks_attempts_; +}; + +HidServiceFreeBSD::HidServiceFreeBSD() + : blocking_task_runner_( + base::ThreadPool::CreateSequencedTaskRunner(kBlockingTaskTraits)), + helper_(nullptr, base::OnTaskRunnerDeleter(blocking_task_runner_)) { + helper_.reset(new BlockingTaskRunnerHelper(weak_factory_.GetWeakPtr())); + blocking_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&BlockingTaskRunnerHelper::Start, base::Unretained(helper_.get()))); +} + +HidServiceFreeBSD::~HidServiceFreeBSD() { + blocking_task_runner_->DeleteSoon(FROM_HERE, helper_.release()); +} + +base::WeakPtr HidServiceFreeBSD::GetWeakPtr() { + return weak_factory_.GetWeakPtr(); +} + +// static +void HidServiceFreeBSD::OpenOnBlockingThread( + std::unique_ptr params) { + base::ScopedBlockingCall scoped_blocking_call( + FROM_HERE, base::BlockingType::MAY_BLOCK); + scoped_refptr task_runner = params->task_runner; + + base::FilePath device_path(params->device_info->device_node()); + base::File device_file; + int flags = + base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE; + device_file.Initialize(device_path, flags); + if (!device_file.IsValid()) { + HID_LOG(EVENT) << "Failed to open '" << params->device_info->device_node() + << "': " + << base::File::ErrorToString(device_file.error_details()); + task_runner->PostTask(FROM_HERE, + base::BindOnce(std::move(params->callback), nullptr)); + return; + } + params->fd.reset(device_file.TakePlatformFile()); + task_runner->PostTask(FROM_HERE, base::BindOnce(&HidServiceFreeBSD::FinishOpen, + std::move(params))); +} + +void HidServiceFreeBSD::Connect(const std::string& device_guid, + bool allow_protected_reports, + bool allow_fido_reports, + ConnectCallback callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + const auto& map_entry = devices().find(device_guid); + if (map_entry == devices().end()) { + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), nullptr)); + return; + } + + scoped_refptr device_info = map_entry->second; + + auto params = std::make_unique(device_info, + allow_protected_reports, + allow_fido_reports, + std::move(callback)); + scoped_refptr blocking_task_runner = + params->blocking_task_runner; + + blocking_task_runner->PostTask( + FROM_HERE, base::BindOnce(&HidServiceFreeBSD::OpenOnBlockingThread, + std::move(params))); +} + +// static +void HidServiceFreeBSD::FinishOpen(std::unique_ptr params) { + DCHECK(params->fd.is_valid()); + + if (!base::SetNonBlocking(params->fd.get())) { + HID_PLOG(ERROR) << "Failed to set the non-blocking flag on the device fd"; + std::move(params->callback).Run(nullptr); + } + + std::move(params->callback).Run(base::MakeRefCounted( + std::move(params->device_info), + std::move(params->fd), + std::move(params->blocking_task_runner), + params->allow_protected_reports, + params->allow_fido_reports + )); +} + +} // namespace device diff --git a/www/iridium/files/patch-services_device_serial_serial__device__enumerator.cc b/www/iridium/files/patch-services_device_serial_serial__device__enumerator.cc index 7e213ec3ac39..e5549e4e190d 100644 --- a/www/iridium/files/patch-services_device_serial_serial__device__enumerator.cc +++ b/www/iridium/files/patch-services_device_serial_serial__device__enumerator.cc @@ -1,20 +1,20 @@ ---- services/device/serial/serial_device_enumerator.cc.orig 2022-03-28 18:11:04 UTC +--- services/device/serial/serial_device_enumerator.cc.orig 2022-10-05 07:34:01 UTC +++ services/device/serial/serial_device_enumerator.cc -@@ -10,7 +10,7 @@ +@@ -11,7 +11,7 @@ #include "build/build_config.h" #include "components/device_event_log/device_event_log.h" -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "services/device/serial/serial_device_enumerator_linux.h" #elif BUILDFLAG(IS_MAC) #include "services/device/serial/serial_device_enumerator_mac.h" -@@ -23,7 +23,7 @@ namespace device { +@@ -24,7 +24,7 @@ namespace device { // static std::unique_ptr SerialDeviceEnumerator::Create( scoped_refptr ui_task_runner) { -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) return SerialDeviceEnumeratorLinux::Create(); #elif BUILDFLAG(IS_MAC) return std::make_unique(); diff --git a/www/iridium/files/patch-services_device_serial_serial__io__handler__posix.cc b/www/iridium/files/patch-services_device_serial_serial__io__handler__posix.cc index 136bd7c22aac..b25f549c0a5a 100644 --- a/www/iridium/files/patch-services_device_serial_serial__io__handler__posix.cc +++ b/www/iridium/files/patch-services_device_serial_serial__io__handler__posix.cc @@ -1,11 +1,11 @@ ---- services/device/serial/serial_io_handler_posix.cc.orig 2022-03-28 18:11:04 UTC +--- services/device/serial/serial_io_handler_posix.cc.orig 2022-10-05 07:34:01 UTC +++ services/device/serial/serial_io_handler_posix.cc -@@ -68,7 +68,7 @@ bool BitrateToSpeedConstant(int bitrate, speed_t* spee +@@ -67,7 +67,7 @@ bool BitrateToSpeedConstant(int bitrate, speed_t* spee BITRATE_TO_SPEED_CASE(9600) BITRATE_TO_SPEED_CASE(19200) BITRATE_TO_SPEED_CASE(38400) -#if !BUILDFLAG(IS_MAC) +#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD) BITRATE_TO_SPEED_CASE(57600) BITRATE_TO_SPEED_CASE(115200) BITRATE_TO_SPEED_CASE(230400) diff --git a/www/iridium/files/patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc b/www/iridium/files/patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc index bf5faf4dca15..8b8754800964 100644 --- a/www/iridium/files/patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc +++ b/www/iridium/files/patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc @@ -1,14 +1,14 @@ ---- services/device/time_zone_monitor/time_zone_monitor_linux.cc.orig 2022-03-28 18:11:04 UTC +--- services/device/time_zone_monitor/time_zone_monitor_linux.cc.orig 2022-10-05 07:34:01 UTC +++ services/device/time_zone_monitor/time_zone_monitor_linux.cc @@ -137,7 +137,11 @@ class TimeZoneMonitorLinuxImpl // false positives are harmless, assuming the false positive rate is // reasonable. const char* const kFilesToWatch[] = { +#if defined(OS_BSD) + "/etc/localtime", +#else "/etc/localtime", "/etc/timezone", "/etc/TZ", +#endif }; - for (size_t index = 0; index < base::size(kFilesToWatch); ++index) { + for (size_t index = 0; index < std::size(kFilesToWatch); ++index) { file_path_watchers_.push_back(std::make_unique()); diff --git a/www/iridium/files/patch-services_network_BUILD.gn b/www/iridium/files/patch-services_network_BUILD.gn index 4d9222bebbbc..da51f3b6ce15 100644 --- a/www/iridium/files/patch-services_network_BUILD.gn +++ b/www/iridium/files/patch-services_network_BUILD.gn @@ -1,10 +1,10 @@ ---- services/network/BUILD.gn.orig 2022-03-28 18:11:04 UTC +--- services/network/BUILD.gn.orig 2022-10-05 07:34:01 UTC +++ services/network/BUILD.gn -@@ -323,7 +323,6 @@ if (is_linux || is_chromeos) { +@@ -322,7 +322,6 @@ if (is_linux || is_chromeos) { ] deps = [ "//base:base", - "//sandbox/linux:sandbox_services", "//sandbox/policy:policy", ] } diff --git a/www/iridium/files/patch-services_network_network__service.cc b/www/iridium/files/patch-services_network_network__service.cc index a75979cdb728..fe688ced04ff 100644 --- a/www/iridium/files/patch-services_network_network__service.cc +++ b/www/iridium/files/patch-services_network_network__service.cc @@ -1,11 +1,11 @@ ---- services/network/network_service.cc.orig 2022-04-01 07:48:30 UTC +--- services/network/network_service.cc.orig 2022-10-05 07:34:01 UTC +++ services/network/network_service.cc -@@ -82,7 +82,7 @@ +@@ -83,7 +83,7 @@ #include "third_party/boringssl/src/include/openssl/cpu.h" #endif --#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \ -+#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)) && \ - !BUILDFLAG(IS_CHROMECAST) +-#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || \ ++#if ((BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || BUILDFLAG(IS_BSD)) || \ + BUILDFLAG(IS_CHROMEOS_LACROS) + #include "components/os_crypt/key_storage_config_linux.h" - #endif diff --git a/www/iridium/files/patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc b/www/iridium/files/patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc index 4773b6813edb..03b05ec02ba0 100644 --- a/www/iridium/files/patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc +++ b/www/iridium/files/patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc @@ -1,65 +1,65 @@ ---- services/resource_coordinator/memory_instrumentation/queued_request_dispatcher.cc.orig 2022-03-28 18:11:04 UTC +--- services/resource_coordinator/memory_instrumentation/queued_request_dispatcher.cc.orig 2022-10-05 07:34:01 UTC +++ services/resource_coordinator/memory_instrumentation/queued_request_dispatcher.cc @@ -52,7 +52,7 @@ uint32_t CalculatePrivateFootprintKb(const mojom::RawO uint32_t shared_resident_kb) { DCHECK(os_dump.platform_private_footprint); #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ - BUILDFLAG(IS_FUCHSIA) + BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) uint64_t rss_anon_bytes = os_dump.platform_private_footprint->rss_anon_bytes; uint64_t vm_swap_bytes = os_dump.platform_private_footprint->vm_swap_bytes; return (rss_anon_bytes + vm_swap_bytes) / 1024; -@@ -91,7 +91,7 @@ memory_instrumentation::mojom::OSMemDumpPtr CreatePubl +@@ -80,7 +80,7 @@ memory_instrumentation::mojom::OSMemDumpPtr CreatePubl os_dump->is_peak_rss_resettable = internal_os_dump.is_peak_rss_resettable; os_dump->private_footprint_kb = CalculatePrivateFootprintKb(internal_os_dump, shared_resident_kb); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD) os_dump->private_footprint_swap_kb = internal_os_dump.platform_private_footprint->vm_swap_bytes / 1024; #endif -@@ -270,7 +270,7 @@ void QueuedRequestDispatcher::SetUpAndDispatch( +@@ -259,7 +259,7 @@ void QueuedRequestDispatcher::SetUpAndDispatch( // On most platforms each process can dump data about their own process // so ask each process to do so Linux is special see below. -#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) +#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD) request->pending_responses.insert({client_info.pid, ResponseType::kOSDump}); client->RequestOSMemoryDump(request->memory_map_option(), {base::kNullProcessId}, -@@ -285,7 +285,7 @@ void QueuedRequestDispatcher::SetUpAndDispatch( +@@ -274,7 +274,7 @@ void QueuedRequestDispatcher::SetUpAndDispatch( // In some cases, OS stats can only be dumped from a privileged process to // get around to sandboxing/selinux restrictions (see crbug.com/461788). -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) std::vector pids; mojom::ClientProcess* browser_client = nullptr; base::ProcessId browser_client_pid = base::kNullProcessId; -@@ -331,7 +331,7 @@ void QueuedRequestDispatcher::SetUpAndDispatchVmRegion +@@ -320,7 +320,7 @@ void QueuedRequestDispatcher::SetUpAndDispatchVmRegion const OsCallback& os_callback) { // On Linux, OS stats can only be dumped from a privileged process to // get around to sandboxing/selinux restrictions (see crbug.com/461788). -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) mojom::ClientProcess* browser_client = nullptr; base::ProcessId browser_client_pid = 0; for (const auto& client_info : clients) { -@@ -382,7 +382,7 @@ QueuedRequestDispatcher::FinalizeVmRegionRequest( +@@ -371,7 +371,7 @@ QueuedRequestDispatcher::FinalizeVmRegionRequest( // each client process provides 1 OS dump, % the case where the client is // disconnected mid dump. OSMemDumpMap& extra_os_dumps = response.second.os_dumps; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) for (auto& kv : extra_os_dumps) { auto pid = kv.first == base::kNullProcessId ? original_pid : kv.first; DCHECK(results.find(pid) == results.end()); -@@ -444,7 +444,7 @@ void QueuedRequestDispatcher::Finalize(QueuedRequest* +@@ -433,7 +433,7 @@ void QueuedRequestDispatcher::Finalize(QueuedRequest* // crash). In the latter case (OS_LINUX) we expect the full map to come // from the browser process response. OSMemDumpMap& extra_os_dumps = response.second.os_dumps; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) for (const auto& kv : extra_os_dumps) { auto pid = kv.first == base::kNullProcessId ? original_pid : kv.first; DCHECK_EQ(pid_to_os_dump[pid], nullptr); diff --git a/www/iridium/files/patch-services_tracing_public_cpp_perfetto_perfetto__config.cc b/www/iridium/files/patch-services_tracing_public_cpp_perfetto_perfetto__config.cc deleted file mode 100644 index 831e91c6b218..000000000000 --- a/www/iridium/files/patch-services_tracing_public_cpp_perfetto_perfetto__config.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- services/tracing/public/cpp/perfetto/perfetto_config.cc.orig 2022-03-28 18:11:04 UTC -+++ services/tracing/public/cpp/perfetto/perfetto_config.cc -@@ -124,7 +124,7 @@ void AddDataSourceConfigs( - // TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is - // complete. - #if BUILDFLAG(IS_CHROMEOS_ASH) || \ -- (BUILDFLAG(IS_CHROMECAST) && BUILDFLAG(IS_LINUX)) -+ (BUILDFLAG(IS_CHROMECAST) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))) - if (source_names.empty() || - source_names.count(tracing::mojom::kSystemTraceDataSourceName) == 1) { - AddDataSourceConfig( diff --git a/www/iridium/files/patch-services_video__capture_broadcasting__receiver.cc b/www/iridium/files/patch-services_video__capture_broadcasting__receiver.cc index 96499a9588f1..6fd8dd62b516 100644 --- a/www/iridium/files/patch-services_video__capture_broadcasting__receiver.cc +++ b/www/iridium/files/patch-services_video__capture_broadcasting__receiver.cc @@ -1,20 +1,11 @@ ---- services/video_capture/broadcasting_receiver.cc.orig 2022-03-28 18:11:04 UTC +--- services/video_capture/broadcasting_receiver.cc.orig 2022-10-05 07:34:01 UTC +++ services/video_capture/broadcasting_receiver.cc -@@ -28,7 +28,7 @@ void CloneSharedBufferHandle(const mojo::ScopedSharedB - void CloneSharedBufferToRawFileDescriptorHandle( - const mojo::ScopedSharedBufferHandle& source, - media::mojom::VideoBufferHandlePtr* target) { --#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) -+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) - // |source| is unwrapped to a |PlatformSharedMemoryRegion|, from whence a file - // descriptor can be extracted which is then mojo-wrapped. - base::subtle::PlatformSharedMemoryRegion platform_region = -@@ -240,7 +240,7 @@ void BroadcastingReceiver::BufferContext:: - ConvertRawFileDescriptorToSharedBuffer() { +@@ -234,7 +234,7 @@ void BroadcastingReceiver::BufferContext:: + ConvertRawFileDescriptorToUnsafeShmemRegion() { DCHECK(buffer_handle_->is_shared_memory_via_raw_file_descriptor()); -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) - // The conversion unwraps the descriptor from its mojo handle to the raw file - // descriptor (ie, an int). This is used to create a - // PlatformSharedMemoryRegion which is then wrapped as a + const size_t handle_size = + buffer_handle_->get_shared_memory_via_raw_file_descriptor() + ->shared_memory_size_in_bytes; diff --git a/www/iridium/files/patch-services_video__capture_public_mojom_video__capture__service.mojom b/www/iridium/files/patch-services_video__capture_public_mojom_video__capture__service.mojom index ef0319c19676..deb5266d7c7d 100644 --- a/www/iridium/files/patch-services_video__capture_public_mojom_video__capture__service.mojom +++ b/www/iridium/files/patch-services_video__capture_public_mojom_video__capture__service.mojom @@ -1,15 +1,15 @@ ---- services/video_capture/public/mojom/video_capture_service.mojom.orig 2022-03-28 18:11:04 UTC +--- services/video_capture/public/mojom/video_capture_service.mojom.orig 2022-10-05 07:34:01 UTC +++ services/video_capture/public/mojom/video_capture_service.mojom -@@ -21,10 +21,10 @@ interface AcceleratorFactory { +@@ -24,10 +24,10 @@ interface AcceleratorFactory { pending_receiver jda); }; -[EnableIf=is_fuchsia] +[EnableIf=is_openbsd] const sandbox.mojom.Sandbox kVideoCaptureSandbox = sandbox.mojom.Sandbox.kVideoCapture; -[EnableIfNot=is_fuchsia] +[EnableIfNot=is_openbsd] const sandbox.mojom.Sandbox kVideoCaptureSandbox = sandbox.mojom.Sandbox.kNoSandbox; diff --git a/www/iridium/files/patch-third__party_abseil-cpp_absl_base_config.h b/www/iridium/files/patch-third__party_abseil-cpp_absl_base_config.h index f697f35dab3e..9f25a897d00b 100644 --- a/www/iridium/files/patch-third__party_abseil-cpp_absl_base_config.h +++ b/www/iridium/files/patch-third__party_abseil-cpp_absl_base_config.h @@ -1,40 +1,21 @@ ---- third_party/abseil-cpp/absl/base/config.h.orig 2022-03-28 18:11:04 UTC +--- third_party/abseil-cpp/absl/base/config.h.orig 2022-10-05 07:34:01 UTC +++ third_party/abseil-cpp/absl/base/config.h -@@ -414,7 +414,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != - defined(_AIX) || defined(__ros__) || defined(__native_client__) || \ - defined(__asmjs__) || defined(__wasm__) || defined(__Fuchsia__) || \ - defined(__sun) || defined(__ASYLO__) || defined(__myriad2__) || \ -- defined(__HAIKU__) -+ defined(__HAIKU__) || defined(__OpenBSD__) - #define ABSL_HAVE_MMAP 1 - #endif - -@@ -425,7 +425,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != - #ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM - #error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set - #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ -- defined(_AIX) || defined(__ros__) -+ defined(_AIX) || defined(__ros__) || defined(__OpenBSD__) - #define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1 - #endif - -@@ -444,7 +444,8 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != +@@ -458,7 +458,8 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != // POSIX.1-2001. #ifdef ABSL_HAVE_SCHED_YIELD #error ABSL_HAVE_SCHED_YIELD cannot be directly set -#elif defined(__linux__) || defined(__ros__) || defined(__native_client__) +#elif defined(__linux__) || defined(__ros__) || defined(__native_client__) || \ + defined(__OpenBSD__) || defined(__FreeBSD__) #define ABSL_HAVE_SCHED_YIELD 1 #endif -@@ -459,7 +460,8 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != +@@ -473,7 +474,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != // platforms. #ifdef ABSL_HAVE_SEMAPHORE_H #error ABSL_HAVE_SEMAPHORE_H cannot be directly set -#elif defined(__linux__) || defined(__ros__) -+#elif defined(__linux__) || defined(__ros__) || defined(__OpenBSD__) || \ -+ defined(__FreeBSD__) ++#elif defined(__linux__) || defined(__ros__) || defined(__OpenBSD__) || defined(__FreeBSD__) #define ABSL_HAVE_SEMAPHORE_H 1 #endif diff --git a/www/iridium/files/patch-third__party_abseil-cpp_absl_base_internal_endian.h b/www/iridium/files/patch-third__party_abseil-cpp_absl_base_internal_endian.h deleted file mode 100644 index 26238022497f..000000000000 --- a/www/iridium/files/patch-third__party_abseil-cpp_absl_base_internal_endian.h +++ /dev/null @@ -1,11 +0,0 @@ ---- third_party/abseil-cpp/absl/base/internal/endian.h.orig 2022-03-28 18:11:04 UTC -+++ third_party/abseil-cpp/absl/base/internal/endian.h -@@ -19,7 +19,7 @@ - // The following guarantees declaration of the byte swap functions - #ifdef _MSC_VER - #include // NOLINT(build/include) --#elif defined(__FreeBSD__) -+#elif defined(__FreeBSD__) || defined(__OpenBSD__) - #include - #elif defined(__GLIBC__) - #include // IWYU pragma: export diff --git a/www/iridium/files/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc b/www/iridium/files/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc index 41461ef663ec..b802a81f59f5 100644 --- a/www/iridium/files/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc +++ b/www/iridium/files/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc @@ -1,23 +1,23 @@ ---- third_party/abseil-cpp/absl/base/internal/sysinfo.cc.orig 2022-03-28 18:11:04 UTC +--- third_party/abseil-cpp/absl/base/internal/sysinfo.cc.orig 2022-10-05 07:34:01 UTC +++ third_party/abseil-cpp/absl/base/internal/sysinfo.cc @@ -30,7 +30,7 @@ #include #endif -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include #endif -@@ -308,9 +308,11 @@ static double GetNominalCPUFrequency() { +@@ -307,9 +307,11 @@ static double GetNominalCPUFrequency() { // a new mode (turbo mode). Essentially, those frequencies cannot // always be relied upon. The same reasons apply to /proc/cpuinfo as // well. +#if !defined(__OpenBSD__) && !defined(__FreeBSD__) // pledge violation if (ReadLongFromFile("/sys/devices/system/cpu/cpu0/tsc_freq_khz", &freq)) { return freq * 1e3; // Value is kHz. } +#endif #if defined(ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY) // On these platforms, the TSC frequency is the nominal CPU diff --git a/www/iridium/files/patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h b/www/iridium/files/patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h index a73ecdf1c9ac..74e13c3682fa 100644 --- a/www/iridium/files/patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h +++ b/www/iridium/files/patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h @@ -1,11 +1,11 @@ ---- third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h.orig 2022-03-28 18:11:04 UTC +--- third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h.orig 2022-10-05 07:34:01 UTC +++ third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h -@@ -32,7 +32,7 @@ - #endif +@@ -33,7 +33,7 @@ - #if defined(__ELF__) && !defined(__native_client__) && !defined(__asmjs__) && \ -- !defined(__wasm__) -+ !defined(__wasm__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) + #if defined(__ELF__) && !defined(__OpenBSD__) && !defined(__QNX__) && \ + !defined(__native_client__) && !defined(__asmjs__) && \ +- !defined(__wasm__) && !defined(__HAIKU__) ++ !defined(__wasm__) && !defined(__HAIKU__) && !defined(__FreeBSD__) #define ABSL_HAVE_ELF_MEM_IMAGE 1 #endif diff --git a/www/iridium/files/patch-third__party_abseil-cpp_absl_time_internal_cctz_src_time__zone__format.cc b/www/iridium/files/patch-third__party_abseil-cpp_absl_time_internal_cctz_src_time__zone__format.cc index dc32e6ddbd6c..1ebeeac6e72f 100644 --- a/www/iridium/files/patch-third__party_abseil-cpp_absl_time_internal_cctz_src_time__zone__format.cc +++ b/www/iridium/files/patch-third__party_abseil-cpp_absl_time_internal_cctz_src_time__zone__format.cc @@ -1,11 +1,11 @@ ---- third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc.orig 2022-03-28 18:11:04 UTC +--- third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc.orig 2022-10-05 07:34:01 UTC +++ third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc @@ -19,7 +19,7 @@ #endif #if defined(HAS_STRPTIME) && HAS_STRPTIME --#if !defined(_XOPEN_SOURCE) +-#if !defined(_XOPEN_SOURCE) && !defined(__OpenBSD__) +#if !defined(_XOPEN_SOURCE) && !defined(__OpenBSD__) && !defined(__FreeBSD__) #define _XOPEN_SOURCE // Definedness suffices for strptime. #endif #endif diff --git a/www/iridium/files/patch-third__party_angle_BUILD.gn b/www/iridium/files/patch-third__party_angle_BUILD.gn index 3cff0b867f47..24631c03c21a 100644 --- a/www/iridium/files/patch-third__party_angle_BUILD.gn +++ b/www/iridium/files/patch-third__party_angle_BUILD.gn @@ -1,29 +1,47 @@ ---- third_party/angle/BUILD.gn.orig 2022-03-28 18:11:04 UTC +--- third_party/angle/BUILD.gn.orig 2022-10-05 07:34:01 UTC +++ third_party/angle/BUILD.gn -@@ -206,7 +206,6 @@ config("extra_warnings") { +@@ -261,7 +261,6 @@ config("extra_warnings") { "-Wtautological-type-limit-compare", "-Wundefined-reinterpret-cast", "-Wunneeded-internal-declaration", - "-Wunused-but-set-variable", "-Wsuggest-destructor-override", "-Wsuggest-override", -@@ -384,7 +383,7 @@ angle_static_library("angle_common") { +@@ -439,7 +438,7 @@ angle_static_library("angle_common") { all_dependent_configs = [ ":angle_disable_pool_alloc" ] } - if (is_linux || is_chromeos) { + if ((is_linux || is_chromeos) && !is_bsd) { libs = [ "dl" ] } -@@ -498,6 +497,9 @@ angle_static_library("angle_gpu_info_util") { +@@ -569,6 +568,9 @@ angle_static_library("angle_gpu_info_util") { "Xi", "Xext", ] + if (is_bsd) { + libs += [ "GL" ] + } } + + if (angle_use_wayland && angle_has_build) { +@@ -1089,12 +1091,12 @@ if (angle_use_wayland) { + "wayland-client", + "wayland-egl", + ] ++ } else { ++ include_dirs = [ ++ "$wayland_dir/egl", ++ "$wayland_dir/src", ++ ] + } +- +- include_dirs = [ +- "$wayland_dir/egl", +- "$wayland_dir/src", +- ] } + group("angle_wayland") { diff --git a/www/iridium/files/patch-third__party_angle_src_common_system__utils__posix.cpp b/www/iridium/files/patch-third__party_angle_src_common_system__utils__posix.cpp deleted file mode 100644 index 380773601785..000000000000 --- a/www/iridium/files/patch-third__party_angle_src_common_system__utils__posix.cpp +++ /dev/null @@ -1,12 +0,0 @@ ---- third_party/angle/src/common/system_utils_posix.cpp.orig 2022-04-01 07:48:30 UTC -+++ third_party/angle/src/common/system_utils_posix.cpp -@@ -197,7 +197,9 @@ void *OpenSystemLibraryWithExtensionAndGetError(const - int extraFlags = 0; - if (searchType == SearchType::AlreadyLoaded) - { -+#if !defined(__OpenBSD__) - extraFlags = RTLD_NOLOAD; -+#endif - } - - std::string fullPath = directory + libraryName; diff --git a/www/iridium/files/patch-third__party_angle_src_common_vulkan_BUILD.gn b/www/iridium/files/patch-third__party_angle_src_common_vulkan_BUILD.gn new file mode 100644 index 000000000000..00ffd4d96e58 --- /dev/null +++ b/www/iridium/files/patch-third__party_angle_src_common_vulkan_BUILD.gn @@ -0,0 +1,11 @@ +--- third_party/angle/src/common/vulkan/BUILD.gn.orig 2022-10-05 07:34:01 UTC ++++ third_party/angle/src/common/vulkan/BUILD.gn +@@ -33,7 +33,7 @@ if (angle_enable_vulkan || angle_build_vulkan_system_i + if (angle_shared_libvulkan) { + defines = [ "ANGLE_SHARED_LIBVULKAN=1" ] + } +- if (angle_use_wayland) { ++ if (angle_use_wayland && !use_system_libwayland) { + include_dirs = [ "$wayland_dir/src" ] + } + configs = [ "$angle_root:angle_vulkan_wayland_config" ] diff --git a/www/iridium/files/patch-third__party_angle_src_libANGLE_Display.cpp b/www/iridium/files/patch-third__party_angle_src_libANGLE_Display.cpp index cdafceaaea17..2330f6c2bc8c 100644 --- a/www/iridium/files/patch-third__party_angle_src_libANGLE_Display.cpp +++ b/www/iridium/files/patch-third__party_angle_src_libANGLE_Display.cpp @@ -1,47 +1,47 @@ ---- third_party/angle/src/libANGLE/Display.cpp.orig 2022-04-01 07:48:30 UTC +--- third_party/angle/src/libANGLE/Display.cpp.orig 2022-10-05 07:34:01 UTC +++ third_party/angle/src/libANGLE/Display.cpp -@@ -55,7 +55,7 @@ +@@ -54,7 +54,7 @@ # include "libANGLE/renderer/gl/wgl/DisplayWGL.h" # elif defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_IOS) # include "libANGLE/renderer/gl/apple/DisplayApple_api.h" -# elif defined(ANGLE_PLATFORM_LINUX) +# elif defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD) # include "libANGLE/renderer/gl/egl/DisplayEGL.h" # if defined(ANGLE_USE_GBM) # include "libANGLE/renderer/gl/egl/gbm/DisplayGbm.h" -@@ -320,7 +320,7 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib di +@@ -331,7 +331,7 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib di impl = rx::CreateDisplayCGLOrEAGL(state); break; -# elif defined(ANGLE_PLATFORM_LINUX) +# elif defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD) # if defined(ANGLE_USE_GBM) if (platformType == 0) { -@@ -365,7 +365,7 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib di +@@ -374,7 +374,7 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib di #if defined(ANGLE_ENABLE_OPENGL) # if defined(ANGLE_PLATFORM_WINDOWS) impl = new rx::DisplayWGL(state); -# elif defined(ANGLE_PLATFORM_LINUX) +# elif defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD) # if defined(ANGLE_USE_GBM) if (platformType == 0 || platformType == EGL_PLATFORM_VULKAN_DISPLAY_MODE_HEADLESS_ANGLE) -@@ -416,7 +416,7 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib di +@@ -425,7 +425,7 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib di impl = rx::CreateVulkanWin32Display(state); } break; -# elif defined(ANGLE_PLATFORM_LINUX) +# elif defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD) - # if defined(ANGLE_USE_X11) - if (platformType == EGL_PLATFORM_X11_EXT && rx::IsVulkanXcbDisplayAvailable()) + # if defined(ANGLE_USE_GBM) + if (platformType == EGL_PLATFORM_GBM_KHR && rx::IsVulkanGbmDisplayAvailable()) { -@@ -1915,7 +1915,7 @@ static ClientExtensions GenerateClientExtensions() +@@ -1986,7 +1986,7 @@ static ClientExtensions GenerateClientExtensions() extensions.x11Visual = true; #endif -#if defined(ANGLE_PLATFORM_LINUX) +#if defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD) extensions.platformANGLEDeviceTypeEGLANGLE = true; #endif diff --git a/www/iridium/files/patch-third__party_angle_src_libANGLE_formatutils.cpp b/www/iridium/files/patch-third__party_angle_src_libANGLE_formatutils.cpp index d0fffe74830e..eaca9c9d3a9a 100644 --- a/www/iridium/files/patch-third__party_angle_src_libANGLE_formatutils.cpp +++ b/www/iridium/files/patch-third__party_angle_src_libANGLE_formatutils.cpp @@ -1,11 +1,11 @@ ---- third_party/angle/src/libANGLE/formatutils.cpp.orig 2022-04-01 07:48:30 UTC +--- third_party/angle/src/libANGLE/formatutils.cpp.orig 2022-10-05 07:34:01 UTC +++ third_party/angle/src/libANGLE/formatutils.cpp -@@ -1388,7 +1388,7 @@ static InternalFormatInfoMap BuildInternalFormatInfoMa +@@ -1399,7 +1399,7 @@ static InternalFormatInfoMap BuildInternalFormatInfoMa AddYUVFormat(&map, GL_G8_B8R8_2PLANE_420_UNORM_ANGLE, true, 8, 8, 8, 0, 0, GL_G8_B8R8_2PLANE_420_UNORM_ANGLE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::yuvInternalFormatANGLE>, RequireExt<&Extensions::yuvInternalFormatANGLE>, RequireExt<&Extensions::yuvInternalFormatANGLE>, NeverSupported, NeverSupported); AddYUVFormat(&map, GL_G8_B8_R8_3PLANE_420_UNORM_ANGLE, true, 8, 8, 8, 0, 0, GL_G8_B8_R8_3PLANE_420_UNORM_ANGLE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::yuvInternalFormatANGLE>, RequireExt<&Extensions::yuvInternalFormatANGLE>, RequireExt<&Extensions::yuvInternalFormatANGLE>, NeverSupported, NeverSupported); -#if defined(ANGLE_PLATFORM_LINUX) +#if defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD) // From GL_OES_required_internalformat // The |shared| bit shouldn't be 2. But given this hits assertion when bits // are checked, it's fine to have this bit set as 2 as a workaround. diff --git a/www/iridium/files/patch-third__party_angle_src_libANGLE_renderer_driver__utils.h b/www/iridium/files/patch-third__party_angle_src_libANGLE_renderer_driver__utils.h index 7d2e6df49caa..5d98a0925a53 100644 --- a/www/iridium/files/patch-third__party_angle_src_libANGLE_renderer_driver__utils.h +++ b/www/iridium/files/patch-third__party_angle_src_libANGLE_renderer_driver__utils.h @@ -1,11 +1,11 @@ ---- third_party/angle/src/libANGLE/renderer/driver_utils.h.orig 2022-03-28 18:11:04 UTC +--- third_party/angle/src/libANGLE/renderer/driver_utils.h.orig 2022-10-05 07:34:01 UTC +++ third_party/angle/src/libANGLE/renderer/driver_utils.h -@@ -179,7 +179,7 @@ inline bool IsWindows() +@@ -183,7 +183,7 @@ inline bool IsWindows() inline bool IsLinux() { -#if defined(ANGLE_PLATFORM_LINUX) +#if defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD) return true; #else return false; diff --git a/www/iridium/files/patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h b/www/iridium/files/patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h index e8dd11425a97..ea7ce14a82c6 100644 --- a/www/iridium/files/patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h +++ b/www/iridium/files/patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h @@ -1,11 +1,11 @@ ---- third_party/angle/src/libANGLE/renderer/vulkan/DisplayVk_api.h.orig 2022-03-28 18:11:04 UTC +--- third_party/angle/src/libANGLE/renderer/vulkan/DisplayVk_api.h.orig 2022-10-05 07:34:01 UTC +++ third_party/angle/src/libANGLE/renderer/vulkan/DisplayVk_api.h @@ -23,7 +23,7 @@ bool IsVulkanWin32DisplayAvailable(); DisplayImpl *CreateVulkanWin32Display(const egl::DisplayState &state); #endif // defined(ANGLE_PLATFORM_WINDOWS) -#if defined(ANGLE_PLATFORM_LINUX) +#if defined(ANGLE_PLATFORM_POSIX) - bool IsVulkanXcbDisplayAvailable(); - DisplayImpl *CreateVulkanXcbDisplay(const egl::DisplayState &state); + bool IsVulkanWaylandDisplayAvailable(); + DisplayImpl *CreateVulkanWaylandDisplay(const egl::DisplayState &state); diff --git a/www/iridium/files/patch-third__party_angle_src_third__party_volk_BUILD.gn b/www/iridium/files/patch-third__party_angle_src_third__party_volk_BUILD.gn new file mode 100644 index 000000000000..3e4f7543bb0f --- /dev/null +++ b/www/iridium/files/patch-third__party_angle_src_third__party_volk_BUILD.gn @@ -0,0 +1,11 @@ +--- third_party/angle/src/third_party/volk/BUILD.gn.orig 2022-10-05 07:34:01 UTC ++++ third_party/angle/src/third_party/volk/BUILD.gn +@@ -20,7 +20,7 @@ source_set("volk") { + public_configs = [ ":volk_config" ] + configs += [ "$angle_root:angle_no_cfi_icall" ] + public_deps = [ "$angle_vulkan_headers_dir:vulkan_headers" ] +- if (angle_use_wayland) { ++ if (angle_use_wayland && !use_system_libwayland) { + include_dirs = [ "$wayland_dir/src" ] + } + } diff --git a/www/iridium/files/patch-third__party_angle_util_BUILD.gn b/www/iridium/files/patch-third__party_angle_util_BUILD.gn index de38c35b40a9..5a906eab2704 100644 --- a/www/iridium/files/patch-third__party_angle_util_BUILD.gn +++ b/www/iridium/files/patch-third__party_angle_util_BUILD.gn @@ -1,11 +1,11 @@ ---- third_party/angle/util/BUILD.gn.orig 2022-03-28 18:11:04 UTC +--- third_party/angle/util/BUILD.gn.orig 2022-10-05 07:34:01 UTC +++ third_party/angle/util/BUILD.gn -@@ -200,7 +200,7 @@ foreach(is_shared_library, +@@ -246,7 +246,7 @@ foreach(is_shared_library, ] libs = [] - if (is_linux || is_chromeos) { + if ((is_linux || is_chromeos) && !is_bsd) { libs += [ "rt", "dl", diff --git a/www/iridium/files/patch-third__party_blink_common_privacy__budget_active__sampling.cc b/www/iridium/files/patch-third__party_blink_common_privacy__budget_active__sampling.cc new file mode 100644 index 000000000000..398d3bd8b616 --- /dev/null +++ b/www/iridium/files/patch-third__party_blink_common_privacy__budget_active__sampling.cc @@ -0,0 +1,11 @@ +--- third_party/blink/common/privacy_budget/active_sampling.cc.orig 2022-10-05 07:34:01 UTC ++++ third_party/blink/common/privacy_budget/active_sampling.cc +@@ -24,7 +24,7 @@ namespace blink { + bool IdentifiabilityActiveSampler::IsFontFamilyAvailable(const char* family, + SkFontMgr* fm) { + base::ScopedAllowBaseSyncPrimitives allow; +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) + return !!fm->legacyMakeTypeface(family, SkFontStyle()); + #else + sk_sp set(fm->matchFamily(family)); diff --git a/www/iridium/files/patch-third__party_blink_public_platform_platform.h b/www/iridium/files/patch-third__party_blink_public_platform_platform.h new file mode 100644 index 000000000000..fc34dbc8b039 --- /dev/null +++ b/www/iridium/files/patch-third__party_blink_public_platform_platform.h @@ -0,0 +1,11 @@ +--- third_party/blink/public/platform/platform.h.orig 2022-10-05 07:34:01 UTC ++++ third_party/blink/public/platform/platform.h +@@ -340,7 +340,7 @@ class BLINK_PLATFORM_EXPORT Platform { + return nullptr; + } + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) + // This is called after the thread is created, so the embedder + // can initiate an IPC to change its thread type (on Linux we can't + // increase the nice value, so we need to ask the browser process). This diff --git a/www/iridium/files/patch-third__party_blink_renderer_controller_blink__initializer.cc b/www/iridium/files/patch-third__party_blink_renderer_controller_blink__initializer.cc index 70c80a467693..5148eecc150b 100644 --- a/www/iridium/files/patch-third__party_blink_renderer_controller_blink__initializer.cc +++ b/www/iridium/files/patch-third__party_blink_renderer_controller_blink__initializer.cc @@ -1,35 +1,35 @@ ---- third_party/blink/renderer/controller/blink_initializer.cc.orig 2022-03-28 18:11:04 UTC +--- third_party/blink/renderer/controller/blink_initializer.cc.orig 2022-10-05 07:34:01 UTC +++ third_party/blink/renderer/controller/blink_initializer.cc -@@ -71,12 +71,12 @@ +@@ -74,12 +74,12 @@ #include "third_party/blink/renderer/controller/oom_intervention_impl.h" #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #include "third_party/blink/renderer/controller/memory_usage_monitor_posix.h" #endif #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ - BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) #include "third_party/blink/renderer/controller/highest_pmf_reporter.h" #include "third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.h" #endif -@@ -156,7 +156,7 @@ void InitializeCommon(Platform* platform, mojo::Binder +@@ -172,7 +172,7 @@ void InitializeCommon(Platform* platform, mojo::Binder #endif #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ - BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) // Initialize UserLevelMemoryPressureSignalGenerator so it starts monitoring. if (UserLevelMemoryPressureSignalGenerator::Enabled()) UserLevelMemoryPressureSignalGenerator::Instance(); -@@ -227,7 +227,7 @@ void BlinkInitializer::RegisterInterfaces(mojo::Binder - main_thread->GetTaskRunner()); +@@ -253,7 +253,7 @@ void BlinkInitializer::RegisterInterfaces(mojo::Binder + main_thread_task_runner); #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) - binders.Add(ConvertToBaseRepeatingCallback( - CrossThreadBindRepeating(&MemoryUsageMonitorPosix::Bind)), - main_thread->GetTaskRunner()); + binders.Add( + ConvertToBaseRepeatingCallback( + CrossThreadBindRepeating(&MemoryUsageMonitorPosix::Bind)), diff --git a/www/iridium/files/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc b/www/iridium/files/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc index 1b0c7836d180..83cb4c122a4d 100644 --- a/www/iridium/files/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc +++ b/www/iridium/files/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc @@ -1,21 +1,21 @@ ---- third_party/blink/renderer/controller/memory_usage_monitor_posix.cc.orig 2022-03-28 18:11:04 UTC +--- third_party/blink/renderer/controller/memory_usage_monitor_posix.cc.orig 2022-10-05 07:34:01 UTC +++ third_party/blink/renderer/controller/memory_usage_monitor_posix.cc -@@ -128,15 +128,17 @@ void MemoryUsageMonitorPosix::ResetFileDescriptors() { +@@ -129,15 +129,17 @@ void MemoryUsageMonitorPosix::ResetFileDescriptors() { void MemoryUsageMonitorPosix::SetProcFiles(base::File statm_file, base::File status_file) { +#if !BUILDFLAG(IS_BSD) DCHECK(statm_file.IsValid()); DCHECK(status_file.IsValid()); DCHECK_EQ(-1, statm_fd_.get()); DCHECK_EQ(-1, status_fd_.get()); statm_fd_.reset(statm_file.TakePlatformFile()); status_fd_.reset(status_file.TakePlatformFile()); +#endif } -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) // static void MemoryUsageMonitorPosix::Bind( mojo::PendingReceiver receiver) { diff --git a/www/iridium/files/patch-third__party_blink_renderer_core_execution__context_navigator__base.cc b/www/iridium/files/patch-third__party_blink_renderer_core_execution__context_navigator__base.cc new file mode 100644 index 000000000000..e2820378085f --- /dev/null +++ b/www/iridium/files/patch-third__party_blink_renderer_core_execution__context_navigator__base.cc @@ -0,0 +1,11 @@ +--- third_party/blink/renderer/core/execution_context/navigator_base.cc.orig 2022-10-05 07:34:01 UTC ++++ third_party/blink/renderer/core/execution_context/navigator_base.cc +@@ -31,7 +31,7 @@ String GetReducedNavigatorPlatform() { + return "Win32"; + #elif BUILDFLAG(IS_FUCHSIA) + return ""; +-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) + return "Linux x86_64"; + #else + #error Unsupported platform diff --git a/www/iridium/files/patch-third__party_blink_renderer_core_exported_web__view__impl.cc b/www/iridium/files/patch-third__party_blink_renderer_core_exported_web__view__impl.cc index ad2be0b5279e..61e1594b109f 100644 --- a/www/iridium/files/patch-third__party_blink_renderer_core_exported_web__view__impl.cc +++ b/www/iridium/files/patch-third__party_blink_renderer_core_exported_web__view__impl.cc @@ -1,20 +1,20 @@ ---- third_party/blink/renderer/core/exported/web_view_impl.cc.orig 2022-04-01 07:48:30 UTC +--- third_party/blink/renderer/core/exported/web_view_impl.cc.orig 2022-10-05 07:34:01 UTC +++ third_party/blink/renderer/core/exported/web_view_impl.cc @@ -404,7 +404,7 @@ SkFontHinting RendererPreferencesToSkiaHinting( const blink::RendererPreferences& prefs) { // TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is // complete. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) if (!prefs.should_antialias_text) { // When anti-aliasing is off, GTK maps all non-zero hinting settings to // 'Normal' hinting so we do the same. Otherwise, folks who have 'Slight' -@@ -3159,7 +3159,7 @@ void WebViewImpl::UpdateFontRenderingFromRendererPrefs +@@ -3254,7 +3254,7 @@ void WebViewImpl::UpdateFontRenderingFromRendererPrefs renderer_preferences_.use_subpixel_positioning); // TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is // complete. -#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \ +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)) && \ !BUILDFLAG(IS_ANDROID) if (!renderer_preferences_.system_font_family_name.empty()) { WebFontRenderStyle::SetSystemFontFamily(blink::WebString::FromUTF8( diff --git a/www/iridium/files/patch-third__party_blink_renderer_core_frame_web__frame__test.cc b/www/iridium/files/patch-third__party_blink_renderer_core_frame_web__frame__test.cc index 4865c5ae55d1..80f63a67937d 100644 --- a/www/iridium/files/patch-third__party_blink_renderer_core_frame_web__frame__test.cc +++ b/www/iridium/files/patch-third__party_blink_renderer_core_frame_web__frame__test.cc @@ -1,20 +1,20 @@ ---- third_party/blink/renderer/core/frame/web_frame_test.cc.orig 2022-03-28 18:11:04 UTC +--- third_party/blink/renderer/core/frame/web_frame_test.cc.orig 2022-10-05 07:34:01 UTC +++ third_party/blink/renderer/core/frame/web_frame_test.cc -@@ -6310,7 +6310,7 @@ TEST_F(WebFrameTest, DISABLED_PositionForPointTest) { - EXPECT_EQ(64, ComputeOffset(layout_object, 1000, 1000)); - } - +@@ -6357,7 +6357,7 @@ TEST_F(WebFrameTest, DISABLED_PositionForPointTest) { + MoveCaretStaysHorizontallyAlignedWhenMoved + #endif + // TODO(crbug.com/1317375): Build these tests on all platforms. -#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) +#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD) - TEST_F(WebFrameTest, SelectRangeStaysHorizontallyAlignedWhenMoved) { + TEST_F(WebFrameTest, MAYBE_SelectRangeStaysHorizontallyAlignedWhenMoved) { RegisterMockedHttpURLLoad("move_caret.html"); -@@ -6689,7 +6689,7 @@ TEST_F(CompositedSelectionBoundsTest, SVGBasic) { - TEST_F(CompositedSelectionBoundsTest, SVGTextWithFragments) { - RunTest("composited_selection_bounds_svg_text_with_fragments.html"); +@@ -6753,7 +6753,7 @@ TEST_F(CompositedSelectionBoundsTest, LargeSelectionSc + TEST_F(CompositedSelectionBoundsTest, LargeSelectionNoScroll) { + RunTest("composited_selection_bounds_large_selection_noscroll.html"); } -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) #if !BUILDFLAG(IS_ANDROID) TEST_F(CompositedSelectionBoundsTest, Input) { web_view_helper_.GetWebView()->GetSettings()->SetDefaultFontSize(16); diff --git a/www/iridium/files/patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc b/www/iridium/files/patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc index 503cc9808a6b..adc57ed52c51 100644 --- a/www/iridium/files/patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc +++ b/www/iridium/files/patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc @@ -1,11 +1,11 @@ ---- third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc.orig 2022-03-28 18:11:04 UTC +--- third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc.orig 2022-10-05 07:34:01 UTC +++ third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc -@@ -44,7 +44,7 @@ constexpr base::TimeDelta kEncodeRowSlackBeforeDeadlin +@@ -45,7 +45,7 @@ constexpr base::TimeDelta kEncodeRowSlackBeforeDeadlin /* The value is based on user statistics on Nov 2017. */ #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \ - BUILDFLAG(IS_WIN)) + BUILDFLAG(IS_WIN)) || BUILDFLAG(IS_BSD) const double kIdleTaskStartTimeoutDelayMs = 1000.0; #else const double kIdleTaskStartTimeoutDelayMs = 4000.0; // For ChromeOS, Mobile diff --git a/www/iridium/files/patch-third__party_blink_renderer_core_html_forms_internal__popup__menu.cc b/www/iridium/files/patch-third__party_blink_renderer_core_html_forms_internal__popup__menu.cc deleted file mode 100644 index b562d897586c..000000000000 --- a/www/iridium/files/patch-third__party_blink_renderer_core_html_forms_internal__popup__menu.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- third_party/blink/renderer/core/html/forms/internal_popup_menu.cc.orig 2022-04-01 07:48:30 UTC -+++ third_party/blink/renderer/core/html/forms/internal_popup_menu.cc -@@ -179,7 +179,7 @@ class InternalPopupMenu::ItemIterationContext { - is_in_group_(false), - buffer_(buffer) { - DCHECK(buffer_); --#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) -+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) - // On other platforms, the