From 66753cef9988d6ab69d0dfd30649d28ff1b4e333 Mon Sep 17 00:00:00 2001 From: John Date: Sun, 10 May 2020 15:05:15 +0200 Subject: [PATCH 1/2] New package: electron9-9.2.1 [ci skip] --- .../musl-patches/chromium-musl-crashpad.patch | 23 + ...omium-musl-default-pthread-stacksize.patch | 31 ++ .../musl-patches/chromium-musl-sandbox.patch | 176 +++++++ ...chromium-musl_canonicalize_file_name.patch | 13 + .../musl-patches/chromium-musl_cdefs.patch | 45 ++ ...omium-musl_define_temp_failure_retry.patch | 18 + .../musl-patches/chromium-musl_dns.patch | 61 +++ .../musl-patches/chromium-musl_exeinfo.patch | 96 ++++ .../chromium-musl_fpstate_t.patch | 48 ++ .../chromium-musl_getcontext.patch | 25 + .../musl-patches/chromium-musl_mallinfo.patch | 61 +++ .../chromium-musl_pread_pwrite64.patch | 18 + .../chromium-musl_push_back.patch | 13 + .../chromium-musl_stack_size.patch | 41 ++ .../chromium-musl_stack_trace.patch | 44 ++ .../chromium-musl_tcp_listen.patch | 14 + .../musl-patches/chromium-musl_wordsize.patch | 24 + .../files/patches/chromium-83-gcc-10.patch | 64 +++ ...rithm-header-in-crx_install_error.cc.patch | 29 ++ ...struction-of-ServiceWorkerObjectHost.patch | 138 ++++++ ...chromium-chromium_atk_optional.patch.patch | 15 + ...chromium-clean-up-a-call-to-set_utf8.patch | 34 ++ .../files/patches/chromium-ffmpeg-4.3.patch | 21 + ...omium-fix-template-specialization-01.patch | 64 +++ ...c-CrossVariantMojoAssociatedReceiver.patch | 56 +++ .../chromium-gcc-aarch64-zlib-crc-01.patch | 131 ++++++ .../chromium-gcc-aarch64-zlib-crc-02.patch | 35 ++ ...-move-assignement-operators-noexcept.patch | 66 +++ .../files/patches/chromium-gcc-shared.patch | 20 + .../patches/chromium-gcc-webui-template.patch | 67 +++ ...eader-to-get-the-definition-of-std-u.patch | 32 ++ ...-numeric_limits-is-defined-in-limits.patch | 29 ++ .../files/patches/chromium-libc_malloc.patch | 26 ++ ...mplete-type-in-AXTree-for-NodeSetSiz.patch | 62 +++ ...link-custom-iterators-STL-compatible.patch | 95 ++++ .../files/patches/chromium-skia-harmony.patch | 14 + .../patches/chromium-toolchain-host.patch | 11 + ...l-in-SDR-HDR-DisplayColorSpaces-CrOS.patch | 436 ++++++++++++++++++ ...rmont-AFDO-profile-from-83-4103.97-1.patch | 41 ++ ...lvermont-AFDO-profile-from-83-4103.9.patch | 41 ++ ...oadwell-AFDO-profile-from-83-4103.97.patch | 41 ++ ...ncrementing-VERSION-to-83.0.4103.120.patch | 29 ++ ...PW-bookkeeping-out-of-forked-process.patch | 150 ++++++ ...ort-GCPW-login-to-permitted-accounts.patch | 197 ++++++++ ...dle-lsa_account_rights-size-properly.patch | 55 +++ ...ncrementing-VERSION-to-83.0.4103.121.patch | 29 ++ ...ceManageAccountBrowserTest.ClearMana.patch | 43 ++ ...ncrementing-VERSION-to-83.0.4103.122.patch | 29 ++ ...n-to-be-removed-getAllFieldPositions.patch | 172 +++++++ ...a-script-to-list-patch-targets.patch.patch | 42 ++ .../patches/electron-Build-fixes.patch.patch | 47 ++ ...ectron-dont-assume-python-is-python2.patch | 17 + ...electron-exluce-content-test-patches.patch | 10 + .../sndio-files/audio_manager_openbsd.cc | 148 ++++++ .../files/sndio-files/audio_manager_openbsd.h | 65 +++ .../files/sndio-files/sndio_input.cc | 201 ++++++++ .../electron9/files/sndio-files/sndio_input.h | 91 ++++ .../files/sndio-files/sndio_output.cc | 183 ++++++++ .../files/sndio-files/sndio_output.h | 86 ++++ ...a_audio_linux_audio_manager_linux.cc.patch | 43 ++ ...src_3rdparty_chromium_media_BUILD.gn.patch | 12 + ...dparty_chromium_media_audio_BUILD.gn.patch | 23 + ...ty_chromium_media_media__options.gni.patch | 12 + srcpkgs/electron9/template | 354 ++++++++++++++ srcpkgs/electron9/update | 2 + 65 files changed, 4359 insertions(+) create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl-crashpad.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl-default-pthread-stacksize.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl-sandbox.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_canonicalize_file_name.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_cdefs.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_define_temp_failure_retry.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_dns.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_exeinfo.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_fpstate_t.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_getcontext.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_mallinfo.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_pread_pwrite64.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_push_back.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_stack_size.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_stack_trace.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_tcp_listen.patch create mode 100644 srcpkgs/electron9/files/musl-patches/chromium-musl_wordsize.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-83-gcc-10.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-add-missing-algorithm-header-in-crx_install_error.cc.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-avoid-double-destruction-of-ServiceWorkerObjectHost.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-chromium_atk_optional.patch.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-clean-up-a-call-to-set_utf8.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-ffmpeg-4.3.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-fix-template-specialization-01.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-gcc-CrossVariantMojoAssociatedReceiver.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-gcc-aarch64-zlib-crc-01.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-gcc-aarch64-zlib-crc-02.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-gcc-move-assignement-operators-noexcept.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-gcc-shared.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-gcc-webui-template.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-include-memory-header-to-get-the-definition-of-std-u.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-iwyu-std-numeric_limits-is-defined-in-limits.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-libc_malloc.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-libstdc-fix-incomplete-type-in-AXTree-for-NodeSetSiz.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-make-some-of-blink-custom-iterators-STL-compatible.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-skia-harmony.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-toolchain-host.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-upstream-0001-Revert-ui-fill-in-SDR-HDR-DisplayColorSpaces-CrOS.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-upstream-0002-Roll-ChromeOS-Airmont-AFDO-profile-from-83-4103.97-1.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-upstream-0003-Roll-ChromeOS-Silvermont-AFDO-profile-from-83-4103.9.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-upstream-0004-Roll-ChromeOS-Broadwell-AFDO-profile-from-83-4103.97.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-upstream-0005-Incrementing-VERSION-to-83.0.4103.120.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-upstream-0006-Move-GCPW-bookkeeping-out-of-forked-process.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-upstream-0007-Support-GCPW-login-to-permitted-accounts.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-upstream-0008-Handle-lsa_account_rights-size-properly.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-upstream-0009-Incrementing-VERSION-to-83.0.4103.121.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-upstream-0010-Disable-flaky-DiceManageAccountBrowserTest.ClearMana.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-upstream-0011-Incrementing-VERSION-to-83.0.4103.122.patch create mode 100644 srcpkgs/electron9/files/patches/chromium-v8-remove-soon-to-be-removed-getAllFieldPositions.patch create mode 100644 srcpkgs/electron9/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch create mode 100644 srcpkgs/electron9/files/patches/electron-Build-fixes.patch.patch create mode 100644 srcpkgs/electron9/files/patches/electron-dont-assume-python-is-python2.patch create mode 100644 srcpkgs/electron9/files/patches/electron-exluce-content-test-patches.patch create mode 100644 srcpkgs/electron9/files/sndio-files/audio_manager_openbsd.cc create mode 100644 srcpkgs/electron9/files/sndio-files/audio_manager_openbsd.h create mode 100644 srcpkgs/electron9/files/sndio-files/sndio_input.cc create mode 100644 srcpkgs/electron9/files/sndio-files/sndio_input.h create mode 100644 srcpkgs/electron9/files/sndio-files/sndio_output.cc create mode 100644 srcpkgs/electron9/files/sndio-files/sndio_output.h create mode 100644 srcpkgs/electron9/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch create mode 100644 srcpkgs/electron9/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch create mode 100644 srcpkgs/electron9/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch create mode 100644 srcpkgs/electron9/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch create mode 100644 srcpkgs/electron9/template create mode 100644 srcpkgs/electron9/update diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl-crashpad.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl-crashpad.patch new file mode 100644 index 00000000000..70cffa3002b --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl-crashpad.patch @@ -0,0 +1,23 @@ +--- a/third_party/crashpad/crashpad/util/linux/ptracer.cc ++++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc +@@ -26,6 +26,7 @@ + + #if defined(ARCH_CPU_X86_FAMILY) + #include ++#include + #endif + + namespace crashpad { + +--- a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h ++++ b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h +@@ -17,7 +17,9 @@ + + #include_next + ++#if defined(__GLIBC__) + #include ++#endif + + // https://sourceware.org/bugzilla/show_bug.cgi?id=22433 + #if !defined(PTRACE_GET_THREAD_AREA) && !defined(PT_GET_THREAD_AREA) && \ diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl-default-pthread-stacksize.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl-default-pthread-stacksize.patch new file mode 100644 index 00000000000..d0c1361b8ed --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl-default-pthread-stacksize.patch @@ -0,0 +1,31 @@ +diff --git a/base/threading/platform_thread_linux.cc b/base/threading/platform_thread_linux.cc +index 095c49b..5044bb8 100644 +--- a/base/threading/platform_thread_linux.cc ++++ b/base/threading/platform_thread_linux.cc +@@ -186,7 +186,7 @@ void TerminateOnThread() {} + + size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { + #if !defined(THREAD_SANITIZER) +- return 0; ++ return (1 << 23); + #else + // ThreadSanitizer bloats the stack heavily. Evidence has been that the + // default stack size isn't enough for some browser tests. +diff --git a/chrome/app/shutdown_signal_handlers_posix.cc b/chrome/app/shutdown_signal_handlers_posix.cc +index 621d441..be21106 100644 +--- a/chrome/app/shutdown_signal_handlers_posix.cc ++++ b/chrome/app/shutdown_signal_handlers_posix.cc +@@ -187,11 +187,11 @@ void InstallShutdownSignalHandlers( + g_shutdown_pipe_read_fd = pipefd[0]; + g_shutdown_pipe_write_fd = pipefd[1]; + #if !defined(ADDRESS_SANITIZER) +- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2; ++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 *8; + #else + // ASan instrumentation bloats the stack frames, so we need to increase the + // stack size to avoid hitting the guard page. +- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4; ++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 *8; + #endif + ShutdownDetector* detector = new ShutdownDetector( + g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner); diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl-sandbox.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl-sandbox.patch new file mode 100644 index 00000000000..f485f6cc75a --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl-sandbox.patch @@ -0,0 +1,176 @@ +diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc +index 348ab6e..4550f9e 100644 +--- ./sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc ++++ ./sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc +@@ -139,21 +139,11 @@ namespace sandbox { + // present (as in newer versions of posix_spawn). + ResultExpr RestrictCloneToThreadsAndEPERMFork() { + const Arg flags(0); +- +- // TODO(mdempsky): Extend DSL to support (flags & ~mask1) == mask2. +- const uint64_t kAndroidCloneMask = CLONE_VM | CLONE_FS | CLONE_FILES | +- CLONE_SIGHAND | CLONE_THREAD | +- CLONE_SYSVSEM; +- const uint64_t kObsoleteAndroidCloneMask = kAndroidCloneMask | CLONE_DETACHED; +- +- const uint64_t kGlibcPthreadFlags = +- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_THREAD | +- CLONE_SYSVSEM | CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID; +- const BoolExpr glibc_test = flags == kGlibcPthreadFlags; +- +- const BoolExpr android_test = +- AnyOf(flags == kAndroidCloneMask, flags == kObsoleteAndroidCloneMask, +- flags == kGlibcPthreadFlags); ++ const int required = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | ++ CLONE_THREAD | CLONE_SYSVSEM; ++ const int safe = CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID | ++ CLONE_DETACHED; ++ const BoolExpr thread_clone_ok = (flags&~safe)==required; + + // The following two flags are the two important flags in any vfork-emulating + // clone call. EPERM any clone call that contains both of them. +@@ -163,7 +153,7 @@ ResultExpr RestrictCloneToThreadsAndEPERMFork() { + AnyOf((flags & (CLONE_VM | CLONE_THREAD)) == 0, + (flags & kImportantCloneVforkFlags) == kImportantCloneVforkFlags); + +- return If(IsAndroid() ? android_test : glibc_test, Allow()) ++ return If(thread_clone_ok, Allow()) + .ElseIf(is_fork_or_clone_vfork, Error(EPERM)) + .Else(CrashSIGSYSClone()); + } +diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +index 7dbcc87..589262f 100644 +--- ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc ++++ ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +@@ -391,6 +391,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { + #if defined(__i386__) + case __NR_waitpid: + #endif ++ case __NR_set_tid_address: + return true; + case __NR_clone: // Should be parameter-restricted. + case __NR_setns: // Privileged. +@@ -403,7 +404,6 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { + #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) + case __NR_set_thread_area: + #endif +- case __NR_set_tid_address: + case __NR_unshare: + #if !defined(__mips__) && !defined(__aarch64__) + case __NR_vfork: +@@ -513,6 +513,8 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { + case __NR_mlock: + case __NR_munlock: + case __NR_munmap: ++ case __NR_mremap: ++ case __NR_membarrier: + return true; + case __NR_madvise: + case __NR_mincore: +@@ -530,7 +532,6 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { + case __NR_modify_ldt: + #endif + case __NR_mprotect: +- case __NR_mremap: + case __NR_msync: + case __NR_munlockall: + case __NR_readahead: +diff --git a/sandbox/linux/system_headers/arm64_linux_syscalls.h b/sandbox/linux/system_headers/arm64_linux_syscalls.h +index 59d0eab..7ae7002 100644 +--- ./sandbox/linux/system_headers/arm64_linux_syscalls.h ++++ ./sandbox/linux/system_headers/arm64_linux_syscalls.h +@@ -1063,4 +1063,8 @@ + #define __NR_memfd_create 279 + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier 283 ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ARM64_LINUX_SYSCALLS_H_ +diff --git a/sandbox/linux/system_headers/arm_linux_syscalls.h b/sandbox/linux/system_headers/arm_linux_syscalls.h +index 1addd53..7843b5e 100644 +--- ./sandbox/linux/system_headers/arm_linux_syscalls.h ++++ ./sandbox/linux/system_headers/arm_linux_syscalls.h +@@ -1385,6 +1385,10 @@ + #define __NR_memfd_create (__NR_SYSCALL_BASE+385) + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier (__NR_SYSCALL_BASE+389) ++#endif ++ + // ARM private syscalls. + #if !defined(__ARM_NR_BASE) + #define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000) +diff --git a/sandbox/linux/system_headers/mips64_linux_syscalls.h b/sandbox/linux/system_headers/mips64_linux_syscalls.h +index ec75815..612fcfa 100644 +--- ./sandbox/linux/system_headers/mips64_linux_syscalls.h ++++ ./sandbox/linux/system_headers/mips64_linux_syscalls.h +@@ -1271,4 +1271,8 @@ + #define __NR_memfd_create (__NR_Linux + 314) + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier (__NR_Linux + 318) ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_SYSCALLS_H_ +diff --git a/sandbox/linux/system_headers/mips_linux_syscalls.h b/sandbox/linux/system_headers/mips_linux_syscalls.h +index ddbf97f..1742acd 100644 +--- ./sandbox/linux/system_headers/mips_linux_syscalls.h ++++ ./sandbox/linux/system_headers/mips_linux_syscalls.h +@@ -1433,4 +1433,8 @@ + #define __NR_memfd_create (__NR_Linux + 354) + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier (__NR_Linux + 358) ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS_LINUX_SYSCALLS_H_ +diff --git a/sandbox/linux/system_headers/x86_32_linux_syscalls.h b/sandbox/linux/system_headers/x86_32_linux_syscalls.h +index a6afc62..7ed0a3b 100644 +--- ./sandbox/linux/system_headers/x86_32_linux_syscalls.h ++++ ./sandbox/linux/system_headers/x86_32_linux_syscalls.h +@@ -1422,5 +1422,9 @@ + #define __NR_memfd_create 356 + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier 375 ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_32_LINUX_SYSCALLS_H_ + +diff --git a/sandbox/linux/system_headers/x86_64_linux_syscalls.h b/sandbox/linux/system_headers/x86_64_linux_syscalls.h +index 349504a..ea3c7c9 100644 +--- ./sandbox/linux/system_headers/x86_64_linux_syscalls.h ++++ ./sandbox/linux/system_headers/x86_64_linux_syscalls.h +@@ -1290,5 +1290,9 @@ + #define __NR_memfd_create 319 + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier 324 ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_64_LINUX_SYSCALLS_H_ + +diff --git a/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc b/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc +index 017f13c..50aeec3 100644 +--- ./services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc ++++ ./services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc +@@ -88,10 +88,10 @@ ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const { + case __NR_sysinfo: + case __NR_times: + case __NR_uname: +- return Allow(); +- case __NR_sched_getaffinity: + case __NR_sched_getparam: + case __NR_sched_getscheduler: ++ return Allow(); ++ case __NR_sched_getaffinity: + case __NR_sched_setscheduler: + return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno); + case __NR_prlimit64: diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_canonicalize_file_name.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_canonicalize_file_name.patch new file mode 100644 index 00000000000..05614daa757 --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_canonicalize_file_name.patch @@ -0,0 +1,13 @@ +diff --git a/third_party/nasm/config/config-linux.h b/third_party/nasm/config/config-linux.h +index 7eb7c20..882b736 100644 +--- a/third_party/nasm/config/config-linux.h ++++ b/third_party/nasm/config/config-linux.h +@@ -117,7 +117,7 @@ + #define HAVE_ACCESS 1 + + /* Define to 1 if you have the `canonicalize_file_name' function. */ +-#define HAVE_CANONICALIZE_FILE_NAME 1 ++/* #undef HAVE_CANONICALIZE_FILE_NAME */ + + /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */ + /* #undef HAVE_CPU_TO_LE16 */ diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_cdefs.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_cdefs.patch new file mode 100644 index 00000000000..fc7dc06ff21 --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_cdefs.patch @@ -0,0 +1,45 @@ +diff --git a/base/allocator/allocator_shim_internals.h b/base/allocator/allocator_shim_internal +s.h +index 0196f89..bb42b5d 100644 +--- a/base/allocator/allocator_shim_internals.h ++++ b/base/allocator/allocator_shim_internals.h +@@ -7,7 +7,9 @@ + + #if defined(__GNUC__) + ++#if defined(__GLIBC__) + #include // for __THROW ++#endif + + #ifndef __THROW // Not a glibc system + #ifdef _NOEXCEPT // LLVM libc++ uses noexcept instead +diff --git a/third_party/libsync/src/include/sync/sync.h b/third_party/libsync/src/include/sync/sync.h +index 50ed0ac..7552a49 100644 +--- a/third_party/libsync/src/include/sync/sync.h ++++ b/third_party/libsync/src/include/sync/sync.h +@@ -19,12 +19,13 @@ + #ifndef __SYS_CORE_SYNC_H + #define __SYS_CORE_SYNC_H + +-#include + #include + + #include + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif /* __cplusplus */ + + struct sync_legacy_merge_data { + int32_t fd2; +@@ -158,6 +159,8 @@ struct sync_pt_info *sync_pt_info(struct sync_fence_info_data *info, + struct sync_pt_info *itr); + void sync_fence_info_free(struct sync_fence_info_data *info); + +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif /* __cplusplus */ + + #endif /* __SYS_CORE_SYNC_H */ diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_define_temp_failure_retry.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_define_temp_failure_retry.patch new file mode 100644 index 00000000000..61db658f849 --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_define_temp_failure_retry.patch @@ -0,0 +1,18 @@ +--- a/sandbox/linux/suid/sandbox.c 2019-11-19 09:28:05.000000000 +0800 ++++ b/sandbox/linux/suid/sandbox.c 2020-04-24 11:50:12.719880728 +0800 +@@ -42,6 +42,15 @@ + #define CLONE_NEWNET 0x40000000 + #endif + ++#ifndef TEMP_FAILURE_RETRY ++#define TEMP_FAILURE_RETRY(expression) \ ++ (__extension__ \ ++ ({ long int __result; \ ++ do __result = (long int) (expression); \ ++ while (__result == -1L && errno == EINTR); \ ++ __result; })) ++#endif ++ + static bool DropRoot(); + + #define HANDLE_EINTR(x) TEMP_FAILURE_RETRY(x) diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_dns.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_dns.patch new file mode 100644 index 00000000000..f49d8bd0afa --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_dns.patch @@ -0,0 +1,61 @@ +diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc +index 2f94832..2dd1a98 100644 +--- a/net/dns/dns_config_service_posix.cc ++++ b/net/dns/dns_config_service_posix.cc +@@ -150,7 +150,7 @@ ConfigParsePosixResult ReadDnsConfig(DnsConfig* dns_config) { + #if !defined(OS_ANDROID) + ConfigParsePosixResult result; + // TODO(fuchsia): Use res_ninit() when it's implemented on Fuchsia. +-#if defined(OS_OPENBSD) || defined(OS_FUCHSIA) ++#if defined(OS_OPENBSD) || defined(OS_FUCHSIA) || (defined(OS_LINUX) && !defined(__GLIBC__)) + // Note: res_ninit in glibc always returns 0 and sets RES_INIT. + // res_init behaves the same way. + memset(&_res, 0, sizeof(_res)); +@@ -173,7 +173,7 @@ ConfigParsePosixResult ReadDnsConfig(DnsConfig* dns_config) { + #else + res_nclose(&res); + #endif // defined(OS_MACOSX) || defined(OS_FREEBSD) +-#endif // defined(OS_OPENBSD) ++#endif // defined(OS_OPENBSD) || defined(OS_FUCHSIA) || (defined(OS_LINUX) && !defined(__GLIBC__)) + + #if defined(OS_MACOSX) && !defined(OS_IOS) + ConfigParsePosixResult error = DnsConfigWatcher::CheckDnsConfig(); +diff --git a/net/dns/dns_reloader.cc b/net/dns/dns_reloader.cc +index 952cff4..4b366f4 100644 +--- a/net/dns/dns_reloader.cc ++++ b/net/dns/dns_reloader.cc +@@ -4,7 +4,7 @@ + + #include "net/dns/dns_reloader.h" + +-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \ ++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \ + !defined(OS_ANDROID) && !defined(OS_FUCHSIA) + + #include +diff --git a/net/dns/host_resolver_manager.cc b/net/dns/host_resolver_manager.cc +index e8dea46..c86a830 100644 +--- a/net/dns/host_resolver_manager.cc ++++ b/net/dns/host_resolver_manager.cc +@@ -2386,7 +2386,7 @@ HostResolverManager::HostResolverManager( + NetworkChangeNotifier::AddConnectionTypeObserver(this); + if (system_dns_config_notifier_) + system_dns_config_notifier_->AddObserver(this); +-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \ ++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \ + !defined(OS_ANDROID) + EnsureDnsReloaderInit(); + #endif +diff --git a/net/dns/host_resolver_proc.cc b/net/dns/host_resolver_proc.cc +index 0824540..3384978 100644 +--- a/net/dns/host_resolver_proc.cc ++++ b/net/dns/host_resolver_proc.cc +@@ -197,7 +197,7 @@ int SystemHostResolverCall(const std::string& host, + base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, + base::BlockingType::WILL_BLOCK); + +-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \ ++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \ + !defined(OS_ANDROID) && !defined(OS_FUCHSIA) + DnsReloaderMaybeReload(); + #endif diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_exeinfo.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_exeinfo.patch new file mode 100644 index 00000000000..f1afc7c1b17 --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_exeinfo.patch @@ -0,0 +1,96 @@ +diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc +index de2f356..f697c66 100644 +--- a/base/debug/stack_trace_posix.cc ++++ b/base/debug/stack_trace_posix.cc +@@ -27,7 +27,7 @@ + #if !defined(USE_SYMBOLIZE) + #include + #endif +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX) + #include + #endif + +@@ -86,7 +86,7 @@ void DemangleSymbols(std::string* text) { + // Note: code in this function is NOT async-signal safe (std::string uses + // malloc internally). + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX) + std::string::size_type search_from = 0; + while (search_from < text->size()) { + // Look for the start of a mangled symbol, from search_from. +@@ -121,7 +121,7 @@ void DemangleSymbols(std::string* text) { + search_from = mangled_start + 2; + } + } +-#endif // !defined(__UCLIBC__) && !defined(_AIX) ++#endif // defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX) + } + #endif // !defined(USE_SYMBOLIZE) + +@@ -133,7 +133,7 @@ class BacktraceOutputHandler { + virtual ~BacktraceOutputHandler() = default; + }; + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX) + void OutputPointer(void* pointer, BacktraceOutputHandler* handler) { + // This should be more than enough to store a 64-bit number in hex: + // 16 hex digits + 1 for null-terminator. +@@ -216,7 +216,7 @@ void ProcessBacktrace(void* const* trace, + } + #endif // defined(USE_SYMBOLIZE) + } +-#endif // !defined(__UCLIBC__) && !defined(_AIX) ++#endif // defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX) + + void PrintToStderr(const char* output) { + // NOTE: This code MUST be async-signal safe (it's used by in-process +@@ -828,7 +828,7 @@ size_t CollectStackTrace(void** trace, size_t count) { + // NOTE: This code MUST be async-signal safe (it's used by in-process + // stack dumping signal handler). NO malloc or stdio is allowed here. + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX) + // 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)); +@@ -841,13 +841,13 @@ void StackTrace::PrintWithPrefix(const char* prefix_string) const { + // NOTE: This code MUST be async-signal safe (it's used by in-process + // stack dumping signal handler). NO malloc or stdio is allowed here. + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX) + PrintBacktraceOutputHandler handler; + ProcessBacktrace(trace_, count_, prefix_string, &handler); + #endif + } + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX) + void StackTrace::OutputToStreamWithPrefix(std::ostream* os, + const char* prefix_string) const { + StreamBacktraceOutputHandler handler(os); +diff --git a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h +index 798f150..97acc7c 100644 +--- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h ++++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h +@@ -14,7 +14,7 @@ + #define ENABLE_CRASH_OVERRIDES 1 + + /* Define to 1 if you have the `backtrace' function. */ +-#define HAVE_BACKTRACE 1 ++/* #undef HAVE_BACKTRACE */ + + /* Define to 1 if you have the header file. */ + /* #undef HAVE_CRASHREPORTERCLIENT_H */ +@@ -55,7 +55,7 @@ + #define HAVE_ERRNO_H 1 + + /* Define to 1 if you have the header file. */ +-#define HAVE_EXECINFO_H 1 ++/* #undef HAVE_EXECINFO_H */ + + /* Define to 1 if you have the header file. */ + #define HAVE_FCNTL_H 1 diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_fpstate_t.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_fpstate_t.patch new file mode 100644 index 00000000000..d8c41ccd9a0 --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_fpstate_t.patch @@ -0,0 +1,48 @@ +diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc +index 6ee6cc1..a8f9ccc 100644 +--- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc ++++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc +@@ -49,7 +49,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { + } + + void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, +- const struct _libc_fpstate* fp) { ++ const struct _fpstate* fp) { + const greg_t* regs = uc->uc_mcontext.gregs; + + out->context_flags = MD_CONTEXT_X86_FULL | +@@ -97,7 +97,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { + } + + void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, +- const struct _libc_fpstate* fpregs) { ++ const struct _fpstate* fpregs) { + const greg_t* regs = uc->uc_mcontext.gregs; + + out->context_flags = MD_CONTEXT_AMD64_FULL; +diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h +index f830618..f3dde1f 100644 +--- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h ++++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h +@@ -50,7 +50,7 @@ struct UContextReader { + // info: the collection of register structures. + #if defined(__i386__) || defined(__x86_64) + static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, +- const struct _libc_fpstate* fp); ++ const struct _fpstate* fp); + #elif defined(__aarch64__) + static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, + const struct fpsimd_context* fpregs); +diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h +index d1dc331..d1cc562 100644 +--- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h ++++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h +@@ -48,7 +48,7 @@ class ExceptionHandler; + #if defined(__aarch64__) + typedef struct fpsimd_context fpstate_t; + #elif !defined(__ARM_EABI__) && !defined(__mips__) +-typedef struct _libc_fpstate fpstate_t; ++typedef struct _fpstate fpstate_t; + #endif + + // These entries store a list of memory regions that the client wants included diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_getcontext.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_getcontext.patch new file mode 100644 index 00000000000..7697243a910 --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_getcontext.patch @@ -0,0 +1,25 @@ +diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc +index b895f6d..4f13352 100644 +--- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc ++++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc +@@ -490,7 +490,9 @@ bool ExceptionHandler::SimulateSignalDelivery(int sig) { + siginfo.si_code = SI_USER; + siginfo.si_pid = getpid(); + ucontext_t context; ++#if defined(__GLIBC__) + getcontext(&context); ++#endif + return HandleSignal(sig, &siginfo, &context); + } + +@@ -675,8 +677,10 @@ bool ExceptionHandler::WriteMinidump() { + sys_prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); + + CrashContext context; ++#if defined(__GLIBC__) + int getcontext_result = getcontext(&context.context); + if (getcontext_result) ++#endif + return false; + + #if defined(__i386__) diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_mallinfo.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_mallinfo.patch new file mode 100644 index 00000000000..941313e4939 --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_mallinfo.patch @@ -0,0 +1,61 @@ +diff --git a/base/process/process_metrics_posix.cc b/base/process/process_metrics_posix.cc +index 044bd8d..0521321 100644 +--- a/base/process/process_metrics_posix.cc ++++ b/base/process/process_metrics_posix.cc +@@ -110,14 +110,14 @@ size_t ProcessMetrics::GetMallocUsage() { + malloc_statistics_t stats = {0}; + malloc_zone_statistics(nullptr, &stats); + return stats.size_in_use; +-#elif defined(OS_LINUX) || defined(OS_ANDROID) ++#elif (defined(OS_LINUX) && defined(__GLIBC__)) || defined(OS_ANDROID) + struct mallinfo minfo = mallinfo(); + #if BUILDFLAG(USE_TCMALLOC) + return minfo.uordblks; + #else + return minfo.hblkhd + minfo.arena; + #endif +-#elif defined(OS_FUCHSIA) ++#else + // TODO(fuchsia): Not currently exposed. https://crbug.com/735087. + return 0; + #endif +diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc +index e89597c..eca258c 100644 +--- a/base/trace_event/malloc_dump_provider.cc ++++ b/base/trace_event/malloc_dump_provider.cc +@@ -132,7 +132,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, + } + #elif defined(OS_FUCHSIA) + // TODO(fuchsia): Port, see https://crbug.com/706592. +-#else ++#elif defined(OS_LINUX) && defined(__GLIBC__) + struct mallinfo info = mallinfo(); + DCHECK_GE(info.arena + info.hblkhd, info.uordblks); + +diff --git a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h +index aa98242..97acc7c 100644 +--- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h ++++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h +@@ -130,7 +130,7 @@ + /* #undef HAVE_MALLCTL */ + + /* Define to 1 if you have the `mallinfo' function. */ +-#define HAVE_MALLINFO 1 ++/* #undef HAVE_MALLINFO */ + + /* Define to 1 if you have the header file. */ + #define HAVE_MALLOC_H 1 +diff --git a/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h b/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h +index 6e17020..d4a9ed0 100644 +--- a/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h ++++ b/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h +@@ -122,7 +122,7 @@ + /* #undef HAVE_MALLCTL */ + + /* Define to 1 if you have the `mallinfo' function. */ +-#define HAVE_MALLINFO 1 ++/* #undef HAVE_MALLINFO */ + + /* Define to 1 if you have the header file. */ + #define HAVE_MALLOC_H 1 + diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_pread_pwrite64.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_pread_pwrite64.patch new file mode 100644 index 00000000000..2aeaaeb7593 --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_pread_pwrite64.patch @@ -0,0 +1,18 @@ +diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h +index 5d9c2e8..2682349 100644 +--- a/third_party/lss/linux_syscall_support.h ++++ b/third_party/lss/linux_syscall_support.h +@@ -166,6 +166,13 @@ extern "C" { + # undef __NR_waitpid + #endif + ++#ifdef pread64 ++#undef pread64 ++#endif ++#ifdef pwrite64 ++#undef pwrite64 ++#endif ++ + /* As glibc often provides subtly incompatible data structures (and implicit + * wrapper functions that convert them), we provide our own kernel data + * structures for use by the system calls. diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_push_back.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_push_back.patch new file mode 100644 index 00000000000..cff340287da --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_push_back.patch @@ -0,0 +1,13 @@ +diff --git a/net/socket/udp_socket_posix.cc b/net/socket/udp_socket_posix.cc +index 08bf79c..3ee5353 100644 +--- a/net/socket/udp_socket_posix.cc ++++ b/net/socket/udp_socket_posix.cc +@@ -1194,7 +1194,7 @@ SendResult UDPSocketPosixSender::InternalSendmmsgBuffers( + msg_iov->push_back({const_cast(buffer->data()), buffer->length()}); + msgvec->reserve(buffers.size()); + for (size_t j = 0; j < buffers.size(); j++) +- msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, nullptr, 0, 0}, 0}); ++ msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, 0, nullptr, 0, 0, 0}, 0}); + int result = HANDLE_EINTR(Sendmmsg(fd, &msgvec[0], buffers.size(), 0)); + SendResult send_result(0, 0, std::move(buffers)); + if (result < 0) { diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_stack_size.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_stack_size.patch new file mode 100644 index 00000000000..cf41d27ade6 --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_stack_size.patch @@ -0,0 +1,41 @@ +diff --git a/third_party/blink/renderer/platform/wtf/stack_util.cc b/third_party/blink/renderer/platform/wtf/stack_util.cc +index b242164..1a0b519 100644 +--- a/third_party/blink/renderer/platform/wtf/stack_util.cc ++++ b/third_party/blink/renderer/platform/wtf/stack_util.cc +@@ -28,7 +28,7 @@ + // FIXME: On Mac OSX and Linux, this method cannot estimate stack size + // correctly for the main thread. + +-#elif defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ ++#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ + defined(OS_FUCHSIA) + // pthread_getattr_np() can fail if the thread is not invoked by + // pthread_create() (e.g., the main thread of blink_unittests). +@@ -55,6 +55,9 @@ size_t GetUnderestimatedStackSize() { + pthread_attr_destroy(&attr); + #endif + ++#if defined(OS_LINUX) && !defined(__GLIBC__) ++ return 0; ++#else + // Return a 512k stack size, (conservatively) assuming the following: + // - that size is much lower than the pthreads default (x86 pthreads has a 2M + // default.) +@@ -62,6 +65,8 @@ size_t GetUnderestimatedStackSize() { + // low as 512k. + // + return 512 * 1024; ++#endif ++ + #elif defined(OS_MACOSX) + // pthread_get_stacksize_np() returns too low a value for the main thread on + // OSX 10.9, +@@ -97,7 +102,7 @@ return Threading::ThreadStackSize(); + } + + void* GetStackStart() { +-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ ++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ + defined(OS_FUCHSIA) + pthread_attr_t attr; + int error; diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_stack_trace.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_stack_trace.patch new file mode 100644 index 00000000000..9a1f2b04458 --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_stack_trace.patch @@ -0,0 +1,44 @@ +diff --git a/base/debug/stack_trace.cc b/base/debug/stack_trace.cc +index d8ca822..ffe1f08 100644 +--- a/base/debug/stack_trace.cc ++++ b/base/debug/stack_trace.cc +@@ -225,7 +225,9 @@ void StackTrace::Print() const { + } + + void StackTrace::OutputToStream(std::ostream* os) const { ++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX) + OutputToStreamWithPrefix(os, nullptr); ++#endif + } + + std::string StackTrace::ToString() const { +@@ -233,14 +233,14 @@ std::string StackTrace::ToString() const { + } + std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const { + std::stringstream stream; +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX) + OutputToStreamWithPrefix(&stream, prefix_string); + #endif + return stream.str(); + } + + std::ostream& operator<<(std::ostream& os, const StackTrace& s) { +-#if !defined(__UCLIBC__) & !defined(_AIX) ++#if defined(__GLIBC__) && !defined(__UCLIBC__) & !defined(_AIX) + s.OutputToStream(&os); + #else + os << "StackTrace::OutputToStream not implemented."; +diff --git a/base/logging.cc b/base/logging.cc +index 36b8bfc..dd830fe 100644 +--- a/base/logging.cc ++++ b/base/logging.cc +@@ -607,7 +607,7 @@ LogMessage::LogMessage(const char* file, int line, LogSeverity severity, + LogMessage::~LogMessage() { + size_t stack_start = stream_.tellp(); + #if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) && \ +- !defined(OS_AIX) ++ !defined(OS_AIX) && defined(__GLIBC__) + if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) { + // Include a stack trace on a fatal, unless a debugger is attached. + base::debug::StackTrace stack_trace; diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_tcp_listen.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_tcp_listen.patch new file mode 100644 index 00000000000..fa62317b11a --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_tcp_listen.patch @@ -0,0 +1,14 @@ +diff --git a/content/public/common/socket_permission_request.h b/content/public/common/socket_permission_request.h +index 7316621..6171219 100644 +--- a/content/public/common/socket_permission_request.h ++++ b/content/public/common/socket_permission_request.h +@@ -9,6 +9,9 @@ + + #include + ++#ifdef TCP_LISTEN ++#undef TCP_LISTEN ++#endif + + namespace content { + diff --git a/srcpkgs/electron9/files/musl-patches/chromium-musl_wordsize.patch b/srcpkgs/electron9/files/musl-patches/chromium-musl_wordsize.patch new file mode 100644 index 00000000000..6208cffafbe --- /dev/null +++ b/srcpkgs/electron9/files/musl-patches/chromium-musl_wordsize.patch @@ -0,0 +1,24 @@ +diff --git a/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h b/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h +index d03c7a8..78ca9dd 100644 +--- a/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h ++++ b/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + + #include "common/memory_range.h" + +@@ -51,9 +52,9 @@ class ElfCoreDump { + typedef ElfW(Phdr) Phdr; + typedef ElfW(Word) Word; + typedef ElfW(Addr) Addr; +-#if __WORDSIZE == 32 ++#if ULONG_MAX == 0xffffffff + static const int kClass = ELFCLASS32; +-#elif __WORDSIZE == 64 ++#elif ULONG_MAX == 0xffffffffffffffff + static const int kClass = ELFCLASS64; + #else + #error "Unsupported __WORDSIZE for ElfCoreDump." diff --git a/srcpkgs/electron9/files/patches/chromium-83-gcc-10.patch b/srcpkgs/electron9/files/patches/chromium-83-gcc-10.patch new file mode 100644 index 00000000000..974b49cde70 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-83-gcc-10.patch @@ -0,0 +1,64 @@ +From e473f41284ccc8fa4bc4622d087194b18a1ec23a Mon Sep 17 00:00:00 2001 +From: Stephan Hartmann +Date: Tue, 7 Apr 2020 16:37:10 +0000 +Subject: [PATCH] GCC: fix includes for gcc-10 + +--- + chrome/browser/search/background/ntp_backgrounds.h | 1 + + third_party/webrtc/call/rtx_receive_stream.h | 1 + + .../webrtc/modules/audio_processing/aec3/clockdrift_detector.h | 1 + + ui/gfx/linux/drm_util_linux.h | 2 ++ + 5 files changed, 6 insertions(+) + +diff --git a/chrome/browser/search/background/ntp_backgrounds.h b/chrome/browser/search/background/ntp_backgrounds.h +index 7afc0a2..ea5818e 100644 +--- a/chrome/browser/search/background/ntp_backgrounds.h ++++ b/chrome/browser/search/background/ntp_backgrounds.h +@@ -6,6 +6,7 @@ + #define CHROME_BROWSER_SEARCH_BACKGROUND_NTP_BACKGROUNDS_H_ + + #include ++#include + + class GURL; + +diff --git a/third_party/webrtc/call/rtx_receive_stream.h b/third_party/webrtc/call/rtx_receive_stream.h +index 8ffa440..113a816 100644 +--- a/third_party/webrtc/call/rtx_receive_stream.h ++++ b/third_party/webrtc/call/rtx_receive_stream.h +@@ -12,6 +12,7 @@ + #define CALL_RTX_RECEIVE_STREAM_H_ + + #include ++#include + + #include "call/rtp_packet_sink_interface.h" + +diff --git a/third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h b/third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h +index 22528c9..69e624e 100644 +--- a/third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h ++++ b/third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h +@@ -12,6 +12,7 @@ + #define MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_ + + #include ++#include + + namespace webrtc { + +diff --git a/ui/gfx/linux/drm_util_linux.h b/ui/gfx/linux/drm_util_linux.h +index 86ff2eb..990f12c 100644 +--- a/ui/gfx/linux/drm_util_linux.h ++++ b/ui/gfx/linux/drm_util_linux.h +@@ -7,6 +7,8 @@ + + #include "ui/gfx/buffer_types.h" + ++#include ++ + namespace ui { + + int GetFourCCFormatFromBufferFormat(gfx::BufferFormat format); +-- +2.24.1 + diff --git a/srcpkgs/electron9/files/patches/chromium-add-missing-algorithm-header-in-crx_install_error.cc.patch b/srcpkgs/electron9/files/patches/chromium-add-missing-algorithm-header-in-crx_install_error.cc.patch new file mode 100644 index 00000000000..570f7b31953 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-add-missing-algorithm-header-in-crx_install_error.cc.patch @@ -0,0 +1,29 @@ +From 2b9d6daa0ab5ce45ec5555466d5a5a583a020ea8 Mon Sep 17 00:00:00 2001 +From: Daniel Playfair Cal +Date: Sat, 18 Apr 2020 00:27:38 +0000 +Subject: [PATCH] Add missing algorithm header in crx_install_error.cc + +This is needed for the use of std::find. + +Change-Id: I2dc43b3887c467986c5346be5a9e27a987e1e5b3 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2152333 +Reviewed-by: Ken Rockot +Commit-Queue: Ken Rockot +Cr-Commit-Position: refs/heads/master@{#760272} +--- + extensions/browser/install/crx_install_error.cc | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/extensions/browser/install/crx_install_error.cc b/extensions/browser/install/crx_install_error.cc +index a9765bb0a5a..bd0d3e35a16 100644 +--- a/extensions/browser/install/crx_install_error.cc ++++ b/extensions/browser/install/crx_install_error.cc +@@ -4,6 +4,8 @@ + + #include "extensions/browser/install/crx_install_error.h" + ++#include ++ + #include "base/logging.h" + #include "extensions/browser/install/sandboxed_unpacker_failure_reason.h" + diff --git a/srcpkgs/electron9/files/patches/chromium-avoid-double-destruction-of-ServiceWorkerObjectHost.patch b/srcpkgs/electron9/files/patches/chromium-avoid-double-destruction-of-ServiceWorkerObjectHost.patch new file mode 100644 index 00000000000..5e1df005c96 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-avoid-double-destruction-of-ServiceWorkerObjectHost.patch @@ -0,0 +1,138 @@ +From bd59ce32629ef684624821419c43967b73d2989e Mon Sep 17 00:00:00 2001 +From: Hiroki Nakagawa +Date: Fri, 8 May 2020 08:25:31 +0000 +Subject: [PATCH] ServiceWorker: Avoid double destruction of + ServiceWorkerObjectHost on connection error + +This CL avoids the case where ServiceWorkerObjectHost is destroyed twice +on ServiceWorkerObjectHost::OnConnectionError() when Chromium is built +with the GCC build toolchain. + +> How does the issue happen? + +ServiceWorkerObjectHost has a cyclic reference like this: + +ServiceWorkerObjectHost + --([1] scoped_refptr)--> ServiceWorkerVersion + --([2] std::unique_ptr)--> ServiceWorkerProviderHost + --([3] std::unique_ptr)--> ServiceWorkerContainerHost + --([4] std::unique_ptr)--> ServiceWorkerObjectHost + +Note that ServiceWorkerContainerHost manages ServiceWorkerObjectHost in +map>. + +When ServiceWorkerObjectHost::OnConnectionError() is called, the +function removes the reference [4] from the map, and destroys +ServiceWorkerObjectHost. If the object host has the last reference [1] +to ServiceWorkerVersion, the destruction also cuts off the references +[2] and [3], and destroys ServiceWorkerProviderHost and +ServiceWorkerContainerHost. + +This seems to work well on the Chromium's default toolchain, but not +work on the GCC toolchain. According to the report, destruction of +ServiceWorkerContainerHost happens while the map owned by the container +host is erasing the ServiceWorkerObjectHost, and this results in crash +due to double destruction of the object host. + +I don't know the reason why this happens only on the GCC toolchain, but +I suspect the order of object destruction on std::map::erase() could be +different depending on the toolchains. + +> How does this CL fix this? + +The ideal fix is to redesign the ownership model of +ServiceWorkerVersion, but it's not feasible in the short term. + +Instead, this CL avoids destruction of ServiceWorkerObjectHost on +std::map::erase(). The new code takes the ownership of the object host +from the map first, and then erases the entry from the map. This +separates timings to erase the map entry and to destroy the object host, +so the crash should no longer happen. + +Bug: 1056598 +Change-Id: Id30654cb575bc557c42044d6f0c6f1f9bfaed613 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094496 +Reviewed-by: Makoto Shimazu +Commit-Queue: Hiroki Nakagawa +Cr-Commit-Position: refs/heads/master@{#766770} +--- + .../service_worker_container_host.cc | 10 +++++ + .../service_worker_object_host_unittest.cc | 38 +++++++++++++++++++ + 2 files changed, 48 insertions(+) + +diff --git a/content/browser/service_worker/service_worker_container_host.cc b/content/browser/service_worker/service_worker_container_host.cc +index ec7fb1449af..98c62093b0e 100644 +--- a/content/browser/service_worker/service_worker_container_host.cc ++++ b/content/browser/service_worker/service_worker_container_host.cc +@@ -669,6 +669,16 @@ void ServiceWorkerContainerHost::RemoveServiceWorkerObjectHost( + int64_t version_id) { + DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId()); + DCHECK(base::Contains(service_worker_object_hosts_, version_id)); ++ ++ // ServiceWorkerObjectHost to be deleted may have the last reference to ++ // ServiceWorkerVersion that indirectly owns this ServiceWorkerContainerHost. ++ // If we erase the object host directly from the map, |this| could be deleted ++ // during the map operation and may crash. To avoid the case, we take the ++ // ownership of the object host from the map first, and then erase the entry ++ // from the map. See https://crbug.com/1056598 for details. ++ std::unique_ptr to_be_deleted = ++ std::move(service_worker_object_hosts_[version_id]); ++ DCHECK(to_be_deleted); + service_worker_object_hosts_.erase(version_id); + } + +diff --git a/content/browser/service_worker/service_worker_object_host_unittest.cc b/content/browser/service_worker/service_worker_object_host_unittest.cc +index 408d7c1f9d1..6eab59040ab 100644 +--- a/content/browser/service_worker/service_worker_object_host_unittest.cc ++++ b/content/browser/service_worker/service_worker_object_host_unittest.cc +@@ -200,6 +200,19 @@ class ServiceWorkerObjectHostTest : public testing::Test { + return registration_info; + } + ++ void CallOnConnectionError(ServiceWorkerContainerHost* container_host, ++ int64_t version_id) { ++ // ServiceWorkerObjectHost has the last reference to the version. ++ ServiceWorkerObjectHost* object_host = ++ GetServiceWorkerObjectHost(container_host, version_id); ++ EXPECT_TRUE(object_host->version_->HasOneRef()); ++ ++ // Make sure that OnConnectionError induces destruction of the version and ++ // the object host. ++ object_host->receivers_.Clear(); ++ object_host->OnConnectionError(); ++ } ++ + BrowserTaskEnvironment task_environment_; + std::unique_ptr helper_; + scoped_refptr registration_; +@@ -409,5 +422,30 @@ TEST_F(ServiceWorkerObjectHostTest, DispatchExtendableMessageEvent_FromClient) { + events[0]->source_info_for_client->client_type); + } + ++// This is a regression test for https://crbug.com/1056598. ++TEST_F(ServiceWorkerObjectHostTest, OnConnectionError) { ++ const GURL scope("https://www.example.com/"); ++ const GURL script_url("https://www.example.com/service_worker.js"); ++ Initialize(std::make_unique(base::FilePath())); ++ SetUpRegistration(scope, script_url); ++ ++ // Create the provider host. ++ ASSERT_EQ(blink::ServiceWorkerStatusCode::kOk, ++ StartServiceWorker(version_.get())); ++ ++ // Set up the case where the last reference to the version is owned by the ++ // service worker object host. ++ ServiceWorkerContainerHost* container_host = ++ version_->provider_host()->container_host(); ++ ServiceWorkerVersion* version_rawptr = version_.get(); ++ version_ = nullptr; ++ ASSERT_TRUE(version_rawptr->HasOneRef()); ++ ++ // Simulate the connection error that induces the object host destruction. ++ // This shouldn't crash. ++ CallOnConnectionError(container_host, version_rawptr->version_id()); ++ base::RunLoop().RunUntilIdle(); ++} ++ + } // namespace service_worker_object_host_unittest + } // namespace content diff --git a/srcpkgs/electron9/files/patches/chromium-chromium_atk_optional.patch.patch b/srcpkgs/electron9/files/patches/chromium-chromium_atk_optional.patch.patch new file mode 100644 index 00000000000..667b4a7a00c --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-chromium_atk_optional.patch.patch @@ -0,0 +1,15 @@ +--- a/build/config/ui.gni 2020-06-25 00:39:28.000000000 +0200 ++++ - 2020-08-22 18:01:01.182749726 +0200 +@@ -47,8 +47,10 @@ + # Make sure glib is not used if building for ChromeOS/Chromecast + assert(!use_glib || (is_linux && !is_chromeos && !is_chromecast)) + +-# Whether to use atk, the Accessibility ToolKit library +-use_atk = is_desktop_linux && !is_chromecast && use_glib ++declare_args() { ++ # Whether to use atk, the Accessibility ToolKit library ++ use_atk = is_desktop_linux && !is_chromecast && use_glib ++} + # ============================================= + # PLEASE DO NOT ADD MORE FLAGS TO THIS FILE + # ============================================= diff --git a/srcpkgs/electron9/files/patches/chromium-clean-up-a-call-to-set_utf8.patch b/srcpkgs/electron9/files/patches/chromium-clean-up-a-call-to-set_utf8.patch new file mode 100644 index 00000000000..01384c03941 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-clean-up-a-call-to-set_utf8.patch @@ -0,0 +1,34 @@ +From ede390a0b18e4565abf8ac1e1ff717e1d43fc320 Mon Sep 17 00:00:00 2001 +From: Paul Wankadia +Date: Tue, 14 Apr 2020 16:54:51 +0000 +Subject: [PATCH] Clean up a call to set_utf8(). + +This is part of an effort to rewrite calls to utf8() and set_utf8() +(in RE2::Options) as calls to encoding() and set_encoding(), +respectively. utf8() and set_utf8() have been marked as the "legacy" +interface since 2008, so it is long past time that we get rid of them. + +R=parastoog@google.com + +Change-Id: I62c48cd575a55b519d5264ed857f927c163068b2 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2145261 +Reviewed-by: Parastoo Geranmayeh +Commit-Queue: Paul Wankadia +Cr-Commit-Position: refs/heads/master@{#758886} +--- + components/autofill/core/browser/address_rewriter.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/components/autofill/core/browser/address_rewriter.cc b/components/autofill/core/browser/address_rewriter.cc +index 1b85a50974c..030a5aba146 100644 +--- a/components/autofill/core/browser/address_rewriter.cc ++++ b/components/autofill/core/browser/address_rewriter.cc +@@ -57,7 +57,7 @@ void CompileRulesFromData(const std::string& data_string, + CompiledRuleVector* compiled_rules) { + base::StringPiece data = data_string; + re2::RE2::Options options; +- options.set_utf8(true); ++ options.set_encoding(RE2::Options::EncodingUTF8); + options.set_word_boundary(true); + + size_t token_end = 0; diff --git a/srcpkgs/electron9/files/patches/chromium-ffmpeg-4.3.patch b/srcpkgs/electron9/files/patches/chromium-ffmpeg-4.3.patch new file mode 100644 index 00000000000..6abb886ab99 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-ffmpeg-4.3.patch @@ -0,0 +1,21 @@ +diff --git a/media/base/media.cc b/media/base/media.cc +index c282ee49a03..a298b40c79b 100644 +--- a/media/base/media.cc ++++ b/media/base/media.cc +@@ -14,6 +14,7 @@ + #include "third_party/libyuv/include/libyuv.h" + + #if BUILDFLAG(ENABLE_FFMPEG) ++#include + #include "third_party/ffmpeg/ffmpeg_features.h" // nogncheck + extern "C" { + #include +@@ -41,7 +42,7 @@ class MediaInitializer { + + #if BUILDFLAG(USE_ALLOCATOR_SHIM) + // Remove allocation limit from ffmpeg, so calls go down to shim layer. +- av_max_alloc(0); ++ av_max_alloc(std::numeric_limits::max()); + #endif // BUILDFLAG(USE_ALLOCATOR_SHIM) + + #endif // BUILDFLAG(ENABLE_FFMPEG) diff --git a/srcpkgs/electron9/files/patches/chromium-fix-template-specialization-01.patch b/srcpkgs/electron9/files/patches/chromium-fix-template-specialization-01.patch new file mode 100644 index 00000000000..8562f7da82c --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-fix-template-specialization-01.patch @@ -0,0 +1,64 @@ +GCC: fix template specialization in WTF::VectorMover + +GCC complains that explicit specialization in non-namespace scope +is happening for MoveOverlappingImpl. However, secialization is +not really necessary here with templates and can be moved +into MoveOverlappingImpl method without changing generated code. + +Bug: 819294 +Change-Id: I90b893b9701748302f7b900fbcc2c341685fe0d3 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2126290 +Reviewed-by: Kent Tamura +Commit-Queue: Kent Tamura +Cr-Commit-Position: refs/heads/master@{#756880} + +diff --git a/third_party/blink/renderer/platform/wtf/vector.h b/third_party/blink/renderer/platform/wtf/vector.h +index 632d308..82aaf96 100644 +--- a/third_party/blink/renderer/platform/wtf/vector.h ++++ b/third_party/blink/renderer/platform/wtf/vector.h +@@ -205,30 +205,23 @@ + } + } + +- template +- static void MoveOverlappingImpl(const T* src, const T* src_end, T* dst); +- template <> +- static void MoveOverlappingImpl(const T* src, +- const T* src_end, +- T* dst) { +- memmove(dst, src, +- reinterpret_cast(src_end) - +- reinterpret_cast(src)); +- } +- template <> +- static void MoveOverlappingImpl(const T* src, +- const T* src_end, +- T* dst) { +- if (src == dst) +- return; +- if (dst < src) { +- for (; src < src_end; ++src, ++dst) +- AtomicWriteMemcpy(dst, src); ++ static void MoveOverlappingImpl(const T* src, const T* src_end, T* dst) { ++ if (Allocator::kIsGarbageCollected) { ++ if (src == dst) ++ return; ++ if (dst < src) { ++ for (; src < src_end; ++src, ++dst) ++ AtomicWriteMemcpy(dst, src); ++ } else { ++ --src_end; ++ T* dst_end = dst + (src_end - src); ++ for (; src_end >= src; --src_end, --dst_end) ++ AtomicWriteMemcpy(dst_end, src_end); ++ } + } else { +- --src_end; +- T* dst_end = dst + (src_end - src); +- for (; src_end >= src; --src_end, --dst_end) +- AtomicWriteMemcpy(dst_end, src_end); ++ memmove(dst, src, ++ reinterpret_cast(src_end) - ++ reinterpret_cast(src)); + } + } diff --git a/srcpkgs/electron9/files/patches/chromium-gcc-CrossVariantMojoAssociatedReceiver.patch b/srcpkgs/electron9/files/patches/chromium-gcc-CrossVariantMojoAssociatedReceiver.patch new file mode 100644 index 00000000000..86eb951300c --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-gcc-CrossVariantMojoAssociatedReceiver.patch @@ -0,0 +1,56 @@ +From f92da6993e45b28a7e0c82b1aed89aae95f72931 Mon Sep 17 00:00:00 2001 +From: Jose Dapena Paz +Date: Wed, 17 Jun 2020 22:57:35 +0000 +Subject: [PATCH] GCC: remove noexcept declaration in CrossVariantMojoAssociatedReceive/Remote + +It breaks compilation of blink::WebServiceRegistrationObjectInfo that includes +WebServiceWorkerObjectInfo instance. This one uses default move constructor +without noexcept declaration, but has as members CrossVariantMojoAssociatedReceive +and CrossVariantMojoAssociatedRemote with noexcept declaration in move constructor. +declared noexcept. + +As resolved in other places, noexcept is not really much useful with -fno-exception +and our codebase is not prepare to add it consistently. Clang will not report +exception declaration incompatibilities in case -fno-exception is used, but GCC +fails. + +Bug: 819294 +Change-Id: Id5c46c271a8a92352d769de9c3c263d3dce4c9c7 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2247791 +Commit-Queue: Dave Tapuska +Reviewed-by: Dave Tapuska +Cr-Commit-Position: refs/heads/master@{#779526} +--- + +diff --git a/third_party/blink/public/platform/cross_variant_mojo_util.h b/third_party/blink/public/platform/cross_variant_mojo_util.h +index 92c69ce..9945e00 100644 +--- a/third_party/blink/public/platform/cross_variant_mojo_util.h ++++ b/third_party/blink/public/platform/cross_variant_mojo_util.h +@@ -131,10 +131,10 @@ + CrossVariantMojoAssociatedReceiver() = default; + ~CrossVariantMojoAssociatedReceiver() = default; + +- CrossVariantMojoAssociatedReceiver( +- CrossVariantMojoAssociatedReceiver&&) noexcept = default; ++ CrossVariantMojoAssociatedReceiver(CrossVariantMojoAssociatedReceiver&&) = ++ default; + CrossVariantMojoAssociatedReceiver& operator=( +- CrossVariantMojoAssociatedReceiver&&) noexcept = default; ++ CrossVariantMojoAssociatedReceiver&&) = default; + + CrossVariantMojoAssociatedReceiver( + const CrossVariantMojoAssociatedReceiver&) = delete; +@@ -166,10 +166,10 @@ + CrossVariantMojoAssociatedRemote() = default; + ~CrossVariantMojoAssociatedRemote() = default; + +- CrossVariantMojoAssociatedRemote( +- CrossVariantMojoAssociatedRemote&&) noexcept = default; ++ CrossVariantMojoAssociatedRemote(CrossVariantMojoAssociatedRemote&&) = ++ default; + CrossVariantMojoAssociatedRemote& operator=( +- CrossVariantMojoAssociatedRemote&&) noexcept = default; ++ CrossVariantMojoAssociatedRemote&&) = default; + + CrossVariantMojoAssociatedRemote(const CrossVariantMojoAssociatedRemote&) = + delete; diff --git a/srcpkgs/electron9/files/patches/chromium-gcc-aarch64-zlib-crc-01.patch b/srcpkgs/electron9/files/patches/chromium-gcc-aarch64-zlib-crc-01.patch new file mode 100644 index 00000000000..2d6587d37b7 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-gcc-aarch64-zlib-crc-01.patch @@ -0,0 +1,131 @@ +[zlib] Make insert string a little less #ifdef-ie + +Remove one level of #ifdef indent to make that part of the code easier +to read. Change the accelerated routine name to end in _simd as is our +way elsewhere in chromium zlib. + +Minor: adjust the comments around the performance claims, and move the +important comments re CHROMIUM_ZLIB_NO_CASTAGNOLI into that block. + +Bug: 1032721 +Change-Id: Icb4044f3b87277d67f0ff004ac70813af0a91f5b +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2148893 +Reviewed-by: Chris Blume +Reviewed-by: Adenilson Cavalcanti +Commit-Queue: Noel Gordon +Cr-Commit-Position: refs/heads/master@{#760408} + +diff --git a/third_party/zlib/contrib/optimizations/insert_string.h b/third_party/zlib/contrib/optimizations/insert_string.h +index 1826601..d3bc33c 100644 +--- a/third_party/zlib/contrib/optimizations/insert_string.h ++++ b/third_party/zlib/contrib/optimizations/insert_string.h + +@@ -4,45 +4,47 @@ + * Use of this source code is governed by a BSD-style license that can be + * found in the Chromium source repository LICENSE file. + */ +-#ifdef _MSC_VER ++ ++#if defined(_MSC_VER) + #define INLINE __inline + #else + #define INLINE inline + #endif + + #include "cpu_features.h" +-/* Optimized insert_string block */ +-#if defined(CRC32_SIMD_SSE42_PCLMUL) || defined(CRC32_ARMV8_CRC32) +-#define TARGET_CPU_WITH_CRC ++ + // clang-format off + #if defined(CRC32_SIMD_SSE42_PCLMUL) +- /* Required to make MSVC bot build pass. */ +- #include +- #if defined(__GNUC__) || defined(__clang__) +- #undef TARGET_CPU_WITH_CRC ++ #include /* Required to make MSVC bot build pass. */ ++ ++ #if defined(__clang__) || defined(__GNUC__) + #define TARGET_CPU_WITH_CRC __attribute__((target("sse4.2"))) ++ #else ++ #define TARGET_CPU_WITH_CRC + #endif + + #define _cpu_crc32_u32 _mm_crc32_u32 + + #elif defined(CRC32_ARMV8_CRC32) + #if defined(__clang__) +- #undef TARGET_CPU_WITH_CRC + #define __crc32cw __builtin_arm_crc32cw + #endif + +- #define _cpu_crc32_u32 __crc32cw +- + #if defined(__aarch64__) + #define TARGET_CPU_WITH_CRC __attribute__((target("crc"))) + #else // !defined(__aarch64__) + #define TARGET_CPU_WITH_CRC __attribute__((target("armv8-a,crc"))) + #endif // defined(__aarch64__) ++ ++ #define _cpu_crc32_u32 __crc32cw ++ + #endif + // clang-format on ++ ++#if defined(TARGET_CPU_WITH_CRC) ++ + TARGET_CPU_WITH_CRC +-local INLINE Pos insert_string_optimized(deflate_state* const s, +- const Pos str) { ++local INLINE Pos insert_string_simd(deflate_state* const s, const Pos str) { + Pos ret; + unsigned *ip, val, h = 0; + +@@ -64,7 +66,8 @@ + s->prev[str & s->w_mask] = ret; + return ret; + } +-#endif /* Optimized insert_string block */ ++ ++#endif // TARGET_CPU_WITH_CRC + + /* =========================================================================== + * Update a hash value with the given input byte +@@ -99,24 +102,22 @@ + } + + local INLINE Pos insert_string(deflate_state* const s, const Pos str) { +-/* String dictionary insertion: faster symbol hashing has a positive impact +- * on data compression speeds (around 20% on Intel and 36% on Arm Cortex big +- * cores). +- * A misfeature is that the generated compressed output will differ from +- * vanilla zlib (even though it is still valid 'DEFLATE-d' content). ++/* insert_string_simd string dictionary insertion: this SIMD symbol hashing ++ * significantly improves data compression speed. + * +- * We offer here a way to disable the optimization if there is the expectation +- * that compressed content should match when compared to vanilla zlib. ++ * Note: the generated compressed output is a valid DEFLATE stream but will ++ * differ from vanilla zlib output ... + */ +-#if !defined(CHROMIUM_ZLIB_NO_CASTAGNOLI) +- /* TODO(cavalcantii): unify CPU features code. */ +-#if defined(CRC32_ARMV8_CRC32) +- if (arm_cpu_enable_crc32) +- return insert_string_optimized(s, str); +-#elif defined(CRC32_SIMD_SSE42_PCLMUL) ++#if defined(CHROMIUM_ZLIB_NO_CASTAGNOLI) ++/* ... so this build-time option can used to disable the SIMD symbol hasher ++ * if matching vanilla zlib DEFLATE output is required. ++ */ (;) /* FALLTHOUGH */ ++#elif defined(TARGET_CPU_WITH_CRC) && defined(CRC32_SIMD_SSE42_PCLMUL) + if (x86_cpu_enable_simd) +- return insert_string_optimized(s, str); +-#endif ++ return insert_string_simd(s, str); ++#elif defined(TARGET_CPU_WITH_CRC) && defined(CRC32_ARMV8_CRC32) ++ if (arm_cpu_enable_crc32) ++ return insert_string_simd(s, str); + #endif + return insert_string_c(s, str); + } diff --git a/srcpkgs/electron9/files/patches/chromium-gcc-aarch64-zlib-crc-02.patch b/srcpkgs/electron9/files/patches/chromium-gcc-aarch64-zlib-crc-02.patch new file mode 100644 index 00000000000..62968dc7cd6 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-gcc-aarch64-zlib-crc-02.patch @@ -0,0 +1,35 @@ +Define crc32 intrinsic builtin for gcc + +This will fix the build for gcc@aarch64, enabling building V8 +with gcc for aarch64. + +Bug: 1066302 +Change-Id: I4818d6384553a877f6c1c240b7f0c66c8db69b1e +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315440 +Reviewed-by: Mike Klein +Reviewed-by: Adenilson Cavalcanti +Commit-Queue: Adenilson Cavalcanti +Cr-Commit-Position: refs/heads/master@{#792504} + +diff --git a/third_party/zlib/contrib/optimizations/insert_string.h b/third_party/zlib/contrib/optimizations/insert_string.h +index d3bc33c..9f634ae 100644 +--- a/third_party/zlib/contrib/optimizations/insert_string.h ++++ b/third_party/zlib/contrib/optimizations/insert_string.h + +@@ -28,11 +28,15 @@ + #elif defined(CRC32_ARMV8_CRC32) + #if defined(__clang__) + #define __crc32cw __builtin_arm_crc32cw ++ #elif defined(__GNUC__) ++ #define __crc32cw __builtin_aarch64_crc32cw + #endif + +- #if defined(__aarch64__) ++ #if defined(__aarch64__) && defined(__clang__) + #define TARGET_CPU_WITH_CRC __attribute__((target("crc"))) +- #else // !defined(__aarch64__) ++ #elif defined(__aarch64__) && defined(__GNUC__) ++ #define TARGET_CPU_WITH_CRC __attribute__((target("+crc"))) ++ #elif defined(__clang__) // !defined(__aarch64__) + #define TARGET_CPU_WITH_CRC __attribute__((target("armv8-a,crc"))) + #endif // defined(__aarch64__) diff --git a/srcpkgs/electron9/files/patches/chromium-gcc-move-assignement-operators-noexcept.patch b/srcpkgs/electron9/files/patches/chromium-gcc-move-assignement-operators-noexcept.patch new file mode 100644 index 00000000000..56918cdf378 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-gcc-move-assignement-operators-noexcept.patch @@ -0,0 +1,66 @@ +From 911bdcd8cc5475be4ec4228cfbc85fc38f52857e Mon Sep 17 00:00:00 2001 +From: Stephan Hartmann +Date: Wed, 27 May 2020 10:00:41 +0000 +Subject: [PATCH] GCC: make base::{flat_map,flat_tree} move assignement operators noexcept + +Move assigment operator in ui::ColorSet is noexcept. Because this +class has a member of type base::flat_map, move assignment operators +of base::flat_map and base::flat_tree must be noexcept too. +base::flat_tree noexcept is conditional to avoid build failure with +NaCl. + +Otherwise GCC fails like this: + +../../ui/color/color_set.cc:14:11: error: function +'ui::ColorSet& ui::ColorSet::operator=(ui::ColorSet&&)' defaulted on its +redeclaration with an exception-specification that differs from the +implicit exception-specification '' + 14 | ColorSet& ColorSet::operator=(ColorSet&&) noexcept = default; + | ^~~~~~~~ + +Bug: 819294 +Change-Id: I10ce31851effc9ce78f2b5cbbb7148c339f065a7 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2179245 +Commit-Queue: Jan Wilken Dörrie +Reviewed-by: Daniel Cheng +Cr-Commit-Position: refs/heads/master@{#772175} +--- + +diff --git a/base/containers/flat_map.h b/base/containers/flat_map.h +index ed82c5d..1af6b40 100644 +--- a/base/containers/flat_map.h ++++ b/base/containers/flat_map.h +@@ -202,7 +202,7 @@ + ~flat_map() = default; + + flat_map& operator=(const flat_map&) = default; +- flat_map& operator=(flat_map&&) = default; ++ flat_map& operator=(flat_map&&) noexcept = default; + // Takes the first if there are duplicates in the initializer list. + flat_map& operator=(std::initializer_list ilist); + +diff --git a/base/containers/flat_tree.h b/base/containers/flat_tree.h +index 9412ff6..ce6e92b 100644 +--- a/base/containers/flat_tree.h ++++ b/base/containers/flat_tree.h +@@ -125,7 +125,8 @@ + // Assume that move assignment invalidates iterators and references. + + flat_tree& operator=(const flat_tree&); +- flat_tree& operator=(flat_tree&&); ++ flat_tree& operator=(flat_tree&&) noexcept( ++ std::is_nothrow_move_assignable::value); + // Takes the first if there are duplicates in the initializer list. + flat_tree& operator=(std::initializer_list ilist); + +@@ -518,7 +519,9 @@ + const flat_tree&) -> flat_tree& = default; + + template +-auto flat_tree::operator=(flat_tree &&) ++auto flat_tree:: ++operator=(flat_tree&&) noexcept( ++ std::is_nothrow_move_assignable::value) + -> flat_tree& = default; + + template diff --git a/srcpkgs/electron9/files/patches/chromium-gcc-shared.patch b/srcpkgs/electron9/files/patches/chromium-gcc-shared.patch new file mode 100644 index 00000000000..098b6832242 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-gcc-shared.patch @@ -0,0 +1,20 @@ +--- a/build/toolchain/gcc_toolchain.gni 2019-11-19 02:27:43.000000000 +0100 ++++ - 2020-07-21 00:59:09.201421469 +0200 +@@ -371,7 +371,7 @@ + # .TOC file, overwrite it, otherwise, don't change it. + tocfile = sofile + ".TOC" + +- link_command = "$ld -shared -Wl,-soname=\"$soname\" {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" @\"$rspfile\"" ++ link_command = "$ld -shared -Wl,-soname=\"$soname\" {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" -shared @\"$rspfile\"" + + # Generate a map file to be used for binary size analysis. + # Map file adds ~10% to the link time on a z620. +@@ -450,7 +450,7 @@ + unstripped_sofile = sofile + } + +- command = "$ld -shared {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" -Wl,-soname=\"$soname\" @\"$rspfile\"" ++ command = "$ld -shared {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" -Wl,-soname=\"$soname\" -shared @\"$rspfile\"" + + if (defined(invoker.strip)) { + strip_command = "${invoker.strip} -o \"$sofile\" \"$unstripped_sofile\"" diff --git a/srcpkgs/electron9/files/patches/chromium-gcc-webui-template.patch b/srcpkgs/electron9/files/patches/chromium-gcc-webui-template.patch new file mode 100644 index 00000000000..884e45b2d83 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-gcc-webui-template.patch @@ -0,0 +1,67 @@ +From aa4ba19043db1f41bb0982d4b50f4f00151930f4 Mon Sep 17 00:00:00 2001 +From: Stephan Hartmann +Date: Tue, 26 May 2020 15:29:49 +0000 +Subject: [PATCH] GCC: fix template specialization in content::WebUI + +GCC complains that explicit specialization in non-namespace scope +is happening for GetValue. Move the methods outside +the class definition. + +Bug: 819294 +Change-Id: I109472a0b6fa7ddab3529bc92bba680252b40f67 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2128307 +Reviewed-by: Camille Lamy +Commit-Queue: Camille Lamy +Cr-Commit-Position: refs/heads/master@{#771818} +--- + +diff --git a/content/public/browser/web_ui.h b/content/public/browser/web_ui.h +index 4e6aa0e..fa6f10c 100644 +--- a/content/public/browser/web_ui.h ++++ b/content/public/browser/web_ui.h +@@ -138,22 +138,6 @@ + template + static T GetValue(const base::Value& value); + +- template <> +- inline bool GetValue(const base::Value& value) { +- return value.GetBool(); +- } +- +- template <> +- inline int GetValue(const base::Value& value) { +- return value.GetInt(); +- } +- +- template <> +- inline const std::string& GetValue( +- const base::Value& value) { +- return value.GetString(); +- } +- + template + struct Call; + +@@ -169,6 +153,22 @@ + }; + }; + ++template <> ++inline bool WebUI::GetValue(const base::Value& value) { ++ return value.GetBool(); ++} ++ ++template <> ++inline int WebUI::GetValue(const base::Value& value) { ++ return value.GetInt(); ++} ++ ++template <> ++inline const std::string& WebUI::GetValue( ++ const base::Value& value) { ++ return value.GetString(); ++} ++ + } // namespace content + + #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_H_ diff --git a/srcpkgs/electron9/files/patches/chromium-include-memory-header-to-get-the-definition-of-std-u.patch b/srcpkgs/electron9/files/patches/chromium-include-memory-header-to-get-the-definition-of-std-u.patch new file mode 100644 index 00000000000..eb30ad2437f --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-include-memory-header-to-get-the-definition-of-std-u.patch @@ -0,0 +1,32 @@ +From 40d994e4aa2e4d5077c1810e4623549618a19c05 Mon Sep 17 00:00:00 2001 +From: Piotr Tworek +Date: Mon, 27 Apr 2020 16:31:46 +0000 +Subject: [PATCH] Include "memory" header to get the definition of + std::unique_ptr. + +Right now the code im the affected fails to build when using libstdc++ +instead of bundled libcxx. Apparently libcxx pulls the necessary header +indirectly. + +Change-Id: Ie5e86f228434ab16d622ae7a912d9ce607258931 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2164645 +Reviewed-by: Jochen Eisinger +Commit-Queue: Jochen Eisinger +Cr-Commit-Position: refs/heads/master@{#762881} +--- + .../blink/renderer/core/html/trust_token_attribute_parsing.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/third_party/blink/renderer/core/html/trust_token_attribute_parsing.h b/third_party/blink/renderer/core/html/trust_token_attribute_parsing.h +index f5a7ab03892..ef19cfaf680 100644 +--- a/third_party/blink/renderer/core/html/trust_token_attribute_parsing.h ++++ b/third_party/blink/renderer/core/html/trust_token_attribute_parsing.h +@@ -5,6 +5,8 @@ + #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_TRUST_TOKEN_ATTRIBUTE_PARSING_H_ + #define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_TRUST_TOKEN_ATTRIBUTE_PARSING_H_ + ++#include ++ + #include "base/optional.h" + #include "services/network/public/mojom/trust_tokens.mojom-blink-forward.h" + #include "third_party/blink/renderer/core/core_export.h" diff --git a/srcpkgs/electron9/files/patches/chromium-iwyu-std-numeric_limits-is-defined-in-limits.patch b/srcpkgs/electron9/files/patches/chromium-iwyu-std-numeric_limits-is-defined-in-limits.patch new file mode 100644 index 00000000000..39be41002a4 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-iwyu-std-numeric_limits-is-defined-in-limits.patch @@ -0,0 +1,29 @@ +From 74f76a6be385ef056b0be2362c32c728141cca16 Mon Sep 17 00:00:00 2001 +From: Stephan Hartmann +Date: Fri, 17 Apr 2020 16:04:12 +0000 +Subject: [PATCH] IWYU: std::numeric_limits is defined in limits +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Change-Id: Ifbc379adc5bb7242c21e7da0bcfc28f49e4dd06f +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2153111 +Reviewed-by: François Doray +Commit-Queue: François Doray +Cr-Commit-Position: refs/heads/master@{#760075} +--- + .../graph/policies/background_tab_loading_policy_helpers.cc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/chrome/browser/performance_manager/graph/policies/background_tab_loading_policy_helpers.cc b/chrome/browser/performance_manager/graph/policies/background_tab_loading_policy_helpers.cc +index 4881c010bb9..593501d16a7 100644 +--- a/chrome/browser/performance_manager/graph/policies/background_tab_loading_policy_helpers.cc 2020-06-25 00:39:31.000000000 +0200 ++++ - 2020-08-22 18:33:55.879464820 +0200 +@@ -3,6 +3,7 @@ + // found in the LICENSE file. + + #include "chrome/browser/performance_manager/graph/policies/background_tab_loading_policy_helpers.h" ++#include + #include "base/logging.h" + + namespace performance_manager { diff --git a/srcpkgs/electron9/files/patches/chromium-libc_malloc.patch b/srcpkgs/electron9/files/patches/chromium-libc_malloc.patch new file mode 100644 index 00000000000..27cd2cefc46 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-libc_malloc.patch @@ -0,0 +1,26 @@ +--- a/base/process/memory_linux.cc.orig 2017-09-15 08:41:43.000000000 +0000 ++++ b/base/process/memory_linux.cc 2017-09-15 08:44:39.804995469 +0000 +@@ -21,6 +21,12 @@ + #include "third_party/tcmalloc/chromium/src/gperftools/tcmalloc.h" + #endif + ++#if defined(LIBC_GLIBC) ++extern "C" { ++extern void *__libc_malloc(size_t size); ++} ++#endif ++ + namespace base { + + size_t g_oom_size = 0U; +--- a/base/process/memory_linux.cc.orig 2017-09-15 08:46:55.000000000 +0000 ++++ b/base/process/memory_linux.cc 2017-09-15 08:51:34.422016858 +0000 +@@ -107,7 +107,7 @@ + (!defined(LIBC_GLIBC) && !defined(USE_TCMALLOC)) + *result = malloc(size); + #elif defined(LIBC_GLIBC) && !defined(USE_TCMALLOC) +- *result = __libc_malloc(size); ++ *result = ::__libc_malloc(size); + #elif defined(USE_TCMALLOC) + *result = tc_malloc_skip_new_handler(size); + #endif diff --git a/srcpkgs/electron9/files/patches/chromium-libstdc-fix-incomplete-type-in-AXTree-for-NodeSetSiz.patch b/srcpkgs/electron9/files/patches/chromium-libstdc-fix-incomplete-type-in-AXTree-for-NodeSetSiz.patch new file mode 100644 index 00000000000..5e9d37aae54 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-libstdc-fix-incomplete-type-in-AXTree-for-NodeSetSiz.patch @@ -0,0 +1,62 @@ +From aeef68888d4c00b69facead2b934095a8cd17329 Mon Sep 17 00:00:00 2001 +From: Stephan Hartmann +Date: Mon, 20 Apr 2020 18:21:43 +0000 +Subject: [PATCH] libstdc++: fix incomplete-type in AXTree for + NodeSetSizePosInSetInfo + +has only forward declaration of NodeSetSizePosInSetInfo. Therefore, +move declaration from ax_tree.cc. + +std: :unordered_map requires U to be fully declared. ax_tree.h +Bug: 957519 +Change-Id: Ic1f4bf3ebfea229ece84251e46d4461b31873868 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132403 +Reviewed-by: David Tseng +Commit-Queue: David Tseng +Cr-Commit-Position: refs/heads/master@{#760588} +--- + ui/accessibility/ax_tree.cc | 10 ++-------- + ui/accessibility/ax_tree.h | 9 ++++++++- + 2 files changed, 10 insertions(+), 9 deletions(-) + +diff --git a/ui/accessibility/ax_tree.cc b/ui/accessibility/ax_tree.cc +index 7b8d9b1b161..e9154028d66 100644 +--- a/ui/accessibility/ax_tree.cc ++++ b/ui/accessibility/ax_tree.cc +@@ -567,14 +567,8 @@ struct AXTreeUpdateState { + const AXTree& tree; + }; + +-struct AXTree::NodeSetSizePosInSetInfo { +- NodeSetSizePosInSetInfo() = default; +- ~NodeSetSizePosInSetInfo() = default; +- +- int32_t pos_in_set = 0; +- int32_t set_size = 0; +- base::Optional lowest_hierarchical_level; +-}; ++AXTree::NodeSetSizePosInSetInfo::NodeSetSizePosInSetInfo() = default; ++AXTree::NodeSetSizePosInSetInfo::~NodeSetSizePosInSetInfo() = default; + + struct AXTree::OrderedSetContent { + explicit OrderedSetContent(const AXNode* ordered_set = nullptr) +diff --git a/ui/accessibility/ax_tree.h b/ui/accessibility/ax_tree.h +index a51ca8de4c8..8c1c57517ac 100644 +--- a/ui/accessibility/ax_tree.h ++++ b/ui/accessibility/ax_tree.h +@@ -328,7 +328,14 @@ class AX_EXPORT AXTree : public AXNode::OwnerTree { + bool enable_extra_mac_nodes_ = false; + + // Contains pos_in_set and set_size data for an AXNode. +- struct NodeSetSizePosInSetInfo; ++ struct NodeSetSizePosInSetInfo { ++ NodeSetSizePosInSetInfo(); ++ ~NodeSetSizePosInSetInfo(); ++ ++ int32_t pos_in_set = 0; ++ int32_t set_size = 0; ++ base::Optional lowest_hierarchical_level; ++ }; + + // Represents the content of an ordered set which includes the ordered set + // items and the ordered set container if it exists. diff --git a/srcpkgs/electron9/files/patches/chromium-make-some-of-blink-custom-iterators-STL-compatible.patch b/srcpkgs/electron9/files/patches/chromium-make-some-of-blink-custom-iterators-STL-compatible.patch new file mode 100644 index 00000000000..30cbdefcc65 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-make-some-of-blink-custom-iterators-STL-compatible.patch @@ -0,0 +1,95 @@ +From d3cabbc7321d349a9bffda482df5afc0d4df1ac2 Mon Sep 17 00:00:00 2001 +From: Piotr Tworek +Date: Thu, 30 Apr 2020 21:33:47 +0000 +Subject: [PATCH] Make some of blink custom iterators STL compatible. + +Blink has recently started using functions like std::any_of with some of +the custom iterators it provides. On Linux this works in the default +setup using libcxx, but fails with even the most recent versions of +libstdc++. In all cases the error message (text in bug report) complains +about lack of matching std::__iterator_category definition. + +From what I understand the error message is basically saying those +iterators are not STL compatible due to missing traits as described +in https://en.cppreference.com/w/cpp/iterator/iterator_traits. Such +traits are provided by custom iterators defined in //base, or //cc. + +This patch adds the necessary traits to iterators that are currently +affected by this problem. + +Bug: 1076869 +Change-Id: I9950a7100c32499ba96647317fa70b87dc22eaf9 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2174199 +Reviewed-by: Kentaro Hara +Commit-Queue: Piotr Tworek +Cr-Commit-Position: refs/heads/master@{#764426} +--- + .../core/layout/ng/ng_physical_container_fragment.h | 6 ++++++ + .../blink/renderer/platform/wtf/hash_iterators.h | 12 ++++++++++++ + third_party/blink/renderer/platform/wtf/hash_table.h | 6 ++++++ + 3 files changed, 24 insertions(+) + +diff --git a/third_party/blink/renderer/core/layout/ng/ng_physical_container_fragment.h b/third_party/blink/renderer/core/layout/ng/ng_physical_container_fragment.h +index 1256e77c146..8b93107f2fc 100644 +--- a/third_party/blink/renderer/core/layout/ng/ng_physical_container_fragment.h ++++ b/third_party/blink/renderer/core/layout/ng/ng_physical_container_fragment.h +@@ -38,6 +38,12 @@ class CORE_EXPORT NGPhysicalContainerFragment : public NGPhysicalFragment { + STACK_ALLOCATED(); + + public: ++ using iterator_category = std::bidirectional_iterator_tag; ++ using value_type = NGLink; ++ using difference_type = ptrdiff_t; ++ using pointer = value_type*; ++ using reference = value_type&; ++ + ConstIterator(const NGLink* current) : current_(current) {} + + const NGLink& operator*() const { return *PostLayoutOrCurrent(); } +diff --git a/third_party/blink/renderer/platform/wtf/hash_iterators.h b/third_party/blink/renderer/platform/wtf/hash_iterators.h +index f8e66e6be85..6003d02c509 100644 +--- a/third_party/blink/renderer/platform/wtf/hash_iterators.h ++++ b/third_party/blink/renderer/platform/wtf/hash_iterators.h +@@ -53,6 +53,12 @@ struct HashTableConstIteratorAdapter + ValuesIterator; + ++ using iterator_category = std::bidirectional_iterator_tag; ++ using value_type = HashTableType; ++ using difference_type = ptrdiff_t; ++ using pointer = value_type*; ++ using reference = value_type&; ++ + HashTableConstIteratorAdapter() = default; + HashTableConstIteratorAdapter( + const typename HashTableType::const_iterator& impl) +@@ -94,6 +100,12 @@ struct HashTableIteratorAdapter + ValuesIterator; + ++ using iterator_category = std::bidirectional_iterator_tag; ++ using value_type = HashTableType; ++ using difference_type = ptrdiff_t; ++ using pointer = value_type*; ++ using reference = value_type&; ++ + HashTableIteratorAdapter() = default; + HashTableIteratorAdapter(const typename HashTableType::iterator& impl) + : impl_(impl) {} +diff --git a/third_party/blink/renderer/platform/wtf/hash_table.h b/third_party/blink/renderer/platform/wtf/hash_table.h +index f596fb5d41e..5a4468d6bd1 100644 +--- a/third_party/blink/renderer/platform/wtf/hash_table.h ++++ b/third_party/blink/renderer/platform/wtf/hash_table.h +@@ -2204,6 +2204,12 @@ struct HashTableConstIteratorAdapter { + STACK_ALLOCATED(); + + public: ++ using iterator_category = std::bidirectional_iterator_tag; ++ using value_type = HashTableType; ++ using difference_type = ptrdiff_t; ++ using pointer = value_type*; ++ using reference = value_type&; ++ + HashTableConstIteratorAdapter() = default; + HashTableConstIteratorAdapter( + const typename HashTableType::const_iterator& impl) diff --git a/srcpkgs/electron9/files/patches/chromium-skia-harmony.patch b/srcpkgs/electron9/files/patches/chromium-skia-harmony.patch new file mode 100644 index 00000000000..1cb8aebf240 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-skia-harmony.patch @@ -0,0 +1,14 @@ +--- a/third_party/skia/src/ports/SkFontHost_FreeType.cpp.orig 2019-07-19 11:08:34.770972665 +0000 ++++ b/third_party/skia/src/ports/SkFontHost_FreeType.cpp 2019-07-19 11:08:44.274442065 +0000 +@@ -128,9 +128,9 @@ public: + : fGetVarDesignCoordinates(nullptr) + , fGetVarAxisFlags(nullptr) + , fLibrary(nullptr) +- , fIsLCDSupported(false) ++ , fIsLCDSupported(true) + , fLightHintingIsYOnly(false) +- , fLCDExtra(0) ++ , fLCDExtra(2) + { + if (FT_New_Library(&gFTMemory, &fLibrary)) { + return; diff --git a/srcpkgs/electron9/files/patches/chromium-toolchain-host.patch b/srcpkgs/electron9/files/patches/chromium-toolchain-host.patch new file mode 100644 index 00000000000..0dace261a08 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-toolchain-host.patch @@ -0,0 +1,11 @@ +--- src/build/toolchain/linux/unbundle/BUILD.gn 2020-07-21 17:36:34.064748261 +0200 ++++ - 2020-07-21 17:39:03.115740522 +0200 +@@ -35,7 +35,7 @@ + extra_ldflags = getenv("BUILD_LDFLAGS") + + toolchain_args = { +- current_cpu = current_cpu ++ current_cpu = host_cpu + current_os = current_os + } + } diff --git a/srcpkgs/electron9/files/patches/chromium-upstream-0001-Revert-ui-fill-in-SDR-HDR-DisplayColorSpaces-CrOS.patch b/srcpkgs/electron9/files/patches/chromium-upstream-0001-Revert-ui-fill-in-SDR-HDR-DisplayColorSpaces-CrOS.patch new file mode 100644 index 00000000000..6616357f899 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-upstream-0001-Revert-ui-fill-in-SDR-HDR-DisplayColorSpaces-CrOS.patch @@ -0,0 +1,436 @@ +From 44f5d255245153ac3f5aa4b6530810ca93ff46e6 Mon Sep 17 00:00:00 2001 +From: Miguel Casas +Date: Mon, 22 Jun 2020 20:24:57 +0000 +Subject: [PATCH 01/12] Revert "ui: fill in SDR/HDR DisplayColorSpaces, CrOS" + +This reverts commit 07199ff111cb3b31da0752adc62ffbe05101dfde. + +Said commit inadvertently instructed the compositor to use the +EDID-provided ColorSpace as target for rastering, causing colours +to be accurate, but washed out. + +Original Commit description ---------------------------------------- +This CL adds code for populating the necessary gfx::DisplayColorSpaces +in CreateManagedDisplayInfo for supporting SDR and HDR target color +spaces (depending on the monitor capabilities and the big hdr flag). + +It needs a sibling CL to allow AR/B30 FBs on CrOs crrev.com/c/2078655, +Tested with that CL and by playing an HDR video: the primary +framebuffer format in /sys/kernel/debug/dri/0//state correctly changes +to XB30, whereas when there are not HDR quads in the BufferQueue, it's +XR24. + +Bug: 958166 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2072621 +Reviewed-by: ccameron +Commit-Queue: Miguel Casas +Cr-Commit-Position: refs/heads/master@{#745461} + + +(cherry picked from commit f807a5774bc1af6ef43c408bd0a1a0b0d55e2c4a) + +Bug: b:158126931, 958166 +Change-Id: Iee5c9a431a9c0f9f6a5b4d229ab70183c264ad9b +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2232761 +Auto-Submit: Miguel Casas +Reviewed-by: ccameron +Commit-Queue: ccameron +Commit-Queue: Miguel Casas +Cr-Original-Commit-Position: refs/heads/master@{#775775} +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2258293 +Reviewed-by: Miguel Casas +Cr-Commit-Position: refs/branch-heads/4103@{#724} +Cr-Branched-From: 8ad47e8d21f6866e4a37f47d83a860d41debf514-refs/heads/master@{#756066} +--- + ui/compositor/compositor.cc | 10 ++ + ui/display/fake/fake_display_snapshot.cc | 21 +-- + ui/display/fake/fake_display_snapshot.h | 8 +- + ui/display/manager/display_change_observer.cc | 69 ++------- + ui/display/manager/display_change_observer.h | 2 - + .../display_change_observer_unittest.cc | 134 +----------------- + 6 files changed, 25 insertions(+), 219 deletions(-) + +diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc +index e94d022afcc..dd4f89d7676 100644 +--- a/ui/compositor/compositor.cc ++++ b/ui/compositor/compositor.cc +@@ -444,6 +444,16 @@ void Compositor::SetDisplayColorSpaces( + if (display_color_spaces_ == display_color_spaces) + return; + display_color_spaces_ = display_color_spaces; ++ // TODO(crbug.com/1012846): Remove this flag and provision when HDR is fully ++ // supported on ChromeOS. ++#if defined(OS_CHROMEOS) ++ if (display_color_spaces_.SupportsHDR() && ++ !base::CommandLine::ForCurrentProcess()->HasSwitch( ++ switches::kEnableUseHDRTransferFunction)) { ++ display_color_spaces_ = ++ gfx::DisplayColorSpaces(gfx::ColorSpace::CreateSRGB()); ++ } ++#endif + + host_->SetRasterColorSpace(display_color_spaces_.GetRasterColorSpace()); + // Always force the ui::Compositor to re-draw all layers, because damage +diff --git a/ui/display/fake/fake_display_snapshot.cc b/ui/display/fake/fake_display_snapshot.cc +index 3568c296327..94da2c4e398 100644 +--- a/ui/display/fake/fake_display_snapshot.cc ++++ b/ui/display/fake/fake_display_snapshot.cc +@@ -163,8 +163,7 @@ std::unique_ptr Builder::Build() { + id_, origin_, physical_size, type_, is_aspect_preserving_scaling_, + has_overscan_, privacy_screen_state_, has_color_correction_matrix_, + color_correction_in_linear_space_, name_, std::move(modes_), +- current_mode_, native_mode_, product_code_, maximum_cursor_size_, +- color_space_, bits_per_channel_); ++ current_mode_, native_mode_, product_code_, maximum_cursor_size_); + } + + Builder& Builder::SetId(int64_t id) { +@@ -265,16 +264,6 @@ Builder& Builder::SetPrivacyScreen(PrivacyScreenState state) { + return *this; + } + +-Builder& Builder::SetColorSpace(const gfx::ColorSpace& color_space) { +- color_space_ = color_space; +- return *this; +-} +- +-Builder& Builder::SetBitsPerChannel(uint32_t bits_per_channel) { +- bits_per_channel_ = bits_per_channel; +- return *this; +-} +- + const DisplayMode* Builder::AddOrFindDisplayMode(const gfx::Size& size) { + for (auto& mode : modes_) { + if (mode->size() == size) +@@ -316,9 +305,7 @@ FakeDisplaySnapshot::FakeDisplaySnapshot( + const DisplayMode* current_mode, + const DisplayMode* native_mode, + int64_t product_code, +- const gfx::Size& maximum_cursor_size, +- const gfx::ColorSpace& color_space, +- uint32_t bits_per_channel) ++ const gfx::Size& maximum_cursor_size) + : DisplaySnapshot(display_id, + origin, + physical_size, +@@ -328,8 +315,8 @@ FakeDisplaySnapshot::FakeDisplaySnapshot( + privacy_screen_state, + has_color_correction_matrix, + color_correction_in_linear_space, +- color_space, +- bits_per_channel, ++ gfx::ColorSpace(), ++ 8u /* bits_per_channel */, + display_name, + base::FilePath(), + std::move(modes), +diff --git a/ui/display/fake/fake_display_snapshot.h b/ui/display/fake/fake_display_snapshot.h +index d521fb34078..833ac744d08 100644 +--- a/ui/display/fake/fake_display_snapshot.h ++++ b/ui/display/fake/fake_display_snapshot.h +@@ -70,8 +70,6 @@ class FAKE_DISPLAY_EXPORT FakeDisplaySnapshot : public DisplaySnapshot { + // Sets physical_size for high DPI display. + Builder& SetHighDPI(); + Builder& SetPrivacyScreen(PrivacyScreenState state); +- Builder& SetColorSpace(const gfx::ColorSpace& color_space); +- Builder& SetBitsPerChannel(uint32_t bits_per_channel); + + private: + // Returns a display mode with |size|. If there is no existing mode, insert +@@ -96,8 +94,6 @@ class FAKE_DISPLAY_EXPORT FakeDisplaySnapshot : public DisplaySnapshot { + DisplayModeList modes_; + const DisplayMode* current_mode_ = nullptr; + const DisplayMode* native_mode_ = nullptr; +- gfx::ColorSpace color_space_; +- uint32_t bits_per_channel_ = 8u; + + DISALLOW_COPY_AND_ASSIGN(Builder); + }; +@@ -116,9 +112,7 @@ class FAKE_DISPLAY_EXPORT FakeDisplaySnapshot : public DisplaySnapshot { + const DisplayMode* current_mode, + const DisplayMode* native_mode, + int64_t product_code, +- const gfx::Size& maximum_cursor_size, +- const gfx::ColorSpace& color_space, +- uint32_t bits_per_channel); ++ const gfx::Size& maximum_cursor_size); + ~FakeDisplaySnapshot() override; + + // Creates a display snapshot from the provided |spec| string. Returns null if +diff --git a/ui/display/manager/display_change_observer.cc b/ui/display/manager/display_change_observer.cc +index 28dbd10ec19..799d896d8e7 100644 +--- a/ui/display/manager/display_change_observer.cc ++++ b/ui/display/manager/display_change_observer.cc +@@ -77,55 +77,6 @@ ManagedDisplayInfo::ManagedDisplayModeList GetModeListWithAllRefreshRates( + return display_mode_list; + } + +-// Constructs the raster DisplayColorSpaces out of |snapshot_color_space|, +-// including the HDR ones if present and |allow_high_bit_depth| is set. +-gfx::DisplayColorSpaces FillDisplayColorSpaces( +- const gfx::ColorSpace& snapshot_color_space, +- bool allow_high_bit_depth) { +- // ChromeOS VMs (e.g. amd64-generic or betty) have INVALID Primaries; just +- // pass the color space along. +- if (!snapshot_color_space.IsValid()) { +- return gfx::DisplayColorSpaces(snapshot_color_space, +- DisplaySnapshot::PrimaryFormat()); +- } +- +- constexpr auto kSDRTransferId = gfx::ColorSpace::TransferID::IEC61966_2_1; +- const auto primary_id = snapshot_color_space.GetPrimaryID(); +- +- gfx::ColorSpace sdr_color_space; +- if (primary_id == gfx::ColorSpace::PrimaryID::CUSTOM) { +- skcms_Matrix3x3 primary_matrix{}; +- snapshot_color_space.GetPrimaryMatrix(&primary_matrix); +- sdr_color_space = +- gfx::ColorSpace::CreateCustom(primary_matrix, kSDRTransferId); +- } else { +- sdr_color_space = gfx::ColorSpace(primary_id, kSDRTransferId); +- } +- gfx::DisplayColorSpaces display_color_spaces( +- sdr_color_space, DisplaySnapshot::PrimaryFormat()); +- +- if (allow_high_bit_depth) { +- gfx::ColorSpace hdr_color_space; +- if (primary_id == gfx::ColorSpace::PrimaryID::CUSTOM) { +- skcms_Matrix3x3 primary_matrix{}; +- snapshot_color_space.GetPrimaryMatrix(&primary_matrix); +- hdr_color_space = gfx::ColorSpace::CreatePiecewiseHDR( +- primary_id, 0.99, 2.0, &primary_matrix); +- } else { +- hdr_color_space = +- gfx::ColorSpace::CreatePiecewiseHDR(primary_id, 0.99, 2.0); +- } +- +- display_color_spaces.SetOutputColorSpaceAndBufferFormat( +- gfx::ContentColorUsage::kHDR, false /* needs_alpha */, hdr_color_space, +- gfx::BufferFormat::RGBA_1010102); +- display_color_spaces.SetOutputColorSpaceAndBufferFormat( +- gfx::ContentColorUsage::kHDR, true /* needs_alpha */, hdr_color_space, +- gfx::BufferFormat::RGBA_1010102); +- } +- return display_color_spaces; +-} +- + } // namespace + + // static +@@ -386,23 +337,21 @@ ManagedDisplayInfo DisplayChangeObserver::CreateManagedDisplayInfo( + if (dpi) + new_info.set_device_dpi(dpi); + +-#if !defined(OS_CHROMEOS) + // TODO(crbug.com/1012846): This should configure the HDR color spaces. + gfx::DisplayColorSpaces display_color_spaces( + snapshot->color_space(), DisplaySnapshot::PrimaryFormat()); + new_info.set_display_color_spaces(display_color_spaces); + new_info.set_bits_per_channel(snapshot->bits_per_channel()); +-#else +- // TODO(crbug.com/1012846): Remove kEnableUseHDRTransferFunction usage when +- // HDR is fully supported on ChromeOS. +- const bool allow_high_bit_depth = +- base::CommandLine::ForCurrentProcess()->HasSwitch( +- switches::kEnableUseHDRTransferFunction); +- new_info.set_display_color_spaces( +- FillDisplayColorSpaces(snapshot->color_space(), allow_high_bit_depth)); ++ ++ // TODO(crbug.com/1012846): Remove this flag and provision when HDR is fully ++ // supported on ChromeOS. ++#if defined(OS_CHROMEOS) + constexpr int32_t kNormalBitDepth = 8; +- new_info.set_bits_per_channel( +- allow_high_bit_depth ? snapshot->bits_per_channel() : kNormalBitDepth); ++ if (new_info.bits_per_channel() > kNormalBitDepth && ++ !base::CommandLine::ForCurrentProcess()->HasSwitch( ++ switches::kEnableUseHDRTransferFunction)) { ++ new_info.set_bits_per_channel(kNormalBitDepth); ++ } + #endif + + new_info.set_refresh_rate(mode_info->refresh_rate()); +diff --git a/ui/display/manager/display_change_observer.h b/ui/display/manager/display_change_observer.h +index 5c17ce60977..0e896e24e5e 100644 +--- a/ui/display/manager/display_change_observer.h ++++ b/ui/display/manager/display_change_observer.h +@@ -60,8 +60,6 @@ class DISPLAY_MANAGER_EXPORT DisplayChangeObserver + DISPLAY_EXPORT static float FindDeviceScaleFactor(float dpi); + + private: +- friend class DisplayChangeObserverTest; +- + void UpdateInternalDisplay( + const DisplayConfigurator::DisplayStateList& display_states); + +diff --git a/ui/display/manager/display_change_observer_unittest.cc b/ui/display/manager/display_change_observer_unittest.cc +index 1b2907137f9..bb900209bac 100644 +--- a/ui/display/manager/display_change_observer_unittest.cc ++++ b/ui/display/manager/display_change_observer_unittest.cc +@@ -14,11 +14,8 @@ + #include "ui/display/display_switches.h" + #include "ui/display/fake/fake_display_snapshot.h" + #include "ui/display/manager/display_configurator.h" +-#include "ui/display/manager/display_manager.h" + #include "ui/display/manager/managed_display_info.h" +-#include "ui/display/screen.h" + #include "ui/display/types/display_mode.h" +-#include "ui/events/devices/device_data_manager.h" + #include "ui/gfx/geometry/rect.h" + #include "ui/gfx/geometry/size.h" + +@@ -63,13 +60,6 @@ class DisplayChangeObserverTest : public testing::Test, + Test::SetUp(); + } + +- // Pass through method to be called by individual test cases. +- ManagedDisplayInfo CreateManagedDisplayInfo(DisplayChangeObserver* observer, +- const DisplaySnapshot* snapshot, +- const DisplayMode* mode_info) { +- return observer->CreateManagedDisplayInfo(snapshot, mode_info); +- } +- + private: + base::test::ScopedFeatureList scoped_feature_list_; + +@@ -185,8 +175,7 @@ TEST_P(DisplayChangeObserverTest, GetEmptyExternalManagedDisplayModeList) { + FakeDisplaySnapshot display_snapshot( + 123, gfx::Point(), gfx::Size(), DISPLAY_CONNECTION_TYPE_UNKNOWN, false, + false, PrivacyScreenState::kNotSupported, false, false, std::string(), {}, +- nullptr, nullptr, 0, gfx::Size(), gfx::ColorSpace(), +- /*bits_per_channel=*/8u); ++ nullptr, nullptr, 0, gfx::Size()); + + ManagedDisplayInfo::ManagedDisplayModeList display_modes = + DisplayChangeObserver::GetExternalManagedDisplayModeList( +@@ -305,127 +294,6 @@ TEST_P(DisplayChangeObserverTest, + } + } + +-TEST_P(DisplayChangeObserverTest, InvalidDisplayColorSpaces) { +- const std::unique_ptr display_snapshot = +- FakeDisplaySnapshot::Builder() +- .SetId(123) +- .SetName("AmazingFakeDisplay") +- .SetNativeMode(MakeDisplayMode(1920, 1080, true, 60)) +- .SetColorSpace(gfx::ColorSpace()) +- .Build(); +- +- ui::DeviceDataManager::CreateInstance(); +- DisplayManager manager(nullptr); +- const auto display_mode = MakeDisplayMode(1920, 1080, true, 60); +- DisplayChangeObserver observer(&manager); +- const ManagedDisplayInfo display_info = CreateManagedDisplayInfo( +- &observer, display_snapshot.get(), display_mode.get()); +- +- EXPECT_EQ(display_info.bits_per_channel(), 8u); +- const auto display_color_spaces = display_info.display_color_spaces(); +- EXPECT_FALSE(display_color_spaces.SupportsHDR()); +- +- EXPECT_EQ( +- DisplaySnapshot::PrimaryFormat(), +- display_color_spaces.GetOutputBufferFormat(gfx::ContentColorUsage::kSRGB, +- /*needs_alpha=*/true)); +- +- const auto color_space = display_color_spaces.GetRasterColorSpace(); +- // DisplayColorSpaces will fix an invalid ColorSpace to return sRGB. +- EXPECT_TRUE(color_space.IsValid()); +- EXPECT_EQ(color_space, gfx::ColorSpace::CreateSRGB()); +-} +- +-TEST_P(DisplayChangeObserverTest, SDRDisplayColorSpaces) { +- const std::unique_ptr display_snapshot = +- FakeDisplaySnapshot::Builder() +- .SetId(123) +- .SetName("AmazingFakeDisplay") +- .SetNativeMode(MakeDisplayMode(1920, 1080, true, 60)) +- .SetColorSpace(gfx::ColorSpace::CreateSRGB()) +- .Build(); +- +- ui::DeviceDataManager::CreateInstance(); +- DisplayManager manager(nullptr); +- const auto display_mode = MakeDisplayMode(1920, 1080, true, 60); +- DisplayChangeObserver observer(&manager); +- const ManagedDisplayInfo display_info = CreateManagedDisplayInfo( +- &observer, display_snapshot.get(), display_mode.get()); +- +- EXPECT_EQ(display_info.bits_per_channel(), 8u); +- +- const auto display_color_spaces = display_info.display_color_spaces(); +- EXPECT_FALSE(display_color_spaces.SupportsHDR()); +- +- EXPECT_EQ( +- DisplaySnapshot::PrimaryFormat(), +- display_color_spaces.GetOutputBufferFormat(gfx::ContentColorUsage::kSRGB, +- /*needs_alpha=*/true)); +- +- const auto color_space = display_color_spaces.GetRasterColorSpace(); +- EXPECT_TRUE(color_space.IsValid()); +- EXPECT_EQ(color_space.GetPrimaryID(), gfx::ColorSpace::PrimaryID::BT709); +- EXPECT_EQ(color_space.GetTransferID(), +- gfx::ColorSpace::TransferID::IEC61966_2_1); +-} +- +-#if defined(OS_CHROMEOS) +-TEST_P(DisplayChangeObserverTest, HDRDisplayColorSpaces) { +- // TODO(crbug.com/1012846): Remove this flag and provision when HDR is fully +- // supported on ChromeOS. +- base::CommandLine::ForCurrentProcess()->AppendSwitch( +- switches::kEnableUseHDRTransferFunction); +- +- const std::unique_ptr display_snapshot = +- FakeDisplaySnapshot::Builder() +- .SetId(123) +- .SetName("AmazingFakeDisplay") +- .SetNativeMode(MakeDisplayMode(1920, 1080, true, 60)) +- .SetColorSpace(gfx::ColorSpace::CreateHDR10(100.0f)) +- .SetBitsPerChannel(10u) +- .Build(); +- +- ui::DeviceDataManager::CreateInstance(); +- DisplayManager manager(nullptr); +- const auto display_mode = MakeDisplayMode(1920, 1080, true, 60); +- DisplayChangeObserver observer(&manager); +- const ManagedDisplayInfo display_info = CreateManagedDisplayInfo( +- &observer, display_snapshot.get(), display_mode.get()); +- +- EXPECT_EQ(display_info.bits_per_channel(), 10u); +- +- const auto display_color_spaces = display_info.display_color_spaces(); +- EXPECT_TRUE(display_color_spaces.SupportsHDR()); +- +- // |display_color_spaces| still supports SDR rendering. +- EXPECT_EQ( +- DisplaySnapshot::PrimaryFormat(), +- display_color_spaces.GetOutputBufferFormat(gfx::ContentColorUsage::kSRGB, +- /*needs_alpha=*/true)); +- +- const auto sdr_color_space = +- display_color_spaces.GetOutputColorSpace(gfx::ContentColorUsage::kSRGB, +- /*needs_alpha=*/true); +- EXPECT_TRUE(sdr_color_space.IsValid()); +- EXPECT_EQ(sdr_color_space.GetPrimaryID(), gfx::ColorSpace::PrimaryID::BT2020); +- EXPECT_EQ(sdr_color_space.GetTransferID(), +- gfx::ColorSpace::TransferID::IEC61966_2_1); +- +- EXPECT_EQ( +- display_color_spaces.GetOutputBufferFormat(gfx::ContentColorUsage::kHDR, +- /*needs_alpha=*/true), +- gfx::BufferFormat::RGBA_1010102); +- +- const auto hdr_color_space = +- display_color_spaces.GetOutputColorSpace(gfx::ContentColorUsage::kHDR, +- /*needs_alpha=*/true); +- EXPECT_TRUE(hdr_color_space.IsValid()); +- EXPECT_EQ(hdr_color_space.GetPrimaryID(), gfx::ColorSpace::PrimaryID::BT2020); +- EXPECT_EQ(hdr_color_space.GetTransferID(), +- gfx::ColorSpace::TransferID::PIECEWISE_HDR); +-} +-#endif +- + INSTANTIATE_TEST_SUITE_P(All, + DisplayChangeObserverTest, + ::testing::Values(false, true)); +-- +2.28.0 + diff --git a/srcpkgs/electron9/files/patches/chromium-upstream-0002-Roll-ChromeOS-Airmont-AFDO-profile-from-83-4103.97-1.patch b/srcpkgs/electron9/files/patches/chromium-upstream-0002-Roll-ChromeOS-Airmont-AFDO-profile-from-83-4103.97-1.patch new file mode 100644 index 00000000000..4f45ef8980f --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-upstream-0002-Roll-ChromeOS-Airmont-AFDO-profile-from-83-4103.97-1.patch @@ -0,0 +1,41 @@ +From d8cb454e79dc1635133e377645e5591aebaac61d Mon Sep 17 00:00:00 2001 +From: Chrome Release Autoroll + +Date: Thu, 25 Jun 2020 08:51:59 +0000 +Subject: [PATCH 02/12] Roll ChromeOS Airmont AFDO profile from + 83-4103.97-1592214618-benchmark-83.0.4103.117-r1 to + 83-4103.112-1592823658-benchmark-83.0.4103.119-r1 + +If this roll has caused a breakage, revert this CL and stop the roller +using the controls here: +https://autoroll.skia.org/r/cros-afdo-airmont-chromium-stable +Please CC c-compiler-chrome@google.com on the revert to ensure that a human +is aware of the problem. + +To report a problem with the AutoRoller itself, please file a bug: +https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug + +Documentation for the AutoRoller is here: +https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md + +Tbr: c-compiler-chrome@google.com +Change-Id: I9b5ffbc96b05ed5fd1ce64136398784171f34af7 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2266013 +Reviewed-by: Chrome Release Autoroll +Commit-Queue: Chrome Release Autoroll +Cr-Commit-Position: refs/branch-heads/4103@{#725} +Cr-Branched-From: 8ad47e8d21f6866e4a37f47d83a860d41debf514-refs/heads/master@{#756066} +--- + chromeos/profiles/airmont.afdo.newest.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/chromeos/profiles/airmont.afdo.newest.txt b/chromeos/profiles/airmont.afdo.newest.txt +index 7298eabbcad..130b8fe862d 100644 +--- a/chromeos/profiles/airmont.afdo.newest.txt ++++ b/chromeos/profiles/airmont.afdo.newest.txt +@@ -1 +1 @@ +-chromeos-chrome-amd64-airmont-83-4103.97-1592214618-benchmark-83.0.4103.117-r1-redacted.afdo.xz ++chromeos-chrome-amd64-airmont-83-4103.112-1592823658-benchmark-83.0.4103.119-r1-redacted.afdo.xz +-- +2.28.0 + diff --git a/srcpkgs/electron9/files/patches/chromium-upstream-0003-Roll-ChromeOS-Silvermont-AFDO-profile-from-83-4103.9.patch b/srcpkgs/electron9/files/patches/chromium-upstream-0003-Roll-ChromeOS-Silvermont-AFDO-profile-from-83-4103.9.patch new file mode 100644 index 00000000000..7729ece77cf --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-upstream-0003-Roll-ChromeOS-Silvermont-AFDO-profile-from-83-4103.9.patch @@ -0,0 +1,41 @@ +From e7fb38d8927a7d14beba0fed4d14d0110af3ed1f Mon Sep 17 00:00:00 2001 +From: Chrome Release Autoroll + +Date: Thu, 25 Jun 2020 08:55:40 +0000 +Subject: [PATCH 03/12] Roll ChromeOS Silvermont AFDO profile from + 83-4103.97-1592216557-benchmark-83.0.4103.117-r1 to + 83-4103.112-1592819884-benchmark-83.0.4103.119-r1 + +If this roll has caused a breakage, revert this CL and stop the roller +using the controls here: +https://autoroll.skia.org/r/cros-afdo-silvermont-chromium-stable +Please CC c-compiler-chrome@google.com on the revert to ensure that a human +is aware of the problem. + +To report a problem with the AutoRoller itself, please file a bug: +https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug + +Documentation for the AutoRoller is here: +https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md + +Tbr: c-compiler-chrome@google.com +Change-Id: I7a2c091c96266df5398b4d526568e579b42ba772 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2266014 +Reviewed-by: Chrome Release Autoroll +Commit-Queue: Chrome Release Autoroll +Cr-Commit-Position: refs/branch-heads/4103@{#726} +Cr-Branched-From: 8ad47e8d21f6866e4a37f47d83a860d41debf514-refs/heads/master@{#756066} +--- + chromeos/profiles/silvermont.afdo.newest.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/chromeos/profiles/silvermont.afdo.newest.txt b/chromeos/profiles/silvermont.afdo.newest.txt +index 68786600a49..df48e35c2e9 100644 +--- a/chromeos/profiles/silvermont.afdo.newest.txt ++++ b/chromeos/profiles/silvermont.afdo.newest.txt +@@ -1 +1 @@ +-chromeos-chrome-amd64-silvermont-83-4103.97-1592216557-benchmark-83.0.4103.117-r1-redacted.afdo.xz ++chromeos-chrome-amd64-silvermont-83-4103.112-1592819884-benchmark-83.0.4103.119-r1-redacted.afdo.xz +-- +2.28.0 + diff --git a/srcpkgs/electron9/files/patches/chromium-upstream-0004-Roll-ChromeOS-Broadwell-AFDO-profile-from-83-4103.97.patch b/srcpkgs/electron9/files/patches/chromium-upstream-0004-Roll-ChromeOS-Broadwell-AFDO-profile-from-83-4103.97.patch new file mode 100644 index 00000000000..573f2e7058e --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-upstream-0004-Roll-ChromeOS-Broadwell-AFDO-profile-from-83-4103.97.patch @@ -0,0 +1,41 @@ +From c90071e2caaf28da14536e4b3f6c74cba71c924c Mon Sep 17 00:00:00 2001 +From: Chrome Release Autoroll + +Date: Thu, 25 Jun 2020 09:52:48 +0000 +Subject: [PATCH 04/12] Roll ChromeOS Broadwell AFDO profile from + 83-4103.97-1592218687-benchmark-83.0.4103.117-r1 to + 83-4103.97-1592819197-benchmark-83.0.4103.119-r1 + +If this roll has caused a breakage, revert this CL and stop the roller +using the controls here: +https://autoroll.skia.org/r/cros-afdo-broadwell-chromium-stable +Please CC c-compiler-chrome@google.com on the revert to ensure that a human +is aware of the problem. + +To report a problem with the AutoRoller itself, please file a bug: +https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug + +Documentation for the AutoRoller is here: +https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md + +Tbr: c-compiler-chrome@google.com +Change-Id: I3de1bd68eda26a92502c2e38044b2bd4dd855d71 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2266019 +Reviewed-by: Chrome Release Autoroll +Commit-Queue: Chrome Release Autoroll +Cr-Commit-Position: refs/branch-heads/4103@{#727} +Cr-Branched-From: 8ad47e8d21f6866e4a37f47d83a860d41debf514-refs/heads/master@{#756066} +--- + chromeos/profiles/broadwell.afdo.newest.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/chromeos/profiles/broadwell.afdo.newest.txt b/chromeos/profiles/broadwell.afdo.newest.txt +index 7ca64107ca9..953aba58a64 100644 +--- a/chromeos/profiles/broadwell.afdo.newest.txt ++++ b/chromeos/profiles/broadwell.afdo.newest.txt +@@ -1 +1 @@ +-chromeos-chrome-amd64-broadwell-83-4103.97-1592218687-benchmark-83.0.4103.117-r1-redacted.afdo.xz ++chromeos-chrome-amd64-broadwell-83-4103.97-1592819197-benchmark-83.0.4103.119-r1-redacted.afdo.xz +-- +2.28.0 + diff --git a/srcpkgs/electron9/files/patches/chromium-upstream-0005-Incrementing-VERSION-to-83.0.4103.120.patch b/srcpkgs/electron9/files/patches/chromium-upstream-0005-Incrementing-VERSION-to-83.0.4103.120.patch new file mode 100644 index 00000000000..eae45d10329 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-upstream-0005-Incrementing-VERSION-to-83.0.4103.120.patch @@ -0,0 +1,29 @@ +From dd68d8efe2c4a5c3f04317d71e359b2d579fcf59 Mon Sep 17 00:00:00 2001 +From: chrome-release-bot +Date: Fri, 26 Jun 2020 15:05:21 +0000 +Subject: [PATCH 05/12] Incrementing VERSION to 83.0.4103.120 + +TBR=benmason@chromium.org + +Change-Id: I2de6fbef6b1d5ba6d9bbd5296e9706d7ca3194e2 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2269505 +Reviewed-by: Chrome Release Bot (LUCI) +Cr-Commit-Position: refs/branch-heads/4103@{#728} +Cr-Branched-From: 8ad47e8d21f6866e4a37f47d83a860d41debf514-refs/heads/master@{#756066} +--- + chrome/VERSION | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/chrome/VERSION b/chrome/VERSION +index 7c0499cafac..f7310a92cf3 100644 +--- a/chrome/VERSION ++++ b/chrome/VERSION +@@ -1,4 +1,4 @@ + MAJOR=83 + MINOR=0 + BUILD=4103 +-PATCH=119 ++PATCH=120 +-- +2.28.0 + diff --git a/srcpkgs/electron9/files/patches/chromium-upstream-0006-Move-GCPW-bookkeeping-out-of-forked-process.patch b/srcpkgs/electron9/files/patches/chromium-upstream-0006-Move-GCPW-bookkeeping-out-of-forked-process.patch new file mode 100644 index 00000000000..0a5e002765d --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-upstream-0006-Move-GCPW-bookkeeping-out-of-forked-process.patch @@ -0,0 +1,150 @@ +From 8b78203d8d1991e4ed8b50b5d44e1c8e76c60001 Mon Sep 17 00:00:00 2001 +From: Yusuf Sengul +Date: Fri, 26 Jun 2020 19:54:38 +0000 +Subject: [PATCH 06/12] Move GCPW bookkeeping out of forked process + +(cherry picked from commit f2e3565562e38e760220a4c6d2ea895477081095) + +Bug: 1097407 +Change-Id: I80b0fa57cc19196b06b3cbec5afc7c4488ff7325 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2255113 +Commit-Queue: Yusuf Sengul +Reviewed-by: Rakesh Soma +Cr-Original-Commit-Position: refs/heads/master@{#781721} +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2268117 +Cr-Commit-Position: refs/branch-heads/4103@{#729} +Cr-Branched-From: 8ad47e8d21f6866e4a37f47d83a860d41debf514-refs/heads/master@{#756066} +--- + .../gaiacp/gaia_credential_base.cc | 67 ++++++++++--------- + .../gaiacp/gaia_credential_base.h | 5 +- + 2 files changed, 37 insertions(+), 35 deletions(-) + +diff --git a/chrome/credential_provider/gaiacp/gaia_credential_base.cc b/chrome/credential_provider/gaiacp/gaia_credential_base.cc +index 6704a9db9c8..30e8011b73d 100644 +--- a/chrome/credential_provider/gaiacp/gaia_credential_base.cc ++++ b/chrome/credential_provider/gaiacp/gaia_credential_base.cc +@@ -1986,7 +1986,7 @@ unsigned __stdcall CGaiaCredentialBase::WaitForLoginUI(void* param) { + } + + // static +-HRESULT CGaiaCredentialBase::SaveAccountInfo(const base::Value& properties) { ++HRESULT CGaiaCredentialBase::PerformActions(const base::Value& properties) { + LOGFN(VERBOSE); + + base::string16 sid = GetDictString(properties, kKeySID); +@@ -2009,35 +2009,9 @@ HRESULT CGaiaCredentialBase::SaveAccountInfo(const base::Value& properties) { + + base::string16 domain = GetDictString(properties, kKeyDomain); + +- // TODO(crbug.com/976744): Use the down scoped kKeyMdmAccessToken instead +- // of login scoped token. +- std::string access_token = GetDictStringUTF8(properties, kKeyAccessToken); +- if (!access_token.empty()) { +- // Update the password recovery information if possible. +- HRESULT hr = PasswordRecoveryManager::Get()->StoreWindowsPasswordIfNeeded( +- sid, access_token, password); +- if (FAILED(hr) && hr != E_NOTIMPL) +- LOGFN(ERROR) << "StoreWindowsPasswordIfNeeded hr=" << putHR(hr); +- +- // Upload device details to gem database. +- hr = GemDeviceDetailsManager::Get()->UploadDeviceDetails(access_token, sid, +- username, domain); +- if (FAILED(hr) && hr != E_NOTIMPL) +- LOGFN(ERROR) << "UploadDeviceDetails hr=" << putHR(hr); +- +- SetUserProperty(sid, kRegDeviceDetailsUploadStatus, SUCCEEDED(hr) ? 1 : 0); +- +- // Below setter is only used for unit testing. +- GemDeviceDetailsManager::Get()->SetUploadStatusForTesting(hr); +- } else { +- LOGFN(ERROR) << "Access token is empty. Cannot save Windows password."; +- } +- + // Load the user's profile so that their registry hive is available. + auto profile = ScopedUserProfile::Create(sid, domain, username, password); + +- SecurelyClearString(password); +- + if (!profile) { + LOGFN(ERROR) << "Could not load user profile"; + return E_UNEXPECTED; +@@ -2047,6 +2021,32 @@ HRESULT CGaiaCredentialBase::SaveAccountInfo(const base::Value& properties) { + if (FAILED(hr)) + LOGFN(ERROR) << "profile.SaveAccountInfo failed (cont) hr=" << putHR(hr); + ++ // TODO(crbug.com/976744): Use the down scoped kKeyMdmAccessToken instead ++ // of login scoped token. ++ std::string access_token = GetDictStringUTF8(properties, kKeyAccessToken); ++ if (access_token.empty()) { ++ LOGFN(ERROR) << "Access token is empty."; ++ return E_FAIL; ++ } ++ ++ // Update the password recovery information if possible. ++ hr = PasswordRecoveryManager::Get()->StoreWindowsPasswordIfNeeded( ++ sid, access_token, password); ++ SecurelyClearString(password); ++ if (FAILED(hr) && hr != E_NOTIMPL) ++ LOGFN(ERROR) << "StoreWindowsPasswordIfNeeded hr=" << putHR(hr); ++ ++ // Upload device details to gem database. ++ hr = GemDeviceDetailsManager::Get()->UploadDeviceDetails(access_token, sid, ++ username, domain); ++ if (FAILED(hr) && hr != E_NOTIMPL) ++ LOGFN(ERROR) << "UploadDeviceDetails hr=" << putHR(hr); ++ ++ SetUserProperty(sid, kRegDeviceDetailsUploadStatus, SUCCEEDED(hr) ? 1 : 0); ++ ++ // Below setter is only used for unit testing. ++ GemDeviceDetailsManager::Get()->SetUploadStatusForTesting(hr); ++ + return hr; + } + +@@ -2058,9 +2058,9 @@ HRESULT CGaiaCredentialBase::PerformPostSigninActions( + HRESULT hr = S_OK; + + if (com_initialized) { +- hr = credential_provider::CGaiaCredentialBase::SaveAccountInfo(properties); ++ hr = credential_provider::CGaiaCredentialBase::PerformActions(properties); + if (FAILED(hr)) +- LOGFN(ERROR) << "SaveAccountInfo hr=" << putHR(hr); ++ LOGFN(ERROR) << "PerformActions hr=" << putHR(hr); + + // Try to enroll the machine to MDM here. MDM requires a user to be signed + // on to an interactive session to succeed and when we call this function +@@ -2089,10 +2089,11 @@ HRESULT CGaiaCredentialBase::PerformPostSigninActions( + + // Registers OS user - gaia user association in HKEY_LOCAL_MACHINE registry + // hive. +-HRESULT RegisterAssociation(const base::string16& sid, +- const base::string16& id, +- const base::string16& email, +- const base::string16& token_handle) { ++HRESULT ++RegisterAssociation(const base::string16& sid, ++ const base::string16& id, ++ const base::string16& email, ++ const base::string16& token_handle) { + // Save token handle. This handle will be used later to determine if the + // the user has changed their password since the account was created. + HRESULT hr = SetUserProperty(sid, kUserTokenHandle, token_handle); +diff --git a/chrome/credential_provider/gaiacp/gaia_credential_base.h b/chrome/credential_provider/gaiacp/gaia_credential_base.h +index 6aaaf44244b..6bf33ff4d3b 100644 +--- a/chrome/credential_provider/gaiacp/gaia_credential_base.h ++++ b/chrome/credential_provider/gaiacp/gaia_credential_base.h +@@ -97,8 +97,9 @@ class ATL_NO_VTABLE CGaiaCredentialBase + return authentication_results_; + } + +- // Saves gaia information in the OS account that was just created. +- static HRESULT SaveAccountInfo(const base::Value& properties); ++ // Saves account association and user profile information. Makes various HTTP ++ // calls regarding device provisioning and password management. ++ static HRESULT PerformActions(const base::Value& properties); + + // Returns true if the current credentials stored in |username_| and + // |password_| are valid and should succeed a local Windows logon. This +-- +2.28.0 + diff --git a/srcpkgs/electron9/files/patches/chromium-upstream-0007-Support-GCPW-login-to-permitted-accounts.patch b/srcpkgs/electron9/files/patches/chromium-upstream-0007-Support-GCPW-login-to-permitted-accounts.patch new file mode 100644 index 00000000000..ffcc4d1fc95 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-upstream-0007-Support-GCPW-login-to-permitted-accounts.patch @@ -0,0 +1,197 @@ +From d1383216cbceb10aaa80f357689e85354af6af3c Mon Sep 17 00:00:00 2001 +From: Yusuf Sengul +Date: Fri, 26 Jun 2020 20:38:33 +0000 +Subject: [PATCH 07/12] Support GCPW login to permitted accounts + +(cherry picked from commit f414152fa9a664ca5e99d4c0d0a2e261f9846eae) + +Bug: 1097386 +Change-Id: I2a9e634868fcda6c8acc46e482c2f6dc14bdc064 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2255028 +Commit-Queue: Rakesh Soma +Reviewed-by: Rakesh Soma +Cr-Original-Commit-Position: refs/heads/master@{#781997} +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2268083 +Commit-Queue: Yusuf Sengul +Cr-Commit-Position: refs/branch-heads/4103@{#730} +Cr-Branched-From: 8ad47e8d21f6866e4a37f47d83a860d41debf514-refs/heads/master@{#756066} +--- + .../gaiacp/gaia_credential_base.cc | 30 ++++-- + .../gaiacp/gaia_credential_base_unittests.cc | 92 +++++++++++++++++++ + 2 files changed, 116 insertions(+), 6 deletions(-) + +diff --git a/chrome/credential_provider/gaiacp/gaia_credential_base.cc b/chrome/credential_provider/gaiacp/gaia_credential_base.cc +index 30e8011b73d..cc573863991 100644 +--- a/chrome/credential_provider/gaiacp/gaia_credential_base.cc ++++ b/chrome/credential_provider/gaiacp/gaia_credential_base.cc +@@ -70,6 +70,8 @@ namespace { + + constexpr wchar_t kEmailDomainsKey[] = L"ed"; // deprecated. + constexpr wchar_t kEmailDomainsKeyNew[] = L"domains_allowed_to_login"; ++constexpr wchar_t kPermittedAccounts[] = L"permitted_accounts"; ++constexpr wchar_t kPermittedAccountsSeparator[] = L","; + constexpr char kGetAccessTokenBodyWithScopeFormat[] = + "client_id=%s&" + "client_secret=%s&" +@@ -95,6 +97,16 @@ constexpr UINT kPasswordErrors[] = {IDS_PASSWORD_COMPLEXITY_ERROR_BASE, + IDS_USER_NOT_FOUND_PASSWORD_ERROR_BASE, + IDS_AD_PASSWORD_CHANGE_DENIED_BASE}; + ++std::vector GetPermittedAccounts() { ++ base::string16 permitted_accounts_reg = ++ GetGlobalFlagOrDefault(kPermittedAccounts, L""); ++ ++ return base::SplitString(base::ToLowerASCII(permitted_accounts_reg), ++ kPermittedAccountsSeparator, ++ base::WhitespaceHandling::TRIM_WHITESPACE, ++ base::SplitResult::SPLIT_WANT_NONEMPTY); ++} ++ + base::string16 GetEmailDomains( + const base::string16 restricted_domains_reg_key) { + return GetGlobalFlagOrDefault(restricted_domains_reg_key, L""); +@@ -118,12 +130,9 @@ base::string16 GetEmailDomainsPrintableString() { + base::ASCIIToUTF16(kEmailDomainsSeparator), + base::WhitespaceHandling::TRIM_WHITESPACE, + base::SplitResult::SPLIT_WANT_NONEMPTY); +- base::string16 email_domains_str; +- for (size_t i = 0; i < domains.size(); ++i) { +- email_domains_str += domains[i]; +- if (i < domains.size() - 1) +- email_domains_str += L", "; +- } ++ base::string16 email_domains_str = ++ base::JoinString(domains, base::string16(L", ")); ++ + return email_domains_str; + } + +@@ -2403,6 +2412,15 @@ HRESULT CGaiaCredentialBase::OnUserAuthenticated(BSTR authentication_info, + return hr; + } + ++ base::string16 email = GetDictString(*properties, kKeyEmail); ++ std::vector permitted_accounts = GetPermittedAccounts(); ++ if (!permitted_accounts.empty() && ++ std::find(permitted_accounts.begin(), permitted_accounts.end(), ++ email) == permitted_accounts.end()) { ++ *status_text = AllocErrorString(IDS_EMAIL_MISMATCH_BASE); ++ return E_FAIL; ++ } ++ + // The value in |dict| is now known to contain everything that is needed + // from the GLS. Try to validate the user that wants to sign in and then + // add additional information into |dict| as needed. +diff --git a/chrome/credential_provider/gaiacp/gaia_credential_base_unittests.cc b/chrome/credential_provider/gaiacp/gaia_credential_base_unittests.cc +index 3cc48fa5b26..319f239e4cd 100644 +--- a/chrome/credential_provider/gaiacp/gaia_credential_base_unittests.cc ++++ b/chrome/credential_provider/gaiacp/gaia_credential_base_unittests.cc +@@ -6,6 +6,8 @@ + + #include // For ConvertSidToStringSid() + #include ++#include ++#include + + #include "base/files/scoped_temp_dir.h" + #include "base/strings/string_number_conversions.h" +@@ -738,6 +740,96 @@ INSTANTIATE_TEST_SUITE_P( + ::testing::Values(L"acme.com,acme2.com,acme3.com", + L""))); + ++class GcpGaiaCredentialBasePermittedAccountTest ++ : public GcpGaiaCredentialBaseTest, ++ public ::testing::WithParamInterface< ++ std::tuple> { ++ public: ++ // Get a pretty-printed string of the list of email domains that we can ++ // display to the end-user. ++ base::string16 GetEmailDomainsPrintableString() { ++ base::string16 email_domains_reg_old = GetGlobalFlagOrDefault(L"ed", L""); ++ base::string16 email_domains_reg_new = ++ GetGlobalFlagOrDefault(L"domains_allowed_to_login", L""); ++ ++ base::string16 email_domains_reg = email_domains_reg_old.empty() ++ ? email_domains_reg_new ++ : email_domains_reg_old; ++ if (email_domains_reg.empty()) ++ return email_domains_reg; ++ ++ std::vector domains = ++ base::SplitString(base::ToLowerASCII(email_domains_reg), ++ base::ASCIIToUTF16(kEmailDomainsSeparator), ++ base::WhitespaceHandling::TRIM_WHITESPACE, ++ base::SplitResult::SPLIT_WANT_NONEMPTY); ++ base::string16 email_domains_str; ++ for (size_t i = 0; i < domains.size(); ++i) { ++ email_domains_str += domains[i]; ++ if (i < domains.size() - 1) ++ email_domains_str += L", "; ++ } ++ return email_domains_str; ++ } ++}; ++ ++TEST_P(GcpGaiaCredentialBasePermittedAccountTest, PermittedAccounts) { ++ const base::string16 permitted_acounts = std::get<0>(GetParam()); ++ const base::string16 restricted_domains = std::get<1>(GetParam()); ++ ++ ASSERT_EQ(S_OK, ++ SetGlobalFlagForTesting(L"permitted_accounts", permitted_acounts)); ++ ASSERT_EQ(S_OK, SetGlobalFlagForTesting(L"domains_allowed_to_login", ++ restricted_domains)); ++ ++ // Create provider and start logon. ++ Microsoft::WRL::ComPtr cred; ++ ++ ASSERT_EQ(S_OK, InitializeProviderAndGetCredential(0, &cred)); ++ Microsoft::WRL::ComPtr test; ++ ASSERT_EQ(S_OK, cred.As(&test)); ++ ++ base::string16 email = L"user@test.com"; ++ base::string16 email_domain = email.substr(email.find(L"@") + 1); ++ ++ ASSERT_EQ(S_OK, test->SetGlsEmailAddress(base::UTF16ToUTF8(email))); ++ ++ bool allowed_email = permitted_acounts.empty() || ++ permitted_acounts.find(email) != base::string16::npos; ++ bool found_domain = ++ restricted_domains.find(email_domain) != base::string16::npos; ++ ++ if (!found_domain) ++ ASSERT_EQ(S_OK, test->SetDefaultExitCode(kUiecInvalidEmailDomain)); ++ ++ ASSERT_EQ(S_OK, StartLogonProcessAndWait()); ++ ++ if (allowed_email && found_domain) { ++ ASSERT_EQ(S_OK, FinishLogonProcess(true, true, 0)); ++ } else { ++ base::string16 expected_error_msg; ++ if (!found_domain) { ++ expected_error_msg = base::ReplaceStringPlaceholders( ++ GetStringResource(IDS_INVALID_EMAIL_DOMAIN_BASE), ++ {GetEmailDomainsPrintableString()}, nullptr); ++ } else { ++ expected_error_msg = GetStringResource(IDS_EMAIL_MISMATCH_BASE); ++ } ++ // Logon process should fail with the specified error message. ++ ASSERT_EQ(S_OK, FinishLogonProcess(false, false, expected_error_msg)); ++ } ++} ++ ++INSTANTIATE_TEST_SUITE_P( ++ All, ++ GcpGaiaCredentialBasePermittedAccountTest, ++ ::testing::Combine( ++ ::testing::Values(L"", ++ L"user@test.com", ++ L"other@test.com", ++ L"other@test.com,user@test.com"), ++ ::testing::Values(L"test.com", L"best.com", L"test.com,best.com"))); ++ + TEST_F(GcpGaiaCredentialBaseTest, StripEmailTLD) { + USES_CONVERSION; + // Create provider and start logon. +-- +2.28.0 + diff --git a/srcpkgs/electron9/files/patches/chromium-upstream-0008-Handle-lsa_account_rights-size-properly.patch b/srcpkgs/electron9/files/patches/chromium-upstream-0008-Handle-lsa_account_rights-size-properly.patch new file mode 100644 index 00000000000..5fd13d7ddf4 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-upstream-0008-Handle-lsa_account_rights-size-properly.patch @@ -0,0 +1,55 @@ +From bff845848fa339fc9bae70eef8943c4956b9a6db Mon Sep 17 00:00:00 2001 +From: Rakesh Soma +Date: Fri, 26 Jun 2020 23:55:46 +0000 +Subject: [PATCH 08/12] Handle lsa_account_rights size properly. + +Bug: 1099890 +Change-Id: Ib27d52be51b0067ef76c212aaa5e067ec20af6de +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2269882 +Commit-Queue: Rakesh Soma +Commit-Queue: Yusuf Sengul +Reviewed-by: Yusuf Sengul +Cr-Commit-Position: refs/heads/master@{#783200} +(cherry picked from commit 0070fe8bfa5126cebc78e1c22081f83b7f9c421c) + +NOTRY=true + +Change-Id: Ib27d52be51b0067ef76c212aaa5e067ec20af6de +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2270630 +Commit-Queue: Rakesh Soma +Reviewed-by: Rakesh Soma +Reviewed-by: Yusuf Sengul +Cr-Commit-Position: refs/branch-heads/4103@{#731} +Cr-Branched-From: 8ad47e8d21f6866e4a37f47d83a860d41debf514-refs/heads/master@{#756066} +--- + chrome/credential_provider/gaiacp/scoped_lsa_policy.cc | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/chrome/credential_provider/gaiacp/scoped_lsa_policy.cc b/chrome/credential_provider/gaiacp/scoped_lsa_policy.cc +index 425f305716d..5c05d08e81f 100644 +--- a/chrome/credential_provider/gaiacp/scoped_lsa_policy.cc ++++ b/chrome/credential_provider/gaiacp/scoped_lsa_policy.cc +@@ -133,7 +133,8 @@ HRESULT ScopedLsaPolicy::AddAccountRights( + InitLsaString(right.c_str(), &lsa_right); + lsa_rights.push_back(lsa_right); + } +- NTSTATUS sts = ::LsaAddAccountRights(handle_, sid, lsa_rights.data(), 1); ++ NTSTATUS sts = ++ ::LsaAddAccountRights(handle_, sid, lsa_rights.data(), lsa_rights.size()); + if (sts != STATUS_SUCCESS) { + HRESULT hr = HRESULT_FROM_NT(sts); + LOGFN(ERROR) << "LsaAddAccountRights sts=" << putHR(sts) +@@ -152,8 +153,8 @@ HRESULT ScopedLsaPolicy::RemoveAccountRights( + InitLsaString(right.c_str(), &lsa_right); + lsa_rights.push_back(lsa_right); + } +- NTSTATUS sts = +- ::LsaRemoveAccountRights(handle_, sid, FALSE, lsa_rights.data(), 1); ++ NTSTATUS sts = ::LsaRemoveAccountRights(handle_, sid, FALSE, ++ lsa_rights.data(), lsa_rights.size()); + if (sts != STATUS_SUCCESS) { + HRESULT hr = HRESULT_FROM_NT(sts); + LOGFN(ERROR) << "LsaRemoveAccountRights sts=" << putHR(sts) +-- +2.28.0 + diff --git a/srcpkgs/electron9/files/patches/chromium-upstream-0009-Incrementing-VERSION-to-83.0.4103.121.patch b/srcpkgs/electron9/files/patches/chromium-upstream-0009-Incrementing-VERSION-to-83.0.4103.121.patch new file mode 100644 index 00000000000..54822925344 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-upstream-0009-Incrementing-VERSION-to-83.0.4103.121.patch @@ -0,0 +1,29 @@ +From 9068067e3fc13cc7c89c04ec05271d27cb303810 Mon Sep 17 00:00:00 2001 +From: chrome-release-bot +Date: Sat, 27 Jun 2020 00:22:04 +0000 +Subject: [PATCH 09/12] Incrementing VERSION to 83.0.4103.121 + +TBR=kariah@chromium.org + +Change-Id: Ia91d140a59328480f389c94ab85715308bfee2ea +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2271260 +Reviewed-by: Chrome Release Bot (LUCI) +Cr-Commit-Position: refs/branch-heads/4103@{#732} +Cr-Branched-From: 8ad47e8d21f6866e4a37f47d83a860d41debf514-refs/heads/master@{#756066} +--- + chrome/VERSION | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/chrome/VERSION b/chrome/VERSION +index f7310a92cf3..ff22ff08a83 100644 +--- a/chrome/VERSION ++++ b/chrome/VERSION +@@ -1,4 +1,4 @@ + MAJOR=83 + MINOR=0 + BUILD=4103 +-PATCH=120 ++PATCH=121 +-- +2.28.0 + diff --git a/srcpkgs/electron9/files/patches/chromium-upstream-0010-Disable-flaky-DiceManageAccountBrowserTest.ClearMana.patch b/srcpkgs/electron9/files/patches/chromium-upstream-0010-Disable-flaky-DiceManageAccountBrowserTest.ClearMana.patch new file mode 100644 index 00000000000..b7c3dc5d912 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-upstream-0010-Disable-flaky-DiceManageAccountBrowserTest.ClearMana.patch @@ -0,0 +1,43 @@ +From 4f3d2dee87d40491ef4a2664e21168462f3bb681 Mon Sep 17 00:00:00 2001 +From: Alexander Hendrich +Date: Sat, 27 Jun 2020 01:33:00 +0000 +Subject: [PATCH 10/12] Disable flaky + DiceManageAccountBrowserTest.ClearManagedProfileOnStartup [M83 merge] + +TBR=msarda@chromium.org,hendrich@chromium.org + +(cherry picked from commit 9eeb72ff8110366b2501321d4b7f6e3e470796e6) + +Bug: 1075896 +Change-Id: I6c5e9c60fffae5bb9fcbb7b29fb3ed1d6f71fbfd +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2170026 +Reviewed-by: Alexander Hendrich +Commit-Queue: Alexander Hendrich +Cr-Original-Commit-Position: refs/heads/master@{#763258} +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2268386 +Reviewed-by: Carlos Knippschild +Commit-Queue: Carlos Knippschild +Cr-Commit-Position: refs/branch-heads/4103@{#733} +Cr-Branched-From: 8ad47e8d21f6866e4a37f47d83a860d41debf514-refs/heads/master@{#756066} +--- + chrome/browser/signin/dice_browsertest.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/chrome/browser/signin/dice_browsertest.cc b/chrome/browser/signin/dice_browsertest.cc +index e0733ccb9eb..b362f578882 100644 +--- a/chrome/browser/signin/dice_browsertest.cc ++++ b/chrome/browser/signin/dice_browsertest.cc +@@ -1015,8 +1015,9 @@ IN_PROC_BROWSER_TEST_F(DiceManageAccountBrowserTest, + prefs::kSigninAllowedOnNextStartup, false); + } + ++// TODO(https://crbug.com/1075896) disabling test due to flakiness + IN_PROC_BROWSER_TEST_F(DiceManageAccountBrowserTest, +- ClearManagedProfileOnStartup) { ++ DISABLED_ClearManagedProfileOnStartup) { + // Initial profile should have been deleted as sign-in and sign out were no + // longer allowed. + PrefService* local_state = g_browser_process->local_state(); +-- +2.28.0 + diff --git a/srcpkgs/electron9/files/patches/chromium-upstream-0011-Incrementing-VERSION-to-83.0.4103.122.patch b/srcpkgs/electron9/files/patches/chromium-upstream-0011-Incrementing-VERSION-to-83.0.4103.122.patch new file mode 100644 index 00000000000..a32b3908755 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-upstream-0011-Incrementing-VERSION-to-83.0.4103.122.patch @@ -0,0 +1,29 @@ +From 5277168d1691ce40fc04fb4adefd89d8eb39c81e Mon Sep 17 00:00:00 2001 +From: chrome-release-bot +Date: Sat, 27 Jun 2020 18:07:45 +0000 +Subject: [PATCH 11/12] Incrementing VERSION to 83.0.4103.122 + +TBR=lakpamarthy@chromium.org + +Change-Id: I5b90c234baff6204fb1684a4d99878771a112e38 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2271618 +Reviewed-by: Chrome Release Bot (LUCI) +Cr-Commit-Position: refs/branch-heads/4103@{#734} +Cr-Branched-From: 8ad47e8d21f6866e4a37f47d83a860d41debf514-refs/heads/master@{#756066} +--- + chrome/VERSION | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/chrome/VERSION b/chrome/VERSION +index ff22ff08a83..ea9ff344413 100644 +--- a/chrome/VERSION ++++ b/chrome/VERSION +@@ -1,4 +1,4 @@ + MAJOR=83 + MINOR=0 + BUILD=4103 +-PATCH=121 ++PATCH=122 +-- +2.28.0 + diff --git a/srcpkgs/electron9/files/patches/chromium-v8-remove-soon-to-be-removed-getAllFieldPositions.patch b/srcpkgs/electron9/files/patches/chromium-v8-remove-soon-to-be-removed-getAllFieldPositions.patch new file mode 100644 index 00000000000..d251ceb6ac8 --- /dev/null +++ b/srcpkgs/electron9/files/patches/chromium-v8-remove-soon-to-be-removed-getAllFieldPositions.patch @@ -0,0 +1,172 @@ +From 3f8dc4b2e5baf77b463334c769af85b79d8c1463 Mon Sep 17 00:00:00 2001 +From: Frank Tang +Date: Fri, 3 Apr 2020 23:13:54 -0700 +Subject: [PATCH] [intl] Remove soon-to-be removed getAllFieldPositions + +Needed to land ICU67.1 soon. + +Bug: v8:10393 +Change-Id: I3c7737ca600d6ccfdc46ffaddfb318ce60bc7618 +Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2136489 +Reviewed-by: Jakob Kummerow +Commit-Queue: Frank Tang +Cr-Commit-Position: refs/heads/master@{#67027} +--- + src/objects/js-number-format.cc | 77 +++++++++++++++++---------------- + 1 file changed, 39 insertions(+), 38 deletions(-) + +diff --git a/v8/src/objects/js-number-format.cc b/v8/src/objects/js-number-format.cc +index ad831c5c36..bcd44031d5 100644 +--- a/v8/src/objects/js-number-format.cc ++++ b/v8/src/objects/js-number-format.cc +@@ -1241,44 +1241,33 @@ MaybeHandle JSNumberFormat::New(Isolate* isolate, + } + + namespace { +-Maybe IcuFormatNumber( ++Maybe IcuFormatNumber( + Isolate* isolate, + const icu::number::LocalizedNumberFormatter& number_format, +- Handle numeric_obj, icu::FieldPositionIterator* fp_iter) { ++ Handle numeric_obj, icu::number::FormattedNumber* formatted) { + // If it is BigInt, handle it differently. + UErrorCode status = U_ZERO_ERROR; +- icu::number::FormattedNumber formatted; + if (numeric_obj->IsBigInt()) { + Handle big_int = Handle::cast(numeric_obj); + Handle big_int_string; + ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, big_int_string, + BigInt::ToString(isolate, big_int), +- Nothing()); +- formatted = number_format.formatDecimal( ++ Nothing()); ++ *formatted = number_format.formatDecimal( + {big_int_string->ToCString().get(), big_int_string->length()}, status); + } else { + double number = numeric_obj->IsNaN() + ? std::numeric_limits::quiet_NaN() + : numeric_obj->Number(); +- formatted = number_format.formatDouble(number, status); ++ *formatted = number_format.formatDouble(number, status); + } + if (U_FAILURE(status)) { + // This happen because of icu data trimming trim out "unit". + // See https://bugs.chromium.org/p/v8/issues/detail?id=8641 +- THROW_NEW_ERROR_RETURN_VALUE(isolate, +- NewTypeError(MessageTemplate::kIcuError), +- Nothing()); +- } +- if (fp_iter) { +- formatted.getAllFieldPositions(*fp_iter, status); +- } +- icu::UnicodeString result = formatted.toString(status); +- if (U_FAILURE(status)) { +- THROW_NEW_ERROR_RETURN_VALUE(isolate, +- NewTypeError(MessageTemplate::kIcuError), +- Nothing()); ++ THROW_NEW_ERROR_RETURN_VALUE( ++ isolate, NewTypeError(MessageTemplate::kIcuError), Nothing()); + } +- return Just(result); ++ return Just(true); + } + + } // namespace +@@ -1289,10 +1278,16 @@ MaybeHandle JSNumberFormat::FormatNumeric( + Handle numeric_obj) { + DCHECK(numeric_obj->IsNumeric()); + +- Maybe maybe_format = +- IcuFormatNumber(isolate, number_format, numeric_obj, nullptr); ++ icu::number::FormattedNumber formatted; ++ Maybe maybe_format = ++ IcuFormatNumber(isolate, number_format, numeric_obj, &formatted); + MAYBE_RETURN(maybe_format, Handle()); +- return Intl::ToString(isolate, maybe_format.FromJust()); ++ UErrorCode status = U_ZERO_ERROR; ++ icu::UnicodeString result = formatted.toString(status); ++ if (U_FAILURE(status)) { ++ THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kIcuError), String); ++ } ++ return Intl::ToString(isolate, result); + } + + namespace { +@@ -1405,12 +1400,18 @@ std::vector FlattenRegionsToParts( + } + + namespace { +-Maybe ConstructParts(Isolate* isolate, const icu::UnicodeString& formatted, +- icu::FieldPositionIterator* fp_iter, ++Maybe ConstructParts(Isolate* isolate, ++ icu::number::FormattedNumber* formatted, + Handle result, int start_index, + Handle numeric_obj, bool style_is_unit) { ++ UErrorCode status = U_ZERO_ERROR; ++ icu::UnicodeString formatted_text = formatted->toString(status); ++ if (U_FAILURE(status)) { ++ THROW_NEW_ERROR_RETURN_VALUE( ++ isolate, NewTypeError(MessageTemplate::kIcuError), Nothing()); ++ } + DCHECK(numeric_obj->IsNumeric()); +- int32_t length = formatted.length(); ++ int32_t length = formatted_text.length(); + int index = start_index; + if (length == 0) return Just(index); + +@@ -1419,13 +1420,14 @@ Maybe ConstructParts(Isolate* isolate, const icu::UnicodeString& formatted, + // other region covers some part of the formatted string. It's possible + // there's another field with exactly the same begin and end as this backdrop, + // in which case the backdrop's field_id of -1 will give it lower priority. +- regions.push_back(NumberFormatSpan(-1, 0, formatted.length())); ++ regions.push_back(NumberFormatSpan(-1, 0, formatted_text.length())); + + { +- icu::FieldPosition fp; +- while (fp_iter->next(fp)) { +- regions.push_back(NumberFormatSpan(fp.getField(), fp.getBeginIndex(), +- fp.getEndIndex())); ++ icu::ConstrainedFieldPosition cfp; ++ cfp.constrainCategory(UFIELD_CATEGORY_NUMBER); ++ while (formatted->nextPosition(cfp, status)) { ++ regions.push_back( ++ NumberFormatSpan(cfp.getField(), cfp.getStart(), cfp.getLimit())); + } + } + +@@ -1447,7 +1449,7 @@ Maybe ConstructParts(Isolate* isolate, const icu::UnicodeString& formatted, + Handle substring; + ASSIGN_RETURN_ON_EXCEPTION_VALUE( + isolate, substring, +- Intl::ToString(isolate, formatted, part.begin_pos, part.end_pos), ++ Intl::ToString(isolate, formatted_text, part.begin_pos, part.end_pos), + Nothing()); + Intl::AddElement(isolate, result, index, field_type_string, substring); + ++index; +@@ -1467,20 +1469,19 @@ MaybeHandle JSNumberFormat::FormatToParts( + number_format->icu_number_formatter().raw(); + CHECK_NOT_NULL(fmt); + +- icu::FieldPositionIterator fp_iter; +- Maybe maybe_format = +- IcuFormatNumber(isolate, *fmt, numeric_obj, &fp_iter); ++ icu::number::FormattedNumber formatted; ++ Maybe maybe_format = ++ IcuFormatNumber(isolate, *fmt, numeric_obj, &formatted); + MAYBE_RETURN(maybe_format, Handle()); +- + UErrorCode status = U_ZERO_ERROR; ++ + bool style_is_unit = + Style::UNIT == StyleFromSkeleton(fmt->toSkeleton(status)); + CHECK(U_SUCCESS(status)); + + Handle result = factory->NewJSArray(0); +- Maybe maybe_format_to_parts = +- ConstructParts(isolate, maybe_format.FromJust(), &fp_iter, result, 0, +- numeric_obj, style_is_unit); ++ Maybe maybe_format_to_parts = ConstructParts( ++ isolate, &formatted, result, 0, numeric_obj, style_is_unit); + MAYBE_RETURN(maybe_format_to_parts, Handle()); + + return result; diff --git a/srcpkgs/electron9/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch b/srcpkgs/electron9/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch new file mode 100644 index 00000000000..916dba9dc3b --- /dev/null +++ b/srcpkgs/electron9/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch @@ -0,0 +1,42 @@ +From ff4122f236b70c272c746d0c336cdbd588d78cd1 Mon Sep 17 00:00:00 2001 +From: Elvis Pranskevichus +Date: Thu, 12 Dec 2019 16:12:18 -0500 +Subject: [PATCH] Add a script to list patch targets + +--- + script/list_patch_targets.py | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + create mode 100755 script/list_patch_targets.py + +diff --git a/script/list_patch_targets.py b/script/list_patch_targets.py +new file mode 100755 +index 000000000..55173bac9 +--- /dev/null ++++ b/script/list_patch_targets.py +@@ -0,0 +1,23 @@ ++#!/usr/bin/env python ++ ++import argparse ++import json ++ ++ ++def parse_args(): ++ parser = argparse.ArgumentParser(description='Apply Electron patches') ++ parser.add_argument('config', nargs='+', ++ type=argparse.FileType('r'), ++ help='patches\' config(s) in the JSON format') ++ return parser.parse_args() ++ ++ ++def main(): ++ configs = parse_args().config ++ for config_json in configs: ++ for patch_dir, repo in json.load(config_json).iteritems(): ++ print(repo) ++ ++ ++if __name__ == '__main__': ++ main() +-- +2.23.0 + diff --git a/srcpkgs/electron9/files/patches/electron-Build-fixes.patch.patch b/srcpkgs/electron9/files/patches/electron-Build-fixes.patch.patch new file mode 100644 index 00000000000..298bfa9bcb2 --- /dev/null +++ b/srcpkgs/electron9/files/patches/electron-Build-fixes.patch.patch @@ -0,0 +1,47 @@ +diff --git a/build/args/release.gn b/build/args/release.gn +index e5017f6e1..59207b389 100644 +--- a/build/args/release.gn ++++ b/build/args/release.gn +@@ -1,6 +1,4 @@ + import("all.gn") +-is_component_build = false +-is_official_build = true + + # This may be guarded behind is_chrome_branded alongside + # proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321, +@@ -8,9 +6,3 @@ is_official_build = true + # The initialization of the decoder depends on whether ffmpeg has + # been built with H.264 support. + rtc_use_h264 = proprietary_codecs +- +-# By default, Electron builds ffmpeg with proprietary codecs enabled. In order +-# to facilitate users who don't want to ship proprietary codecs in ffmpeg, or +-# who have an LGPL requirement to ship ffmpeg as a dynamically linked library, +-# we build ffmpeg as a shared library. +-is_component_ffmpeg = true +diff --git a/build/npm.gni b/build/npm.gni +index a1987d095..fb33a14c3 100644 +--- a/build/npm.gni ++++ b/build/npm.gni +@@ -35,7 +35,6 @@ template("npm_action") { + if (!defined(deps)) { + deps = [] + } +- deps += [ ":npm_pre_flight_" + target_name ] + + script = "//electron/build/npm-run.py" + args = [ +diff --git a/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch b/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch +index 0dc9916be..7eaa46bf5 100644 +--- a/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch ++++ b/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch +@@ -30,7 +30,7 @@ + + # these values being accurate. + + 'build_v8_with_gn': 'false', + + 'enable_lto%': 'false', +-+ +++ 'openssl_fips': '', + 'conditions': [ + ['target_arch=="arm64"', { + # Disabled pending https://github.com/nodejs/node/issues/23913. + diff --git a/srcpkgs/electron9/files/patches/electron-dont-assume-python-is-python2.patch b/srcpkgs/electron9/files/patches/electron-dont-assume-python-is-python2.patch new file mode 100644 index 00000000000..fb134748025 --- /dev/null +++ b/srcpkgs/electron9/files/patches/electron-dont-assume-python-is-python2.patch @@ -0,0 +1,17 @@ +--- a/build/zip.py.orig 2020-04-27 17:59:53.499281667 +0200 ++++ b/build/zip.py 2020-04-27 17:59:57.655839143 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2 + from __future__ import print_function + import os + import subprocess + +--- a/build/npm-run.py.orig 2020-04-27 17:59:50.829351807 +0200 ++++ b/build/npm-run.py 2020-04-27 18:00:02.702373256 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2 + from __future__ import print_function + import os + import subprocess diff --git a/srcpkgs/electron9/files/patches/electron-exluce-content-test-patches.patch b/srcpkgs/electron9/files/patches/electron-exluce-content-test-patches.patch new file mode 100644 index 00000000000..6e1bb9184a5 --- /dev/null +++ b/srcpkgs/electron9/files/patches/electron-exluce-content-test-patches.patch @@ -0,0 +1,10 @@ +--- a/script/apply_all_patches.py 2020-08-22 17:46:41.796707506 +0200 ++++ - 2020-08-22 17:47:05.887813512 +0200 +@@ -14,6 +14,7 @@ + for patch_dir, repo in dirs.items(): + git.import_patches(repo=repo, patch_data=patch_from_dir(patch_dir), + threeway=threeway is not None, ++ exclude=['content/test/**'], + committer_name="Electron Scripts", committer_email="scripts@electron") + + diff --git a/srcpkgs/electron9/files/sndio-files/audio_manager_openbsd.cc b/srcpkgs/electron9/files/sndio-files/audio_manager_openbsd.cc new file mode 100644 index 00000000000..2c7aa8efa66 --- /dev/null +++ b/srcpkgs/electron9/files/sndio-files/audio_manager_openbsd.cc @@ -0,0 +1,148 @@ +// 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 "base/metrics/histogram_macros.h" +#include "base/memory/ptr_util.h" + +#include "media/audio/openbsd/audio_manager_openbsd.h" + +#include "media/audio/audio_device_description.h" +#include "media/audio/audio_output_dispatcher.h" +#include "media/audio/sndio/sndio_input.h" +#include "media/audio/sndio/sndio_output.h" +#include "media/base/limits.h" +#include "media/base/media_switches.h" + +namespace media { + +// Maximum number of output streams that can be open simultaneously. +static const int kMaxOutputStreams = 4; + +// Default sample rate for input and output streams. +static const int kDefaultSampleRate = 48000; + +void AddDefaultDevice(AudioDeviceNames* device_names) { + DCHECK(device_names->empty()); + device_names->push_front(AudioDeviceName::CreateDefault()); +} + +bool AudioManagerOpenBSD::HasAudioOutputDevices() { + return true; +} + +bool AudioManagerOpenBSD::HasAudioInputDevices() { + return true; +} + +void AudioManagerOpenBSD::GetAudioInputDeviceNames( + AudioDeviceNames* device_names) { + DCHECK(device_names->empty()); + AddDefaultDevice(device_names); +} + +void AudioManagerOpenBSD::GetAudioOutputDeviceNames( + AudioDeviceNames* device_names) { + AddDefaultDevice(device_names); +} + +const char* AudioManagerOpenBSD::GetName() { + return "SNDIO"; +} + +AudioParameters AudioManagerOpenBSD::GetInputStreamParameters( + const std::string& device_id) { + static const int kDefaultInputBufferSize = 1024; + + int user_buffer_size = GetUserBufferSize(); + int buffer_size = user_buffer_size ? + user_buffer_size : kDefaultInputBufferSize; + + return AudioParameters( + AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, + kDefaultSampleRate, buffer_size); +} + +AudioManagerOpenBSD::AudioManagerOpenBSD(std::unique_ptr audio_thread, + AudioLogFactory* audio_log_factory) + : AudioManagerBase(std::move(audio_thread), + audio_log_factory) { + DLOG(WARNING) << "AudioManagerOpenBSD"; + SetMaxOutputStreamsAllowed(kMaxOutputStreams); +} + +AudioManagerOpenBSD::~AudioManagerOpenBSD() { + Shutdown(); +} + +AudioOutputStream* AudioManagerOpenBSD::MakeLinearOutputStream( + const AudioParameters& params, + const LogCallback& log_callback) { + DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); + return MakeOutputStream(params); +} + +AudioOutputStream* AudioManagerOpenBSD::MakeLowLatencyOutputStream( + const AudioParameters& params, + const std::string& device_id, + const LogCallback& log_callback) { + DLOG_IF(ERROR, !device_id.empty()) << "Not implemented!"; + DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); + return MakeOutputStream(params); +} + +AudioInputStream* AudioManagerOpenBSD::MakeLinearInputStream( + const AudioParameters& params, + const std::string& device_id, + const LogCallback& log_callback) { + DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); + return MakeInputStream(params); +} + +AudioInputStream* AudioManagerOpenBSD::MakeLowLatencyInputStream( + const AudioParameters& params, + const std::string& device_id, + const LogCallback& log_callback) { + DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); + return MakeInputStream(params); +} + +AudioParameters AudioManagerOpenBSD::GetPreferredOutputStreamParameters( + const std::string& output_device_id, + const AudioParameters& input_params) { + // TODO(tommi): Support |output_device_id|. + DLOG_IF(ERROR, !output_device_id.empty()) << "Not implemented!"; + static const int kDefaultOutputBufferSize = 2048; + + ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; + int sample_rate = kDefaultSampleRate; + int buffer_size = kDefaultOutputBufferSize; + if (input_params.IsValid()) { + sample_rate = input_params.sample_rate(); + channel_layout = input_params.channel_layout(); + buffer_size = std::min(buffer_size, input_params.frames_per_buffer()); + } + + int user_buffer_size = GetUserBufferSize(); + if (user_buffer_size) + buffer_size = user_buffer_size; + + return AudioParameters( + AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, + sample_rate, buffer_size); +} + +AudioInputStream* AudioManagerOpenBSD::MakeInputStream( + const AudioParameters& params) { + DLOG(WARNING) << "MakeInputStream"; + return new SndioAudioInputStream(this, + AudioDeviceDescription::kDefaultDeviceId, params); +} + +AudioOutputStream* AudioManagerOpenBSD::MakeOutputStream( + const AudioParameters& params) { + DLOG(WARNING) << "MakeOutputStream"; + return new SndioAudioOutputStream(params, this); +} + +} // namespace media diff --git a/srcpkgs/electron9/files/sndio-files/audio_manager_openbsd.h b/srcpkgs/electron9/files/sndio-files/audio_manager_openbsd.h new file mode 100644 index 00000000000..8c99db966d6 --- /dev/null +++ b/srcpkgs/electron9/files/sndio-files/audio_manager_openbsd.h @@ -0,0 +1,65 @@ +// 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. + +#ifndef MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_H_ +#define MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_H_ + +#include + +#include "base/compiler_specific.h" +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "base/threading/thread.h" +#include "media/audio/audio_manager_base.h" + +namespace media { + +class MEDIA_EXPORT AudioManagerOpenBSD : public AudioManagerBase { + public: + AudioManagerOpenBSD(std::unique_ptr audio_thread, + AudioLogFactory* audio_log_factory); + ~AudioManagerOpenBSD() override; + + // Implementation of AudioManager. + bool HasAudioOutputDevices() override; + bool HasAudioInputDevices() override; + void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; + void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; + AudioParameters GetInputStreamParameters( + const std::string& device_id) override; + const char* GetName() override; + + // Implementation of AudioManagerBase. + AudioOutputStream* MakeLinearOutputStream( + const AudioParameters& params, + const LogCallback& log_callback) override; + AudioOutputStream* MakeLowLatencyOutputStream( + const AudioParameters& params, + const std::string& device_id, + const LogCallback& log_callback) override; + AudioInputStream* MakeLinearInputStream( + const AudioParameters& params, + const std::string& device_id, + const LogCallback& log_callback) override; + AudioInputStream* MakeLowLatencyInputStream( + const AudioParameters& params, + const std::string& device_id, + const LogCallback& log_callback) override; + + protected: + AudioParameters GetPreferredOutputStreamParameters( + const std::string& output_device_id, + const AudioParameters& input_params) override; + + private: + // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream. + AudioOutputStream* MakeOutputStream(const AudioParameters& params); + AudioInputStream* MakeInputStream(const AudioParameters& params); + + DISALLOW_COPY_AND_ASSIGN(AudioManagerOpenBSD); +}; + +} // namespace media + +#endif // MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_H_ diff --git a/srcpkgs/electron9/files/sndio-files/sndio_input.cc b/srcpkgs/electron9/files/sndio-files/sndio_input.cc new file mode 100644 index 00000000000..6c7bc8b8025 --- /dev/null +++ b/srcpkgs/electron9/files/sndio-files/sndio_input.cc @@ -0,0 +1,201 @@ +// Copyright 2013 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 "base/bind.h" +#include "base/logging.h" +#include "base/macros.h" +#include "base/message_loop/message_loop.h" +#include "media/base/audio_timestamp_helper.h" +#include "media/audio/openbsd/audio_manager_openbsd.h" +#include "media/audio/audio_manager.h" +#include "media/audio/sndio/sndio_input.h" + +namespace media { + +static const SampleFormat kSampleFormat = kSampleFormatS16; + +void SndioAudioInputStream::OnMoveCallback(void *arg, int delta) +{ + SndioAudioInputStream* self = static_cast(arg); + + self->hw_delay += delta; +} + +void *SndioAudioInputStream::ThreadEntry(void *arg) { + SndioAudioInputStream* self = static_cast(arg); + + self->ThreadLoop(); + return NULL; +} + +SndioAudioInputStream::SndioAudioInputStream(AudioManagerBase* manager, + const std::string& device_name, + const AudioParameters& params) + : manager(manager), + params(params), + audio_bus(AudioBus::Create(params)), + state(kClosed) { +} + +SndioAudioInputStream::~SndioAudioInputStream() { + if (state != kClosed) + Close(); +} + +bool SndioAudioInputStream::Open() { + struct sio_par par; + int sig; + + if (state != kClosed) + return false; + + if (params.format() != AudioParameters::AUDIO_PCM_LINEAR && + params.format() != AudioParameters::AUDIO_PCM_LOW_LATENCY) { + LOG(WARNING) << "Unsupported audio format."; + return false; + } + + sio_initpar(&par); + par.rate = params.sample_rate(); + par.rchan = params.channels(); + par.bits = SampleFormatToBitsPerChannel(kSampleFormat); + par.bps = par.bits / 8; + par.sig = sig = par.bits != 8 ? 1 : 0; + par.le = SIO_LE_NATIVE; + par.appbufsz = params.frames_per_buffer(); + + hdl = sio_open(SIO_DEVANY, SIO_REC, 0); + + if (hdl == NULL) { + LOG(ERROR) << "Couldn't open audio device."; + return false; + } + + if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) { + LOG(ERROR) << "Couldn't set audio parameters."; + goto bad_close; + } + + if (par.rate != (unsigned int)params.sample_rate() || + par.rchan != (unsigned int)params.channels() || + par.bits != (unsigned int)SampleFormatToBitsPerChannel(kSampleFormat) || + par.sig != (unsigned int)sig || + (par.bps > 1 && par.le != SIO_LE_NATIVE) || + (par.bits != par.bps * 8)) { + LOG(ERROR) << "Unsupported audio parameters."; + goto bad_close; + } + state = kStopped; + buffer = new char[audio_bus->frames() * params.GetBytesPerFrame(kSampleFormat)]; + sio_onmove(hdl, &OnMoveCallback, this); + return true; +bad_close: + sio_close(hdl); + return false; +} + +void SndioAudioInputStream::Start(AudioInputCallback* cb) { + + StartAgc(); + + state = kRunning; + hw_delay = 0; + callback = cb; + sio_start(hdl); + if (pthread_create(&thread, NULL, &ThreadEntry, this) != 0) { + LOG(ERROR) << "Failed to create real-time thread for recording."; + sio_stop(hdl); + state = kStopped; + } +} + +void SndioAudioInputStream::Stop() { + + if (state == kStopped) + return; + + state = kStopWait; + pthread_join(thread, NULL); + sio_stop(hdl); + state = kStopped; + + StopAgc(); +} + +void SndioAudioInputStream::Close() { + + if (state == kClosed) + return; + + if (state == kRunning) + Stop(); + + state = kClosed; + delete [] buffer; + sio_close(hdl); + + manager->ReleaseInputStream(this); +} + +double SndioAudioInputStream::GetMaxVolume() { + // Not supported + return 0.0; +} + +void SndioAudioInputStream::SetVolume(double volume) { + // Not supported. Do nothing. +} + +double SndioAudioInputStream::GetVolume() { + // Not supported. + return 0.0; +} + +bool SndioAudioInputStream::IsMuted() { + // Not supported. + return false; +} + +void SndioAudioInputStream::SetOutputDeviceForAec( + const std::string& output_device_id) { + // Not supported. +} + +void SndioAudioInputStream::ThreadLoop(void) { + size_t todo, n; + char *data; + unsigned int nframes; + double normalized_volume = 0.0; + + nframes = audio_bus->frames(); + + while (state == kRunning && !sio_eof(hdl)) { + + GetAgcVolume(&normalized_volume); + + // read one block + todo = nframes * params.GetBytesPerFrame(kSampleFormat); + data = buffer; + while (todo > 0) { + n = sio_read(hdl, data, todo); + if (n == 0) + return; // unrecoverable I/O error + todo -= n; + data += n; + } + hw_delay -= nframes; + + // convert frames count to TimeDelta + const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay, + params.sample_rate()); + + // push into bus + audio_bus->FromInterleaved(buffer, nframes, SampleFormatToBytesPerChannel(kSampleFormat)); + + // invoke callback + callback->OnData(audio_bus.get(), base::TimeTicks::Now() - delay, 1.); + } +} + +} // namespace media diff --git a/srcpkgs/electron9/files/sndio-files/sndio_input.h b/srcpkgs/electron9/files/sndio-files/sndio_input.h new file mode 100644 index 00000000000..d868e0469db --- /dev/null +++ b/srcpkgs/electron9/files/sndio-files/sndio_input.h @@ -0,0 +1,91 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_ +#define MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_ + +#include +#include +#include + +#include "base/compiler_specific.h" +#include "base/macros.h" +#include "base/memory/weak_ptr.h" +#include "base/time/time.h" +#include "media/audio/agc_audio_stream.h" +#include "media/audio/audio_io.h" +#include "media/audio/audio_device_description.h" +#include "media/base/audio_parameters.h" + +namespace media { + +class AudioManagerBase; + +// Implementation of AudioOutputStream using sndio(7) +class SndioAudioInputStream : public AgcAudioStream { + public: + // Pass this to the constructor if you want to attempt auto-selection + // of the audio recording device. + static const char kAutoSelectDevice[]; + + // Create a PCM Output stream for the SNDIO device identified by + // |device_name|. If unsure of what to use for |device_name|, use + // |kAutoSelectDevice|. + SndioAudioInputStream(AudioManagerBase* audio_manager, + const std::string& device_name, + const AudioParameters& params); + + ~SndioAudioInputStream() override; + + // Implementation of AudioInputStream. + bool Open() override; + void Start(AudioInputCallback* callback) override; + void Stop() override; + void Close() override; + double GetMaxVolume() override; + void SetVolume(double volume) override; + double GetVolume() override; + bool IsMuted() override; + void SetOutputDeviceForAec(const std::string& output_device_id) override; + + private: + + enum StreamState { + kClosed, // Not opened yet + kStopped, // Device opened, but not started yet + kRunning, // Started, device playing + kStopWait // Stopping, waiting for the real-time thread to exit + }; + + // C-style call-backs + static void OnMoveCallback(void *arg, int delta); + static void* ThreadEntry(void *arg); + + // Continuously moves data from the device to the consumer + void ThreadLoop(); + // Our creator, the audio manager needs to be notified when we close. + AudioManagerBase* manager; + // Parameters of the source + AudioParameters params; + // We store data here for consumer + std::unique_ptr audio_bus; + // Call-back that consumes recorded data + AudioInputCallback* callback; // Valid during a recording session. + // Handle of the audio device + struct sio_hdl* hdl; + // Current state of the stream + enum StreamState state; + // High priority thread running ThreadLoop() + pthread_t thread; + // Number of frames buffered in the hardware + int hw_delay; + // Temporary buffer where data is stored sndio-compatible format + char* buffer; + + DISALLOW_COPY_AND_ASSIGN(SndioAudioInputStream); +}; + +} // namespace media + +#endif // MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_ diff --git a/srcpkgs/electron9/files/sndio-files/sndio_output.cc b/srcpkgs/electron9/files/sndio-files/sndio_output.cc new file mode 100644 index 00000000000..a6719f9aac8 --- /dev/null +++ b/srcpkgs/electron9/files/sndio-files/sndio_output.cc @@ -0,0 +1,183 @@ +// 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 "base/logging.h" +#include "base/time/time.h" +#include "base/time/default_tick_clock.h" +#include "media/audio/audio_manager_base.h" +#include "media/base/audio_timestamp_helper.h" +#include "media/audio/sndio/sndio_output.h" + +namespace media { + +static const SampleFormat kSampleFormat = kSampleFormatS16; + +void SndioAudioOutputStream::OnMoveCallback(void *arg, int delta) { + SndioAudioOutputStream* self = static_cast(arg); + + self->hw_delay -= delta; +} + +void SndioAudioOutputStream::OnVolCallback(void *arg, unsigned int vol) { + SndioAudioOutputStream* self = static_cast(arg); + + self->vol = vol; +} + +void *SndioAudioOutputStream::ThreadEntry(void *arg) { + SndioAudioOutputStream* self = static_cast(arg); + + self->ThreadLoop(); + return NULL; +} + +SndioAudioOutputStream::SndioAudioOutputStream(const AudioParameters& params, + AudioManagerBase* manager) + : manager(manager), + params(params), + audio_bus(AudioBus::Create(params)), + state(kClosed), + mutex(PTHREAD_MUTEX_INITIALIZER) { +} + +SndioAudioOutputStream::~SndioAudioOutputStream() { + if (state != kClosed) + Close(); +} + +bool SndioAudioOutputStream::Open() { + struct sio_par par; + int sig; + + if (params.format() != AudioParameters::AUDIO_PCM_LINEAR && + params.format() != AudioParameters::AUDIO_PCM_LOW_LATENCY) { + LOG(WARNING) << "Unsupported audio format."; + return false; + } + sio_initpar(&par); + par.rate = params.sample_rate(); + par.pchan = params.channels(); + par.bits = SampleFormatToBitsPerChannel(kSampleFormat); + par.bps = par.bits / 8; + par.sig = sig = par.bits != 8 ? 1 : 0; + par.le = SIO_LE_NATIVE; + par.appbufsz = params.frames_per_buffer(); + + hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0); + if (hdl == NULL) { + LOG(ERROR) << "Couldn't open audio device."; + return false; + } + if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) { + LOG(ERROR) << "Couldn't set audio parameters."; + goto bad_close; + } + if (par.rate != (unsigned int)params.sample_rate() || + par.pchan != (unsigned int)params.channels() || + par.bits != (unsigned int)SampleFormatToBitsPerChannel(kSampleFormat) || + par.sig != (unsigned int)sig || + (par.bps > 1 && par.le != SIO_LE_NATIVE) || + (par.bits != par.bps * 8)) { + LOG(ERROR) << "Unsupported audio parameters."; + goto bad_close; + } + state = kStopped; + volpending = 0; + vol = 0; + buffer = new char[audio_bus->frames() * params.GetBytesPerFrame(kSampleFormat)]; + sio_onmove(hdl, &OnMoveCallback, this); + sio_onvol(hdl, &OnVolCallback, this); + return true; + bad_close: + sio_close(hdl); + return false; +} + +void SndioAudioOutputStream::Close() { + if (state == kClosed) + return; + if (state == kRunning) + Stop(); + state = kClosed; + delete [] buffer; + sio_close(hdl); + manager->ReleaseOutputStream(this); // Calls the destructor +} + +void SndioAudioOutputStream::Start(AudioSourceCallback* callback) { + state = kRunning; + hw_delay = 0; + source = callback; + sio_start(hdl); + if (pthread_create(&thread, NULL, &ThreadEntry, this) != 0) { + LOG(ERROR) << "Failed to create real-time thread."; + sio_stop(hdl); + state = kStopped; + } +} + +void SndioAudioOutputStream::Stop() { + if (state == kStopped) + return; + state = kStopWait; + pthread_join(thread, NULL); + sio_stop(hdl); + state = kStopped; +} + +void SndioAudioOutputStream::SetVolume(double v) { + pthread_mutex_lock(&mutex); + vol = v * SIO_MAXVOL; + volpending = 1; + pthread_mutex_unlock(&mutex); +} + +void SndioAudioOutputStream::GetVolume(double* v) { + pthread_mutex_lock(&mutex); + *v = vol * (1. / SIO_MAXVOL); + pthread_mutex_unlock(&mutex); +} + +// This stream is always used with sub second buffer sizes, where it's +// sufficient to simply always flush upon Start(). +void SndioAudioOutputStream::Flush() {} + +void SndioAudioOutputStream::ThreadLoop(void) { + int avail, count, result; + + while (state == kRunning) { + // Update volume if needed + pthread_mutex_lock(&mutex); + if (volpending) { + volpending = 0; + sio_setvol(hdl, vol); + } + pthread_mutex_unlock(&mutex); + + // Get data to play + const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay, + params.sample_rate()); + count = source->OnMoreData(delay, base::TimeTicks::Now(), 0, audio_bus.get()); + audio_bus->ToInterleaved(count, SampleFormatToBytesPerChannel(kSampleFormat), buffer); + if (count == 0) { + // We have to submit something to the device + count = audio_bus->frames(); + memset(buffer, 0, count * params.GetBytesPerFrame(kSampleFormat)); + LOG(WARNING) << "No data to play, running empty cycle."; + } + + // Submit data to the device + avail = count * params.GetBytesPerFrame(kSampleFormat); + result = sio_write(hdl, buffer, avail); + if (result == 0) { + LOG(WARNING) << "Audio device disconnected."; + break; + } + + // Update hardware pointer + hw_delay += count; + } +} + +} // namespace media diff --git a/srcpkgs/electron9/files/sndio-files/sndio_output.h b/srcpkgs/electron9/files/sndio-files/sndio_output.h new file mode 100644 index 00000000000..ead220ca96e --- /dev/null +++ b/srcpkgs/electron9/files/sndio-files/sndio_output.h @@ -0,0 +1,86 @@ +// 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. + +#ifndef MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_ +#define MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_ + +#include +#include + +#include "base/time/tick_clock.h" +#include "base/time/time.h" +#include "media/audio/audio_io.h" + +namespace media { + +class AudioManagerBase; + +// Implementation of AudioOutputStream using sndio(7) +class SndioAudioOutputStream : public AudioOutputStream { + public: + // The manager is creating this object + SndioAudioOutputStream(const AudioParameters& params, + AudioManagerBase* manager); + virtual ~SndioAudioOutputStream(); + + // Implementation of AudioOutputStream. + bool Open() override; + void Close() override; + void Start(AudioSourceCallback* callback) override; + void Stop() override; + void SetVolume(double volume) override; + void GetVolume(double* volume) override; + void Flush() override; + + friend void sndio_onmove(void *arg, int delta); + friend void sndio_onvol(void *arg, unsigned int vol); + friend void *sndio_threadstart(void *arg); + + private: + enum StreamState { + kClosed, // Not opened yet + kStopped, // Device opened, but not started yet + kRunning, // Started, device playing + kStopWait // Stopping, waiting for the real-time thread to exit + }; + + // C-style call-backs + static void OnMoveCallback(void *arg, int delta); + static void OnVolCallback(void *arg, unsigned int vol); + static void* ThreadEntry(void *arg); + + // Continuously moves data from the producer to the device + void ThreadLoop(void); + + // Our creator, the audio manager needs to be notified when we close. + AudioManagerBase* manager; + // Parameters of the source + AudioParameters params; + // Source stores data here + std::unique_ptr audio_bus; + // Call-back that produces data to play + AudioSourceCallback* source; + // Handle of the audio device + struct sio_hdl* hdl; + // Current state of the stream + enum StreamState state; + // High priority thread running ThreadLoop() + pthread_t thread; + // Protects vol, volpending and hw_delay + pthread_mutex_t mutex; + // Current volume in the 0..SIO_MAXVOL range + int vol; + // Set to 1 if volumes must be refreshed in the realtime thread + int volpending; + // Number of frames buffered in the hardware + int hw_delay; + // Temporary buffer where data is stored sndio-compatible format + char* buffer; + + DISALLOW_COPY_AND_ASSIGN(SndioAudioOutputStream); +}; + +} // namespace media + +#endif // MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_ diff --git a/srcpkgs/electron9/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch b/srcpkgs/electron9/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch new file mode 100644 index 00000000000..cf8e81b11d6 --- /dev/null +++ b/srcpkgs/electron9/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch @@ -0,0 +1,43 @@ +diff --git a/chromium/media/audio/linux/audio_manager_linux.cc b/chromium/media/audio/linux/audio_manager_linux.cc +index 5d703549372..9e60b40c749 100644 +--- media/audio/linux/audio_manager_linux.cc ++++ media/audio/linux/audio_manager_linux.cc +@@ -20,6 +20,10 @@ + #include "media/audio/pulse/audio_manager_pulse.h" + #include "media/audio/pulse/pulse_util.h" + #endif ++#if defined(USE_SNDIO) ++#include ++#include "media/audio/openbsd/audio_manager_openbsd.h" ++#endif + + namespace media { + +@@ -27,7 +31,8 @@ enum LinuxAudioIO { + kPulse, + kAlsa, + kCras, +- kAudioIOMax = kCras // Must always be equal to largest logged entry. ++ kSndio, ++ kAudioIOMax = kSndio // Must always be equal to largest logged entry. + }; + + std::unique_ptr CreateAudioManager( +@@ -41,6 +46,17 @@ std::unique_ptr CreateAudioManager( + } + #endif + ++#if defined(USE_SNDIO) ++ struct sio_hdl * hdl = NULL; ++ if ((hdl=sio_open(SIO_DEVANY, SIO_PLAY, 1)) != NULL) { ++ sio_close(hdl); ++ UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kSndio, kAudioIOMax +1); ++ return std::make_unique(std::move(audio_thread), ++ audio_log_factory); ++ } ++ DVLOG(1) << "Sndio is not available on the OS"; ++#endif ++ + #if defined(USE_PULSEAUDIO) + pa_threaded_mainloop* pa_mainloop = nullptr; + pa_context* pa_context = nullptr; diff --git a/srcpkgs/electron9/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch b/srcpkgs/electron9/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch new file mode 100644 index 00000000000..ec604002668 --- /dev/null +++ b/srcpkgs/electron9/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch @@ -0,0 +1,12 @@ +--- media/BUILD.gn 2020-03-24 10:16:30.000000000 +0100 ++++ - 2020-04-06 14:32:27.960817513 +0200 +@@ -65,6 +65,9 @@ + if (use_cras) { + defines += [ "USE_CRAS" ] + } ++ if (use_sndio) { ++ defines += [ "USE_SNDIO" ] ++ } + } + + # Internal grouping of the configs necessary to support sub-folders having their diff --git a/srcpkgs/electron9/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch b/srcpkgs/electron9/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch new file mode 100644 index 00000000000..c856de0bf2e --- /dev/null +++ b/srcpkgs/electron9/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch @@ -0,0 +1,23 @@ +--- media/audio/BUILD.gn 2020-03-24 10:16:30.000000000 +0100 ++++ - 2020-04-06 14:31:28.871450217 +0200 +@@ -232,9 +232,19 @@ + deps += [ "//media/base/android:media_jni_headers" ] + } + +- if (is_linux) { ++ if (is_linux) { + sources += [ "linux/audio_manager_linux.cc" ] + } ++ if (use_sndio) { ++ libs += [ "sndio" ] ++ sources += [ ++ "openbsd/audio_manager_openbsd.cc", ++ "sndio/sndio_input.cc", ++ "sndio/sndio_input.h", ++ "sndio/sndio_output.cc", ++ "sndio/sndio_output.h" ++ ] ++ } + + if (use_alsa) { + libs += [ "asound" ] diff --git a/srcpkgs/electron9/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch b/srcpkgs/electron9/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch new file mode 100644 index 00000000000..14807d8e1d3 --- /dev/null +++ b/srcpkgs/electron9/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch @@ -0,0 +1,12 @@ +--- media/media_options.gni 2020-03-24 10:16:30.000000000 +0100 ++++ - 2020-04-06 14:29:22.958630783 +0200 +@@ -114,6 +114,9 @@ + # Enables runtime selection of ALSA library for audio. + use_alsa = false + ++ # Enables runtime selection of sndio library for audio. ++ use_sndio = false ++ + # Alsa should be used on non-Android, non-Mac POSIX systems. + # Alsa should be used on desktop Chromecast and audio-only Chromecast builds. + if (is_posix && !is_android && !is_mac && diff --git a/srcpkgs/electron9/template b/srcpkgs/electron9/template new file mode 100644 index 00000000000..053934be8f4 --- /dev/null +++ b/srcpkgs/electron9/template @@ -0,0 +1,354 @@ +# Template file for 'electron9' +pkgname=electron9 +version=9.2.1 +_nodever=12.14.1 +_chromiumver=83.0.4103.119 +revision=1 +archs="x86_64* i686* aarch64*" +build_wrksrc="src" +create_wrksrc=yes +hostmakedepends="$(vopt_if clang clang) yasm python pkgconf perl gperf bison ninja nodejs hwids + libwebp-devel freetype-devel harfbuzz-devel libpng-devel nss-devel which git libevent-devel + pciutils-devel libatomic-devel ffmpeg-devel libxml2-devel libglib-devel yarn openjdk libxslt-devel + opus-devel libXcursor-devel libXcomposite-devel libXtst-devel libXrandr-devel libXScrnSaver-devel + alsa-lib-devel re2-devel snappy-devel mit-krb5-devel $(vopt_if pulseaudio pulseaudio-devel) + $(vopt_if sndio sndio-devel)" +makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel + libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel + libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel + libXScrnSaver-devel alsa-lib-devel snappy-devel libdrm-devel + libxml2-devel libxslt-devel $(vopt_if pulseaudio pulseaudio-devel) libexif-devel + libXcursor-devel libflac-devel speex-devel libmtp-devel libwebp-devel + libjpeg-turbo-devel libevent-devel json-c-devel harfbuzz-devel + minizip-devel jsoncpp-devel zlib-devel libcap-devel libXdamage-devel + re2-devel fontconfig-devel freetype-devel opus-devel libatomic-devel + $(vopt_if sndio sndio-devel) ffmpeg-devel libva-devel libuv-devel c-ares-devel libnotify-devel" +short_desc="Cross platform application development framework based on web technologies" +maintainer="John " +license="BSD-3-Clause" +homepage="https://electronjs.org" +distfiles="https://github.com/electron/electron/archive/v$version.tar.gz>electron-${version}.tar.gz + https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$_chromiumver.tar.xz + https://github.com/nodejs/node/archive/v$_nodever.tar.gz>node-$_nodever.tar.gz" +checksum="91fae4c98d351cac53f9e3c4974c602fa93d0a7365fdce31cf832d8095e37b11 + 452cbc58895a46b2b87ba450a3f86897de92ad08ce28ffdbed6b3f12101d3788 + 01e4a960be3e26b87c55509ee1cb44a14946a4169d5cdec046dd05058d995b26" + +no_generic_pkgconfig_link=yes +lib32disabled=yes +nodebug=yes +nopie=yes # contains tools that are not PIE, enables PIE itself + +build_options="pulseaudio sndio clang" +build_options_default="pulseaudio sndio clang" + +if [ "$build_option_clang" ]; then + nocross="No proper setup for using clang as cross compiler in void yet" +elif [ "${XBPS_TARGET_MACHINE%%-musl}" = "aarch64" ]; then + broken="Falls apart at runtime when compiled with gcc" +fi + +_buildtype=Release +_is_debug=false + +CFLAGS="-Wno-unknown-warning-option -fPIC" +CXXFLAGS="-Wno-unknown-warning-option -fPIC" + +_apply_patch() { + local args="$1" pname="$(basename $2)" + + if [ ! -f ".${pname}_done" ]; then + msg_normal "$pkgver: patching: ${pname}.\n" + patch -N $args -i $2 + touch .${pname}_done + fi +} + +_get_chromium_arch() { + case "$1" in + x86_64*) echo x64 ;; + i686*) echo x86 ;; + arm*) echo arm ;; + aarch64*) echo arm64 ;; + ppc64*) echo ppc64 ;; + ppc*) echo ppc ;; + mipsel*) echo mipsel ;; + mips*) echo mips ;; + *) msg_error "$pkgver: cannot be compiled for ${XBPS_TARGET_MACHINE}.\n" ;; + esac +} + +post_extract() { + ln -s chromium-$_chromiumver src + mkdir -p src/third_party/ + ln -s ../../node-$_nodever src/third_party/electron_node + ln -s ../electron-${version} src/electron + +} +post_patch() { + cd $wrksrc + for x in $FILESDIR/patches/*; do + case "${x##*/}" in + electron*.patch) + cd src/electron + _apply_patch -p1 "$x" + cd "$wrksrc";; + esac + done + + # Sigh, electron uses git am... + if [ ! -f ".electron_patches_done" ]; then + python2 src/electron/script/list_patch_targets.py src/electron/patches/config.json | while read -r repopath; do + cd "$wrksrc"/"$repopath" + git init -q + git config "gc.auto" 0 + if [ "$repopath" != "src" ]; then + echo "/${repopath#src/}" >> "$wrksrc/$build_wrksrc/.gitignore" + fi + git add . + git -c 'user.name=Electron build' -c 'user.email=electron@ebuild' \ + commit -q -m "." || true + done + cd $wrksrc + python2 src/electron/script/apply_all_patches.py src/electron/patches/config.json + touch .electron_patches_done + fi + + for x in $FILESDIR/patches/*; do + case "${x##*/}" in + chromium*.patch) + cd src + _apply_patch -p1 "$x" + cd "$wrksrc";; + esac + done + + if [ "$XBPS_TARGET_LIBC" = "musl" ]; then + for x in $FILESDIR/musl-patches/*; do + case "${x##*/}" in + chromium*.patch) + cd src + _apply_patch -p1 "$x" + cd "$wrksrc";; + electron*.patch) + cd src/electron + _apply_patch -p1 "$x" + cd "$wrksrc";; + esac + done + fi + if [ "$build_option_sndio" ]; then + mkdir -p ${wrksrc}/${build_wrksrc}/media/audio/{sndio,openbsd} + cp ${FILESDIR}/sndio-files/sndio_*put.* \ + ${wrksrc}/${build_wrksrc}/media/audio/sndio + cp ${FILESDIR}/sndio-files/audio_manager_openbsd.* \ + ${wrksrc}/${build_wrksrc}/media/audio/openbsd + for f in "${FILESDIR}"/sndio-patches/*.patch; do + cd src + _apply_patch -p0 "$f" + cd "$wrksrc" + done + fi +} + +pre_configure() { + cd "$wrksrc/$build_wrksrc" + + # https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion + touch chrome/test/data/webui/i18n_process_css_test.html + # Use the file at run time instead of effectively compiling it in + sed 's|//third_party/usb_ids/usb.ids|/usr/share/hwdata/usb.ids|g' \ + -i services/device/public/cpp/usb/BUILD.gn + + mkdir -p third_party/node/linux/node-linux-x64/bin + ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/ + + # reusable system library settings + local use_system=" + ffmpeg + flac + fontconfig + freetype + harfbuzz-ng + libdrm + libevent + libjpeg + libpng + libwebp + libxml + libxslt + opus + re2 + snappy + yasm + " + for _lib in $use_system libjpeg_turbo; do + msg_normal "Removing buildscripts for system provided $_lib\n" + find -type f -path "*third_party/$_lib/*" \ + \! -path "*third_party/$_lib/chromium/*" \ + \! -path "*third_party/$_lib/google/*" \ + \! -path './base/third_party/icu/*' \ + \! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \ + \! -path './third_party/harfbuzz-ng/utils/hb_scoped.h' \ + \! -path './third_party/yasm/run_yasm.py' \ + \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \ + -delete + done + + + msg_normal "Replacing gn files\n" + python2 build/linux/unbundle/replace_gn_files.py --system-libraries \ + $use_system + third_party/libaddressinput/chromium/tools/update-strings.py +} + +do_configure() { + local target_arch="$(_get_chromium_arch ${XBPS_TARGET_MACHINE})" + local host_arch="$(_get_chromium_arch ${XBPS_MACHINE})" + # the build system will set march for use, adding it to cflags will break builds + export CXXFLAGS=$( shopt -s extglob; echo ${CXXFLAGS/-march=*([^ ])} ) + export CFLAGS=$( shopt -s extglob; echo ${CFLAGS/-march=*([^ ])} ) + local conf=() + cd third_party/electron_node + if [ "$CROSS_BUILD" ]; then + conf_args=" --dest-cpu=${target_arch} --cross-compiling" + fi + ./configure --prefix=/usr \ + --shared-zlib \ + --shared-libuv \ + --shared-openssl \ + --shared-cares \ + --openssl-use-def-ca-store \ + --without-npm \ + --without-dtrace \ + --without-bundled-v8 \ + ${conf_args} + + cd "$wrksrc/$build_wrksrc"/electron + yarn install + cd "$wrksrc/$build_wrksrc" + + if [ "$build_option_clang" ]; then + export CC=clang + export CXX=clang++ + export HOST_CC=clang + export HOST_CXX=clang++ + else + export CXXFLAGS="$CXXFLAGS -fpermissive" + export BUILD_CXXFLAGS="$BUILD_CXXFLAGS -fpermissive" + export BUILD_AR="$AR_host" + export BUILD_NM="$NM_host" + fi + + # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys) + # Note: These are for Void Linux use ONLY. + conf+=( + 'google_api_key="AIzaSyA9gWazKaHaNIPPg2hrMj6_ZSG8AFmq738"' + 'google_default_client_id="126659149423-hoo6ickbk3p1u2qjsdsp0ddciurfvb4t.apps.googleusercontent.com"' + 'google_default_client_secret="_ozIx2D-DKm_se_2NPwV4l5b"' + ) + + conf+=( + 'blink_symbol_level=0' + 'clang_use_chrome_plugins=false' + 'closure_compile=true' + 'custom_toolchain="//build/toolchain/linux/unbundle:default"' + ) + if [ "$CROSS_BUILD" ]; then + conf+=( + 'host_toolchain="//build/toolchain/linux/unbundle:host"' + 'v8_snapshot_toolchain="//build/toolchain/linux/unbundle:host"' + "host_pkg_config=\"$PKG_CONFIG_FOR_BUILD\"" + "pkg_config=\"$PKG_CONFIG\"" + ) + else + conf+=( + 'host_toolchain="//build/toolchain/linux/unbundle:default"' + 'v8_snapshot_toolchain="//build/toolchain/linux/unbundle:default"' + ) + fi + if [ "$build_option_sndio" ]; then + conf+=( + 'use_sndio=true' + ) + fi + conf+=( + 'enable_hangout_services_extension=true' + 'enable_nacl_nonsfi=false' + 'enable_nacl=false' + 'enable_precompiled_headers=false' + 'fatal_linker_warnings=false' + 'ffmpeg_branding="Chrome"' + 'fieldtrial_testing_like_official_build=true' + 'gold_path="/usr/bin/ld.gold"' + 'icu_use_data_file=true' + "is_clang=$(vopt_if clang true false)" + 'is_component_build=false' + "is_debug=$_is_debug" + 'is_desktop_linux=true' + 'linux_use_bundled_binutils=false' + 'proprietary_codecs=true' + 'symbol_level=0' + 'treat_warnings_as_errors=false' + 'use_allocator_shim=false' + 'use_allocator="none"' + 'use_cups=true' + 'use_custom_libcxx=false' + 'use_gnome_keyring=false' + 'use_gold=false' + 'use_lld=false' + "use_pulseaudio=$(vopt_if pulseaudio 'true' 'false')" + 'use_sysroot=false' + 'use_system_harfbuzz=true' + "target_cpu=\"$target_arch\"" + "host_cpu=\"$host_arch\"" + 'import("//electron/build/args/release.gn")' + ) + + msg_normal "Bootstrapping GN\n" + CC="${CC_FOR_BUILD:-$CC}" CXX="${CXX_FOR_BUILD:-$CXX}" LD="${LD_FOR_BUILD:-$LD}" \ + CFLAGS="${CFLAGS_FOR_BUILD:-$CFLAGS}" CXXFLAGS="${CXXFLAGS_FOR_BUILD:-$CXXFLAGS}" \ + LDFLAGS="${XBPS_LDFLAGS}" \ + python2 tools/gn/bootstrap/bootstrap.py -s -v --skip-generate-buildfiles + + msg_normal "Configuring build\n" + out/Release/gn gen out/$_buildtype --args="${conf[*]}" +} + +do_build() { + export CXXFLAGS=$( shopt -s extglob; echo ${CXXFLAGS/-march=*([^ ])} ) + export CFLAGS=$( shopt -s extglob; echo ${CFLAGS/-march=*([^ ])} ) + if [ "$build_option_clang" ]; then + export CC=clang + export CXX=clang++ + export HOST_CC=clang + export HOST_CXX=clang++ + else + export BUILD_CXXFLAGS="$BUILD_CXXFLAGS -fpermissive" + export CXXFLAGS="$CXXFLAGS -fpermissive" + export BUILD_AR="$AR_host" + export BUILD_NM="$NM_host" + fi + msg_normal "Ninja turtles GO!\n" + ninja ${makejobs} -C out/$_buildtype electron third_party/electron_node:headers + # finish rest of the build + strip -s out/$_buildtype/electron + ninja ${makejobs} -C out/$_buildtype electron_dist_zip +} + +do_install() { + vmkdir /usr/lib/$pkgname + vmkdir /usr/include/$pkgname + bsdtar -xf out/$_buildtype/dist.zip -C "$DESTDIR/usr/lib/$pkgname" + + chmod u+s "$DESTDIR/usr/lib/$pkgname/chrome-sandbox" + + cp out/$_buildtype/gen/node_headers.tar.gz "$DESTDIR"/usr/include/$pkgname + + vlicense ${wrksrc}/src/LICENSE chromium.LICENSE + vlicense ${wrksrc}/src/electron/LICENSE electron.LICENSE + vlicense ${wrksrc}/src/third_party/electron_node/LICENSE node.LICENSE + + vmkdir /usr/bin + ln -s ../lib/$pkgname/electron "$DESTDIR"/usr/bin/$pkgname +} diff --git a/srcpkgs/electron9/update b/srcpkgs/electron9/update new file mode 100644 index 00000000000..3af8e58b535 --- /dev/null +++ b/srcpkgs/electron9/update @@ -0,0 +1,2 @@ +site=https://www.electronjs.org/releases/stable?version=${version%%.*} +pattern='tag/v\K[\d\.]+(?=")' From 182f872d6007fa2a5dbf87c527d50eba60ba4382 Mon Sep 17 00:00:00 2001 From: John Date: Sun, 23 Aug 2020 17:18:50 +0200 Subject: [PATCH 2/2] element-desktop: use system electron9 [ci skip] --- common/shlibs | 1 - srcpkgs/element-desktop/files/element-desktop | 2 ++ srcpkgs/element-desktop/template | 16 ++++++++-------- 3 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 srcpkgs/element-desktop/files/element-desktop diff --git a/common/shlibs b/common/shlibs index b28d158df83..7bea100a660 100644 --- a/common/shlibs +++ b/common/shlibs @@ -123,7 +123,6 @@ libGLESv2.so atom-1.41.0_1 libGLESv2.so opera-55.0.2994.37_2 libGLESv2.so discord-0.0.7_1 libGLESv2.so keybase-desktop-3.1.2_1 -libGLESv2.so riot-desktop-0.17.9_2 libGLESv2.so wire-desktop-3.6.2885_1 libGLESv2.so Signal-Desktop-1.23.2_1 libGLESv2.so slack-desktop-3.4.2_1 diff --git a/srcpkgs/element-desktop/files/element-desktop b/srcpkgs/element-desktop/files/element-desktop new file mode 100644 index 00000000000..d16e825046c --- /dev/null +++ b/srcpkgs/element-desktop/files/element-desktop @@ -0,0 +1,2 @@ +#!/bin/sh +exec electron9 /usr/lib/element-desktop/resources/app.asar "$@" diff --git a/srcpkgs/element-desktop/template b/srcpkgs/element-desktop/template index 97989901885..71816d51321 100644 --- a/srcpkgs/element-desktop/template +++ b/srcpkgs/element-desktop/template @@ -1,13 +1,12 @@ # Template file for 'element-desktop' pkgname=element-desktop version=1.7.4 -revision=1 -archs="x86_64" +revision=2 wrksrc="element-web-${version}" conf_files="/etc/${pkgname}/config.json" hostmakedepends="git yarn nodejs rust cargo python sqlcipher-devel curl libappindicator-devel libnotify-devel pkg-config" makedepends="libsecret-devel" -depends="c-ares ffmpeg gtk+3 http-parser libevent libxslt minizip nss re2 snappy sqlcipher" +depends="c-ares ffmpeg gtk+3 http-parser libevent libxslt minizip nss re2 snappy sqlcipher electron9" short_desc="Glossy Matrix collaboration client, desktop version" maintainer="projectmoon " license="Apache-2.0" @@ -16,7 +15,6 @@ distfiles="https://github.com/vector-im/element-desktop/archive/v${version}.tar. checksum="e9f5855e432841aa503f3a2e85073c466992e1a28b697b21cb370485c6c4aa35 96b38a348bc7ba1530171aa730f8a02a469fb5e57e524034ebd2768ed21f1c97" nocross=yes -nostrip=yes pre_build() { # Build dependencies for riot-web @@ -40,14 +38,16 @@ do_build() { do_install() { vmkdir usr/lib/element-desktop vmkdir etc/element-desktop - vcopy ../element-desktop-${version}/dist/linux-unpacked/* /usr/lib/element-desktop + case "$XBPS_TARGET_MACHINE" in + i686*) vcopy ../element-desktop-${version}/dist/linux-ia32-unpacked/resources /usr/lib/element-desktop/resources;; + *) vcopy ../element-desktop-${version}/dist/linux-unpacked/resources /usr/lib/element-desktop/resources + esac vinstall config.sample.json 644 /etc/element-desktop/ config.json vcopy webapp /usr/lib/element-desktop/resources ln -s /etc/element-desktop/config.json $DESTDIR/usr/lib/element-desktop/resources/webapp/config.json - vmkdir usr/bin - ln -s /usr/lib/element-desktop/element-desktop $DESTDIR/usr/bin/element-desktop - ln -s /usr/lib/element-desktop/element-desktop $DESTDIR/usr/bin/riot-desktop + vbin ${FILESDIR}/element-desktop + ln -s element-desktop $DESTDIR/usr/bin/riot-desktop vinstall ${FILESDIR}/element-desktop.desktop 644 /usr/share/applications/ element-desktop.desktop vinstall webapp/themes/element/img/logos/element-logo.svg 644 /usr/share/icons/hicolor/scalable/apps/ element.svg