electron7: remove

This commit is contained in:
q66 2021-01-20 01:34:10 +01:00
parent 5b1d651502
commit 16cefef48d
60 changed files with 0 additions and 9748 deletions

View file

@ -1,31 +0,0 @@
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);

View file

@ -1,176 +0,0 @@
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<unsigned long> 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:

View file

@ -1,13 +0,0 @@
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 */

View file

@ -1,45 +0,0 @@
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 <sys/cdefs.h> // 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 <sys/cdefs.h>
#include <stdint.h>
#include <linux/types.h>
-__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 */

View file

@ -1,18 +0,0 @@
--- 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)

View file

@ -1,61 +0,0 @@
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 <resolv.h>
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

View file

@ -1,96 +0,0 @@
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 <cxxabi.h>
#endif
-#if !defined(__UCLIBC__) && !defined(_AIX)
+#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
#include <execinfo.h>
#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<size_t>(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 <CrashReporterClient.h> header file. */
/* #undef HAVE_CRASHREPORTERCLIENT_H */
@@ -55,7 +55,7 @@
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <execinfo.h> header file. */
-#define HAVE_EXECINFO_H 1
+/* #undef HAVE_EXECINFO_H */
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1

View file

@ -1,48 +0,0 @@
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

View file

@ -1,25 +0,0 @@
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__)

View file

@ -1,61 +0,0 @@
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 <malloc.h> 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 <malloc.h> header file. */
#define HAVE_MALLOC_H 1

View file

@ -1,18 +0,0 @@
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.

View file

@ -1,13 +0,0 @@
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<char*>(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) {

View file

@ -1,13 +0,0 @@
diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
index 003708d..b21414f 100644
--- a/sandbox/linux/seccomp-bpf/trap.cc
+++ b/sandbox/linux/seccomp-bpf/trap.cc
@@ -168,7 +168,7 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
// most versions of glibc don't include this information in siginfo_t. So,
// we need to explicitly copy it into a arch_sigsys structure.
struct arch_sigsys sigsys;
- memcpy(&sigsys, &info->_sifields, sizeof(sigsys));
+ memcpy(&sigsys, &info->__si_fields, sizeof(sigsys));
#if defined(__mips__)
// When indirect syscall (syscall(__NR_foo, ...)) is made on Mips, the

View file

@ -1,41 +0,0 @@
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
@@ -29,7 +29,7 @@ size_t GetUnderestimatedStackSize() {
// FIXME: On Mac OSX and Linux, this method cannot estimate stack size
// correctly for the main thread.
-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
+#if 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;

View file

@ -1,44 +0,0 @@
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;

View file

@ -1,14 +0,0 @@
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 <string>
+#ifdef TCP_LISTEN
+#undef TCP_LISTEN
+#endif
namespace content {

View file

@ -1,24 +0,0 @@
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 <elf.h>
#include <link.h>
#include <stddef.h>
+#include <limits.h>
#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."

View file

@ -1,187 +0,0 @@
From f1167a4390736e6f1588c497c0a0a271c71ac9b4 Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Sat, 12 Sep 2020 05:57:12 +0200
Subject: [PATCH] ppc64le musl bits
---
sandbox/linux/bpf_dsl/seccomp_macros.h | 6 +++---
sandbox/linux/seccomp-bpf/syscall.cc | 4 ++--
.../abseil-cpp/absl/base/internal/unscaledcycleclock.h | 2 +-
.../src/client/linux/dump_writer_common/thread_info.cc | 7 +++++--
.../src/client/linux/dump_writer_common/ucontext_reader.cc | 7 +++++--
.../breakpad/src/client/linux/handler/exception_handler.cc | 5 +++++
.../crashpad/crashpad/snapshot/linux/signal_context.h | 2 +-
third_party/crashpad/crashpad/util/linux/thread_info.h | 1 +
third_party/lss/linux_syscall_support.h | 4 ++++
9 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/sandbox/linux/bpf_dsl/seccomp_macros.h b/sandbox/linux/bpf_dsl/seccomp_macros.h
index a6aec544e0..2a4a7f1bca 100644
--- a/sandbox/linux/bpf_dsl/seccomp_macros.h
+++ b/sandbox/linux/bpf_dsl/seccomp_macros.h
@@ -16,7 +16,7 @@
#if defined(__mips__)
// sys/user.h in eglibc misses size_t definition
#include <stddef.h>
-#elif defined(__powerpc64__)
+#elif defined(__powerpc64__) && defined(__GLIBC__)
// Manually define greg_t on ppc64
typedef unsigned long long greg_t;
#endif
@@ -361,11 +361,11 @@ typedef struct pt_regs regs_struct;
#define SECCOMP_ARCH AUDIT_ARCH_PPC64
#endif
-#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
+#define SECCOMP_REG(_ctx, _reg) (((struct pt_regs *)(_ctx)->uc_mcontext.regs)->gpr[_reg])
#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
-#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
+#define SECCOMP_IP(_ctx) ((struct pt_regs *)(_ctx)->uc_mcontext.regs)->nip
#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
diff --git a/sandbox/linux/seccomp-bpf/syscall.cc b/sandbox/linux/seccomp-bpf/syscall.cc
index 10fa5fd070..30b7b3851f 100644
--- a/sandbox/linux/seccomp-bpf/syscall.cc
+++ b/sandbox/linux/seccomp-bpf/syscall.cc
@@ -497,9 +497,9 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
// Same as MIPS, need to invert ret and set error register (cr0.SO)
if (ret_val <= -1 && ret_val >= -4095) {
ret_val = -ret_val;
- ctx->uc_mcontext.regs->ccr |= (1 << 28);
+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr |= (1 << 28);
} else {
- ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr &= ~(1 << 28);
}
#endif
SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
diff --git a/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h b/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h
index 2d361e9628..98242096cd 100644
--- a/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h
+++ b/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h
@@ -46,7 +46,7 @@
// The following platforms have an implementation of a hardware counter.
#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
- defined(__powerpc__) || defined(__ppc__) || \
+ ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__)) || \
defined(_M_IX86) || defined(_M_X64)
#define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1
#else
diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
index 03afec7a58..0264ecf135 100644
--- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
@@ -273,6 +273,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
#elif defined(__powerpc64__)
+#include <asm/elf.h>
+#include <asm/ptrace.h>
+
uintptr_t ThreadInfo::GetInstructionPointer() const {
return mcontext.gp_regs[PT_NIP];
}
@@ -290,9 +293,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
out->ctr = mcontext.gp_regs[PT_CTR];
for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
- out->float_save.fpregs[i] = mcontext.fp_regs[i];
+ out->float_save.fpregs[i] = ((uint64_t *)&mcontext.fp_regs)[i];
- out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
+ out->float_save.fpscr = ((uint64_t *)&mcontext.fp_regs)[ELF_NFPREG-1];
for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
out->vector_save.save_vr[i] = \
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 7620cf6f79..54e373611f 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
@@ -257,6 +257,9 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
#elif defined(__powerpc64__)
+#include <asm/elf.h>
+#include <asm/ptrace.h>
+
uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
}
@@ -280,9 +283,9 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
- out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
+ out->float_save.fpregs[i] = ((uint64_t *)&uc->uc_mcontext.fp_regs)[i];
- out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
+ out->float_save.fpscr = ((uint64_t *)&uc->uc_mcontext.fp_regs)[ELF_NFPREG-1];
for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
out->vector_save.save_vr[i] =
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 826c9e0c21..9bb4f6a3e4 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
@@ -105,6 +105,11 @@
#define PR_SET_PTRACER 0x59616d61
#endif
+/* musl hack, can't include asm/ptrace.h as that causes conflicts */
+#if defined(__powerpc64__) && !defined(PT_NIP)
+#define PT_NIP 32
+#endif
+
namespace google_breakpad {
namespace {
diff --git a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
index a1f2da2591..e6a5bd72ab 100644
--- a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
+++ b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
@@ -469,7 +469,7 @@ struct MContext64 {
SignalThreadContext64 gp_regs;
SignalFloatContext64 fp_regs;
SignalVectorContext64 *v_regs;
- int64_t vmx_reserve[69];
+ int64_t vmx_reserve[101];
};
struct ContextTraits64 : public Traits64 {
diff --git a/third_party/crashpad/crashpad/util/linux/thread_info.h b/third_party/crashpad/crashpad/util/linux/thread_info.h
index dea0d1f39e..b203e5b2f2 100644
--- a/third_party/crashpad/crashpad/util/linux/thread_info.h
+++ b/third_party/crashpad/crashpad/util/linux/thread_info.h
@@ -30,6 +30,7 @@
#if defined(ARCH_CPU_PPC64_FAMILY)
#include <sys/ucontext.h>
+#include <asm/ptrace.h>
#endif
namespace crashpad {
diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
index c05710e56f..af327ea616 100644
--- a/third_party/lss/linux_syscall_support.h
+++ b/third_party/lss/linux_syscall_support.h
@@ -4226,9 +4226,13 @@ struct kernel_statfs {
}
#endif
#if defined(__NR_fstatat64)
+ // musl does #define fstatat64 fstatat
+ #undef fstatat64
LSS_INLINE _syscall4(int, fstatat64, int, d,
const char *, p,
struct kernel_stat64 *, b, int, f)
+ // set it back like it was
+ #define fstatat64 fstatat
#endif
#if defined(__NR_waitpid)
// waitpid is polyfilled below when not available.
--
2.28.0

View file

@ -1,73 +0,0 @@
From c755ec847459d9d3807c22c2d4d6aa6f9c86dc7c Mon Sep 17 00:00:00 2001
From: John Budorick <jbudorick@chromium.org>
Date: Tue, 19 Nov 2019 22:24:20 +0000
Subject: [PATCH] 3904: chrome_cleaner: ensure internal targets are reachable
from :gn_all.
(cherry picked from commit eee513dfc780ad4bcaa74b67f2e0eaebf57b5c93)
Bug: 984162, 1004848
Change-Id: Ibb7c47f0188de8e077cd30aa8d68ca61133d2037
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1904549
Commit-Queue: John Budorick <jbudorick@chromium.org>
Reviewed-by: Joe Mason <joenotcharles@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#713683}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1922299
Cr-Commit-Position: refs/branch-heads/3904@{#895}
Cr-Branched-From: 675968a8c657a3bd9c1c2c20c5d2935577bbc5e6-refs/heads/master@{#693954}
---
BUILD.gn | 2 +-
chrome/chrome_cleaner/BUILD.gn | 23 ++++++++++++++++++++---
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/BUILD.gn b/BUILD.gn
index 5e2f6b9b0f41c..ac0297608594f 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -604,7 +604,7 @@ group("gn_all") {
if (is_win) {
deps += [
"//base:pe_image_test",
- "//chrome/chrome_cleaner:chrome_cleaner_unittests",
+ "//chrome/chrome_cleaner",
"//chrome/chrome_elf:chrome_elf_unittests",
"//chrome/chrome_elf:dll_hash_main",
"//chrome/elevation_service:elevation_service_unittests",
diff --git a/chrome/chrome_cleaner/BUILD.gn b/chrome/chrome_cleaner/BUILD.gn
index fbd2d8d5307aa..1671a3f7d097c 100644
--- a/chrome/chrome_cleaner/BUILD.gn
+++ b/chrome/chrome_cleaner/BUILD.gn
@@ -64,9 +64,6 @@ static_library("other_executable_definitions") {
}
test("chrome_cleaner_unittests") {
- # Make this target findable from the "all" target used by the builders.
- visibility += [ "//.:gn_all" ]
-
sources = [
"//chrome/chrome_cleaner/test/test_main.cc",
]
@@ -126,3 +123,23 @@ test("chrome_cleaner_unittests") {
]
}
}
+
+group("chrome_cleaner") {
+ testonly = true
+
+ # Make this target findable from the "all" target used by the builders.
+ visibility += [ "//.:gn_all" ]
+
+ deps = [
+ ":chrome_cleaner_unittests",
+ "//chrome/chrome_cleaner/executables:chrome_cleanup_tool",
+ "//chrome/chrome_cleaner/executables:software_reporter_tool",
+ ]
+
+ if (is_internal_chrome_cleaner_build) {
+ deps += [
+ "${chrome_cleaner_internal_root}:build_targets",
+ "${chrome_cleaner_internal_root}:test_targets",
+ ]
+ }
+}

View file

@ -1,342 +0,0 @@
From daec661f27bdfab79132d7d2c4637cc17fd4aa35 Mon Sep 17 00:00:00 2001
From: Joe Mason <joenotcharles@google.com>
Date: Wed, 4 Dec 2019 18:04:21 +0000
Subject: [PATCH] Save logs from test child processes by redirecting stdout and
stderr.
The previous solution can only capture logs after the child process
creates a ScopedLogging object. We see flaky crashes in sandbox creation
that happen before that so this will let us see the child process stack
traces.
Also moves some functions that were exported from ipc_test_util.h to be
private to proto_chrome_prompt_ipc_unittest.cc, which is the only test
that still uses them.
(cherry picked from commit e7a755421136d7fc9b3a73a5e5464368f3efa7f9)
Bug: 1030333
Change-Id: Ie30eed3b16631721e81a420b3b70f1ec5f0d9a0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948483
Reviewed-by: proberge <proberge@chromium.org>
Commit-Queue: Joe Mason <joenotcharles@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#721071}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1951089
Reviewed-by: Joe Mason <joenotcharles@chromium.org>
Cr-Commit-Position: refs/branch-heads/3904@{#913}
Cr-Branched-From: 675968a8c657a3bd9c1c2c20c5d2935577bbc5e6-refs/heads/master@{#693954}
---
chrome/chrome_cleaner/ipc/ipc_test_util.cc | 92 ++++++++++++-------
chrome/chrome_cleaner/ipc/ipc_test_util.h | 13 ++-
.../ipc/proto_chrome_prompt_ipc_unittest.cc | 17 ++--
chrome/chrome_cleaner/ipc/sandbox.cc | 5 +-
4 files changed, 77 insertions(+), 50 deletions(-)
diff --git a/chrome/chrome_cleaner/ipc/ipc_test_util.cc b/chrome/chrome_cleaner/ipc/ipc_test_util.cc
index 05fc0d027ec43..0d03a6870fb07 100644
--- a/chrome/chrome_cleaner/ipc/ipc_test_util.cc
+++ b/chrome/chrome_cleaner/ipc/ipc_test_util.cc
@@ -13,6 +13,7 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
+#include "base/files/scoped_temp_dir.h"
#include "base/logging.h"
#include "base/process/launch.h"
#include "base/rand_util.h"
@@ -23,7 +24,6 @@
#include "base/test/test_timeouts.h"
#include "base/win/win_util.h"
#include "chrome/chrome_cleaner/ipc/sandbox.h"
-#include "chrome/chrome_cleaner/logging/scoped_logging.h"
#include "sandbox/win/src/sandbox_factory.h"
namespace chrome_cleaner {
@@ -32,12 +32,13 @@ namespace {
constexpr char kMojoPipeTokenSwitch[] = "mojo-pipe-token";
-constexpr wchar_t kIPCTestUtilLogSuffix[] = L"ipc-test-util";
-
class MojoSandboxSetupHooks : public SandboxSetupHooks {
public:
- explicit MojoSandboxSetupHooks(SandboxedParentProcess* parent_process)
- : parent_process_(parent_process) {}
+ explicit MojoSandboxSetupHooks(
+ SandboxedParentProcess* parent_process,
+ base::win::ScopedHandle child_stdout_write_handle)
+ : parent_process_(parent_process),
+ child_stdout_write_handle_(std::move(child_stdout_write_handle)) {}
~MojoSandboxSetupHooks() override = default;
// SandboxSetupHooks
@@ -49,6 +50,8 @@ class MojoSandboxSetupHooks : public SandboxSetupHooks {
parent_process_->CreateMojoPipe(command_line, &handles_to_inherit);
for (HANDLE handle : handles_to_inherit)
policy->AddHandleToShare(handle);
+ policy->SetStdoutHandle(child_stdout_write_handle_.Get());
+ policy->SetStderrHandle(child_stdout_write_handle_.Get());
return RESULT_CODE_SUCCESS;
}
@@ -61,33 +64,14 @@ class MojoSandboxSetupHooks : public SandboxSetupHooks {
private:
SandboxedParentProcess* parent_process_;
+ base::win::ScopedHandle child_stdout_write_handle_;
};
} // namespace
namespace internal {
-base::FilePath::StringPieceType GetLogPathSuffix() {
- return kIPCTestUtilLogSuffix;
-}
-
-base::FilePath GetLogPath() {
- return ScopedLogging::GetLogFilePath(kIPCTestUtilLogSuffix);
-}
-
-bool DeleteChildProcessLogs() {
- // Delete the child process log file if existing.
- const base::FilePath log_path = GetLogPath();
- if (!base::DeleteFile(log_path, false)) {
- LOG(ERROR) << "Can't delete log file from previous run: "
- << log_path.value();
- return false;
- }
- return true;
-}
-
-void PrintChildProcessLogs() {
- const base::FilePath log_path = GetLogPath();
+void PrintChildProcessLogs(const base::FilePath& log_path) {
if (log_path.empty()) {
LOG(ERROR) << "Child process log path is empty";
return;
@@ -174,11 +158,38 @@ bool ParentProcess::LaunchConnectedChildProcess(
const std::string& child_main_function,
base::TimeDelta timeout,
int32_t* exit_code) {
- if (!internal::DeleteChildProcessLogs())
+ // Adapted from
+ // https://cs.chromium.org/chromium/src/sandbox/win/src/handle_inheritance_test.cc
+ base::ScopedTempDir temp_dir;
+ if (!temp_dir.CreateUniqueTempDir()) {
+ PLOG(ERROR) << "Could not create temp dir for child stdout";
+ return false;
+ }
+
+ base::FilePath temp_file_name;
+ if (!CreateTemporaryFileInDir(temp_dir.GetPath(), &temp_file_name)) {
+ PLOG(ERROR) << "Could not create temp file for child stdout";
+ return false;
+ }
+
+ SECURITY_ATTRIBUTES attrs = {};
+ attrs.nLength = sizeof(attrs);
+ attrs.bInheritHandle = true;
+
+ base::win::ScopedHandle child_stdout_write_handle(
+ ::CreateFile(temp_file_name.value().c_str(), GENERIC_WRITE,
+ FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
+ &attrs, OPEN_EXISTING, 0, nullptr));
+ if (!child_stdout_write_handle.IsValid()) {
+ PLOG(ERROR) << "Could not open child stdout file";
return false;
+ }
- if (!PrepareAndLaunchTestChildProcess(child_main_function))
+ if (!PrepareAndLaunchTestChildProcess(child_main_function,
+ std::move(child_stdout_write_handle))) {
+ internal::PrintChildProcessLogs(temp_file_name);
return false;
+ }
CreateImplOnIPCThread(std::move(mojo_pipe_));
const bool success = base::WaitForMultiprocessTestChildExit(
@@ -189,21 +200,32 @@ bool ParentProcess::LaunchConnectedChildProcess(
}
DestroyImplOnIPCThread();
- if (!success || *exit_code != 0)
- internal::PrintChildProcessLogs();
+ if (!success || *exit_code != 0) {
+ internal::PrintChildProcessLogs(temp_file_name);
+ }
return success;
}
bool ParentProcess::PrepareAndLaunchTestChildProcess(
- const std::string& child_main_function) {
+ const std::string& child_main_function,
+ base::win::ScopedHandle child_stdout_write_handle) {
base::LaunchOptions launch_options;
launch_options.handles_to_inherit = extra_handles_to_inherit_;
+ launch_options.handles_to_inherit.push_back(child_stdout_write_handle.Get());
+ launch_options.stdin_handle = INVALID_HANDLE_VALUE;
+ launch_options.stdout_handle = child_stdout_write_handle.Get();
+ launch_options.stderr_handle = child_stdout_write_handle.Get();
+
CreateMojoPipe(&command_line_, &launch_options.handles_to_inherit);
base::Process child_process = base::SpawnMultiProcessTestChild(
child_main_function, command_line_, launch_options);
+ // Now that it's been passed to the child process,
+ // |child_stdout_write_handle| can be closed in this process as it goes out
+ // of scope.
+
ConnectMojoPipe(std::move(child_process));
return true;
}
@@ -235,8 +257,9 @@ SandboxedParentProcess::SandboxedParentProcess(
SandboxedParentProcess::~SandboxedParentProcess() {}
bool SandboxedParentProcess::PrepareAndLaunchTestChildProcess(
- const std::string& child_main_function) {
- MojoSandboxSetupHooks hooks(this);
+ const std::string& child_main_function,
+ base::win::ScopedHandle child_stdout_write_handle) {
+ MojoSandboxSetupHooks hooks(this, std::move(child_stdout_write_handle));
// This switch usage is copied from SpawnMultiProcessTestChild.
//
@@ -258,8 +281,7 @@ bool SandboxedParentProcess::PrepareAndLaunchTestChildProcess(
ChildProcess::ChildProcess(scoped_refptr<MojoTaskRunner> mojo_task_runner)
: mojo_task_runner_(mojo_task_runner),
- command_line_(base::CommandLine::ForCurrentProcess()),
- scopped_logging_(new ScopedLogging(kIPCTestUtilLogSuffix)) {
+ command_line_(base::CommandLine::ForCurrentProcess()) {
sandbox::TargetServices* target_services =
sandbox::SandboxFactory::GetTargetServices();
if (!target_services)
diff --git a/chrome/chrome_cleaner/ipc/ipc_test_util.h b/chrome/chrome_cleaner/ipc/ipc_test_util.h
index 97f2072a09165..1b2e5598ed52a 100644
--- a/chrome/chrome_cleaner/ipc/ipc_test_util.h
+++ b/chrome/chrome_cleaner/ipc/ipc_test_util.h
@@ -14,9 +14,9 @@
#include "base/process/launch.h"
#include "base/process/process.h"
#include "base/time/time.h"
+#include "base/win/scoped_handle.h"
#include "chrome/chrome_cleaner/ipc/chrome_prompt_ipc.h"
#include "chrome/chrome_cleaner/ipc/mojo_task_runner.h"
-#include "chrome/chrome_cleaner/logging/scoped_logging.h"
#include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/system/invitation.h"
#include "mojo/public/cpp/system/message_pipe.h"
@@ -70,7 +70,8 @@ class ParentProcess : public base::RefCountedThreadSafe<ParentProcess> {
// as in the sandbox. Subclasses should call CreateMojoPipe before the
// subprocess is spawned and ConnectMojoPipe afterward.
virtual bool PrepareAndLaunchTestChildProcess(
- const std::string& child_main_function);
+ const std::string& child_main_function,
+ base::win::ScopedHandle child_stdout_write_handle);
scoped_refptr<MojoTaskRunner> mojo_task_runner();
@@ -95,7 +96,8 @@ class SandboxedParentProcess : public ParentProcess {
~SandboxedParentProcess() override;
bool PrepareAndLaunchTestChildProcess(
- const std::string& child_main_function) override;
+ const std::string& child_main_function,
+ base::win::ScopedHandle child_stdout_write_handle) override;
};
class ChildProcess : public base::RefCountedThreadSafe<ChildProcess> {
@@ -120,7 +122,6 @@ class ChildProcess : public base::RefCountedThreadSafe<ChildProcess> {
private:
base::CommandLine* command_line_;
- std::unique_ptr<ScopedLogging> scopped_logging_;
// This will be true iff the process is running in a sandbox and
// TargetServices was initialized successfully.
@@ -143,9 +144,7 @@ class ChromePromptIPCTestErrorHandler : public ChromePromptIPC::ErrorHandler {
};
namespace internal {
-base::FilePath::StringPieceType GetLogPathSuffix();
-bool DeleteChildProcessLogs();
-void PrintChildProcessLogs();
+void PrintChildProcessLogs(const base::FilePath& log_file);
} // namespace internal
} // namespace chrome_cleaner
diff --git a/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc b/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc
index 1c7b4c575eb3d..f867df58f96ea 100644
--- a/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc
+++ b/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc
@@ -5,6 +5,7 @@
#include <windows.h>
#include "base/command_line.h"
+#include "base/files/file_util.h"
#include "base/process/process.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
@@ -41,8 +42,9 @@ constexpr char kExpectedPromptResultSwitch[] = "expected-prompt-result";
constexpr char kExpectedChromeDisconnectPointSwitch[] =
"expected-parent-disconnected";
-const base::char16 kInvalidUTF16String[] = {0xDC00, 0xD800, 0xD800, 0xDFFF,
- 0xDFFF, 0xDBFF, 0};
+constexpr base::char16 kLogSuffix[] = L"prompt-ipc-test";
+constexpr base::char16 kInvalidUTF16String[] = {0xDC00, 0xD800, 0xD800, 0xDFFF,
+ 0xDFFF, 0xDBFF, 0};
const base::FilePath kInvalidFilePath(kInvalidUTF16String);
const base::FilePath kNonASCIIFilePath(L"ééààçç");
const base::string16 kInvalidRegistryKey(kInvalidUTF16String);
@@ -420,8 +422,7 @@ class MockChrome {
class ChildProcess {
public:
ChildProcess()
- : scopped_logging_(
- std::make_unique<ScopedLogging>(internal::GetLogPathSuffix())) {
+ : scopped_logging_(std::make_unique<ScopedLogging>(kLogSuffix)) {
mock_chrome_ = std::make_unique<MockChrome>(
ExtractHandleFromCommandLine(chrome_cleaner::kChromeReadHandleSwitch),
ExtractHandleFromCommandLine(chrome_cleaner::kChromeWriteHandleSwitch));
@@ -630,7 +631,10 @@ class ParentProcess {
}
void Run() {
- ASSERT_TRUE(internal::DeleteChildProcessLogs());
+ // Delete the child process log file if existing.
+ const base::FilePath log_path = ScopedLogging::GetLogFilePath(kLogSuffix);
+ ASSERT_TRUE(base::DeleteFile(log_path, false))
+ << "Can't delete log file from previous run: " << log_path.value();
// Pass the command to the child process and launch the child process.
base::Process child_process = base::SpawnMultiProcessTestChild(
@@ -702,7 +706,8 @@ class ParentProcess {
EXPECT_EQ(expected_exit_code, rv);
if (!success || rv != 0) {
- internal::PrintChildProcessLogs();
+ internal::PrintChildProcessLogs(
+ ScopedLogging::GetLogFilePath(kLogSuffix));
}
}
diff --git a/chrome/chrome_cleaner/ipc/sandbox.cc b/chrome/chrome_cleaner/ipc/sandbox.cc
index 154bd05c51066..fafad4f0c6188 100644
--- a/chrome/chrome_cleaner/ipc/sandbox.cc
+++ b/chrome/chrome_cleaner/ipc/sandbox.cc
@@ -280,8 +280,9 @@ ResultCode StartSandboxTarget(const base::CommandLine& sandbox_command_line,
&last_win_error, &temp_process_info);
if (sandbox_result != sandbox::SBOX_ALL_OK) {
LOG(DFATAL) << "Failed to spawn sandbox target: " << sandbox_result
- << " , last sandbox warning : " << last_sbox_warning
- << " , last windows error: " << last_win_error;
+ << ", last sandbox warning: " << last_sbox_warning
+ << ", last windows error: "
+ << logging::SystemErrorCodeToString(last_win_error);
return RESULT_CODE_FAILED_TO_START_SANDBOX_PROCESS;
}

View file

@ -1,730 +0,0 @@
From 726cbfcfaa521e9e5098829195a7d9a9c19ca391 Mon Sep 17 00:00:00 2001
From: Joe Mason <joenotcharles@google.com>
Date: Wed, 4 Dec 2019 18:15:36 +0000
Subject: [PATCH] Move child process log capture to a ChildProcessLogger class.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Update comments to clarify how the child process log interacts with
ScopedLogging.
Use the new class to capture logs in cleaner_test.cc,
secure_dll_loading_test.cc and proto_chrome_prompt_ipc_unittest.cc.
R=proberge
(cherry picked from commit 063600229fb7dc472ff66839ba2657bf99b98850)
Bug: 1030333
Change-Id: I88f538ff360bb8ed9da6743dc5d6c4b263af992c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1947986
Commit-Queue: Joe Mason <joenotcharles@chromium.org>
Reviewed-by: proberge <proberge@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#721184}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1949631
Reviewed-by: Joe Mason <joenotcharles@chromium.org>
Cr-Commit-Position: refs/branch-heads/3904@{#914}
Cr-Branched-From: 675968a8c657a3bd9c1c2c20c5d2935577bbc5e6-refs/heads/master@{#693954}
---
chrome/chrome_cleaner/ipc/BUILD.gn | 1 +
chrome/chrome_cleaner/ipc/ipc_test_util.cc | 98 +++----------------
chrome/chrome_cleaner/ipc/ipc_test_util.h | 17 ++--
.../ipc/proto_chrome_prompt_ipc_unittest.cc | 26 +++--
chrome/chrome_cleaner/test/BUILD.gn | 3 +
.../test/child_process_logger.cc | 90 +++++++++++++++++
.../test/child_process_logger.h | 62 ++++++++++++
chrome/chrome_cleaner/test/cleaner_test.cc | 14 ++-
.../test/secure_dll_loading_test.cc | 57 ++---------
9 files changed, 207 insertions(+), 161 deletions(-)
create mode 100644 chrome/chrome_cleaner/test/child_process_logger.cc
create mode 100644 chrome/chrome_cleaner/test/child_process_logger.h
diff --git a/chrome/chrome_cleaner/ipc/BUILD.gn b/chrome/chrome_cleaner/ipc/BUILD.gn
index 03fddfd8736e1..4d81803a24df6 100644
--- a/chrome/chrome_cleaner/ipc/BUILD.gn
+++ b/chrome/chrome_cleaner/ipc/BUILD.gn
@@ -77,6 +77,7 @@ source_set("ipc_test_util") {
"//base/test:test_support",
"//chrome/chrome_cleaner/ipc:sandbox",
"//chrome/chrome_cleaner/logging:common",
+ "//chrome/chrome_cleaner/test:test_util",
"//mojo/public/cpp/system",
"//sandbox/win:sandbox",
"//testing/gtest",
diff --git a/chrome/chrome_cleaner/ipc/ipc_test_util.cc b/chrome/chrome_cleaner/ipc/ipc_test_util.cc
index 0d03a6870fb07..ea2bb2145bfdd 100644
--- a/chrome/chrome_cleaner/ipc/ipc_test_util.cc
+++ b/chrome/chrome_cleaner/ipc/ipc_test_util.cc
@@ -12,14 +12,10 @@
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
-#include "base/files/file_util.h"
-#include "base/files/scoped_temp_dir.h"
#include "base/logging.h"
#include "base/process/launch.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_piece.h"
-#include "base/strings/string_split.h"
#include "base/test/multiprocess_test.h"
#include "base/test/test_timeouts.h"
#include "base/win/win_util.h"
@@ -34,11 +30,8 @@ constexpr char kMojoPipeTokenSwitch[] = "mojo-pipe-token";
class MojoSandboxSetupHooks : public SandboxSetupHooks {
public:
- explicit MojoSandboxSetupHooks(
- SandboxedParentProcess* parent_process,
- base::win::ScopedHandle child_stdout_write_handle)
- : parent_process_(parent_process),
- child_stdout_write_handle_(std::move(child_stdout_write_handle)) {}
+ explicit MojoSandboxSetupHooks(SandboxedParentProcess* parent_process)
+ : parent_process_(parent_process) {}
~MojoSandboxSetupHooks() override = default;
// SandboxSetupHooks
@@ -50,8 +43,7 @@ class MojoSandboxSetupHooks : public SandboxSetupHooks {
parent_process_->CreateMojoPipe(command_line, &handles_to_inherit);
for (HANDLE handle : handles_to_inherit)
policy->AddHandleToShare(handle);
- policy->SetStdoutHandle(child_stdout_write_handle_.Get());
- policy->SetStderrHandle(child_stdout_write_handle_.Get());
+ parent_process_->child_process_logger().UpdateSandboxPolicy(policy);
return RESULT_CODE_SUCCESS;
}
@@ -69,38 +61,6 @@ class MojoSandboxSetupHooks : public SandboxSetupHooks {
} // namespace
-namespace internal {
-
-void PrintChildProcessLogs(const base::FilePath& log_path) {
- if (log_path.empty()) {
- LOG(ERROR) << "Child process log path is empty";
- return;
- }
-
- if (!base::PathExists(log_path)) {
- LOG(ERROR) << "Child process log file doesn't exist";
- return;
- }
-
- // Collect the child process log file, and dump the contents, to help
- // debugging failures.
- std::string log_file_contents;
- if (!base::ReadFileToString(log_path, &log_file_contents)) {
- LOG(ERROR) << "Failed to read child process log file";
- return;
- }
-
- std::vector<base::StringPiece> lines =
- base::SplitStringPiece(log_file_contents, "\n", base::TRIM_WHITESPACE,
- base::SPLIT_WANT_NONEMPTY);
- LOG(ERROR) << "Dumping child process logs";
- for (const auto& line : lines) {
- LOG(ERROR) << "Child process: " << line;
- }
-}
-
-} // namespace internal
-
ParentProcess::ParentProcess(scoped_refptr<MojoTaskRunner> mojo_task_runner)
: command_line_(base::GetMultiProcessTestChildBaseCommandLine()),
mojo_task_runner_(mojo_task_runner) {}
@@ -158,36 +118,10 @@ bool ParentProcess::LaunchConnectedChildProcess(
const std::string& child_main_function,
base::TimeDelta timeout,
int32_t* exit_code) {
- // Adapted from
- // https://cs.chromium.org/chromium/src/sandbox/win/src/handle_inheritance_test.cc
- base::ScopedTempDir temp_dir;
- if (!temp_dir.CreateUniqueTempDir()) {
- PLOG(ERROR) << "Could not create temp dir for child stdout";
+ if (!child_process_logger_.Initialize())
return false;
- }
-
- base::FilePath temp_file_name;
- if (!CreateTemporaryFileInDir(temp_dir.GetPath(), &temp_file_name)) {
- PLOG(ERROR) << "Could not create temp file for child stdout";
- return false;
- }
-
- SECURITY_ATTRIBUTES attrs = {};
- attrs.nLength = sizeof(attrs);
- attrs.bInheritHandle = true;
-
- base::win::ScopedHandle child_stdout_write_handle(
- ::CreateFile(temp_file_name.value().c_str(), GENERIC_WRITE,
- FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
- &attrs, OPEN_EXISTING, 0, nullptr));
- if (!child_stdout_write_handle.IsValid()) {
- PLOG(ERROR) << "Could not open child stdout file";
- return false;
- }
-
- if (!PrepareAndLaunchTestChildProcess(child_main_function,
- std::move(child_stdout_write_handle))) {
- internal::PrintChildProcessLogs(temp_file_name);
+ if (!PrepareAndLaunchTestChildProcess(child_main_function)) {
+ child_process_logger_.DumpLogs();
return false;
}
@@ -201,31 +135,22 @@ bool ParentProcess::LaunchConnectedChildProcess(
DestroyImplOnIPCThread();
if (!success || *exit_code != 0) {
- internal::PrintChildProcessLogs(temp_file_name);
+ child_process_logger_.DumpLogs();
}
return success;
}
bool ParentProcess::PrepareAndLaunchTestChildProcess(
- const std::string& child_main_function,
- base::win::ScopedHandle child_stdout_write_handle) {
+ const std::string& child_main_function) {
base::LaunchOptions launch_options;
launch_options.handles_to_inherit = extra_handles_to_inherit_;
- launch_options.handles_to_inherit.push_back(child_stdout_write_handle.Get());
- launch_options.stdin_handle = INVALID_HANDLE_VALUE;
- launch_options.stdout_handle = child_stdout_write_handle.Get();
- launch_options.stderr_handle = child_stdout_write_handle.Get();
-
+ child_process_logger_.UpdateLaunchOptions(&launch_options);
CreateMojoPipe(&command_line_, &launch_options.handles_to_inherit);
base::Process child_process = base::SpawnMultiProcessTestChild(
child_main_function, command_line_, launch_options);
- // Now that it's been passed to the child process,
- // |child_stdout_write_handle| can be closed in this process as it goes out
- // of scope.
-
ConnectMojoPipe(std::move(child_process));
return true;
}
@@ -257,9 +182,8 @@ SandboxedParentProcess::SandboxedParentProcess(
SandboxedParentProcess::~SandboxedParentProcess() {}
bool SandboxedParentProcess::PrepareAndLaunchTestChildProcess(
- const std::string& child_main_function,
- base::win::ScopedHandle child_stdout_write_handle) {
- MojoSandboxSetupHooks hooks(this, std::move(child_stdout_write_handle));
+ const std::string& child_main_function) {
+ MojoSandboxSetupHooks hooks(this);
// This switch usage is copied from SpawnMultiProcessTestChild.
//
diff --git a/chrome/chrome_cleaner/ipc/ipc_test_util.h b/chrome/chrome_cleaner/ipc/ipc_test_util.h
index 1b2e5598ed52a..1526a42701353 100644
--- a/chrome/chrome_cleaner/ipc/ipc_test_util.h
+++ b/chrome/chrome_cleaner/ipc/ipc_test_util.h
@@ -14,9 +14,9 @@
#include "base/process/launch.h"
#include "base/process/process.h"
#include "base/time/time.h"
-#include "base/win/scoped_handle.h"
#include "chrome/chrome_cleaner/ipc/chrome_prompt_ipc.h"
#include "chrome/chrome_cleaner/ipc/mojo_task_runner.h"
+#include "chrome/chrome_cleaner/test/child_process_logger.h"
#include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/system/invitation.h"
#include "mojo/public/cpp/system/message_pipe.h"
@@ -58,6 +58,10 @@ class ParentProcess : public base::RefCountedThreadSafe<ParentProcess> {
return extra_handles_to_inherit_;
}
+ const ChildProcessLogger& child_process_logger() const {
+ return child_process_logger_;
+ }
+
protected:
friend base::RefCountedThreadSafe<ParentProcess>;
virtual ~ParentProcess();
@@ -70,13 +74,13 @@ class ParentProcess : public base::RefCountedThreadSafe<ParentProcess> {
// as in the sandbox. Subclasses should call CreateMojoPipe before the
// subprocess is spawned and ConnectMojoPipe afterward.
virtual bool PrepareAndLaunchTestChildProcess(
- const std::string& child_main_function,
- base::win::ScopedHandle child_stdout_write_handle);
+ const std::string& child_main_function);
scoped_refptr<MojoTaskRunner> mojo_task_runner();
base::CommandLine command_line_;
base::HandlesToInheritVector extra_handles_to_inherit_;
+ ChildProcessLogger child_process_logger_;
private:
scoped_refptr<MojoTaskRunner> mojo_task_runner_;
@@ -96,8 +100,7 @@ class SandboxedParentProcess : public ParentProcess {
~SandboxedParentProcess() override;
bool PrepareAndLaunchTestChildProcess(
- const std::string& child_main_function,
- base::win::ScopedHandle child_stdout_write_handle) override;
+ const std::string& child_main_function) override;
};
class ChildProcess : public base::RefCountedThreadSafe<ChildProcess> {
@@ -143,10 +146,6 @@ class ChromePromptIPCTestErrorHandler : public ChromePromptIPC::ErrorHandler {
base::OnceClosure on_closed_after_done_;
};
-namespace internal {
-void PrintChildProcessLogs(const base::FilePath& log_file);
-} // namespace internal
-
} // namespace chrome_cleaner
#endif // CHROME_CHROME_CLEANER_IPC_IPC_TEST_UTIL_H_
diff --git a/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc b/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc
index f867df58f96ea..e3ce2ab6c27fe 100644
--- a/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc
+++ b/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc
@@ -5,7 +5,6 @@
#include <windows.h>
#include "base/command_line.h"
-#include "base/files/file_util.h"
#include "base/process/process.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
@@ -19,7 +18,7 @@
#include "base/win/win_util.h"
#include "chrome/chrome_cleaner/ipc/ipc_test_util.h"
#include "chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc.h"
-#include "chrome/chrome_cleaner/logging/scoped_logging.h"
+#include "chrome/chrome_cleaner/test/child_process_logger.h"
#include "components/chrome_cleaner/public/constants/constants.h"
#include "components/chrome_cleaner/public/proto/chrome_prompt.pb.h"
#include "components/chrome_cleaner/public/proto/chrome_prompt_for_tests.pb.h"
@@ -42,7 +41,6 @@ constexpr char kExpectedPromptResultSwitch[] = "expected-prompt-result";
constexpr char kExpectedChromeDisconnectPointSwitch[] =
"expected-parent-disconnected";
-constexpr base::char16 kLogSuffix[] = L"prompt-ipc-test";
constexpr base::char16 kInvalidUTF16String[] = {0xDC00, 0xD800, 0xD800, 0xDFFF,
0xDFFF, 0xDBFF, 0};
const base::FilePath kInvalidFilePath(kInvalidUTF16String);
@@ -421,8 +419,7 @@ class MockChrome {
// Gtest to log.
class ChildProcess {
public:
- ChildProcess()
- : scopped_logging_(std::make_unique<ScopedLogging>(kLogSuffix)) {
+ ChildProcess() {
mock_chrome_ = std::make_unique<MockChrome>(
ExtractHandleFromCommandLine(chrome_cleaner::kChromeReadHandleSwitch),
ExtractHandleFromCommandLine(chrome_cleaner::kChromeWriteHandleSwitch));
@@ -571,7 +568,6 @@ class ChildProcess {
private:
std::unique_ptr<MockChrome> mock_chrome_;
- std::unique_ptr<ScopedLogging> scopped_logging_;
ChromeDisconnectPoint expected_disconnect_point_ =
ChromeDisconnectPoint::kUnspecified;
@@ -603,6 +599,9 @@ class ProtoChromePromptIPCTest
class ParentProcess {
public:
bool Initialize() {
+ if (!child_process_logger_.Initialize())
+ return false;
+
// Inject the flags related to the the config in the command line.
test_config_.EnhanceCommandLine(&command_line_);
@@ -631,14 +630,13 @@ class ParentProcess {
}
void Run() {
- // Delete the child process log file if existing.
- const base::FilePath log_path = ScopedLogging::GetLogFilePath(kLogSuffix);
- ASSERT_TRUE(base::DeleteFile(log_path, false))
- << "Can't delete log file from previous run: " << log_path.value();
+ child_process_logger_.UpdateLaunchOptions(&launch_options_);
// Pass the command to the child process and launch the child process.
base::Process child_process = base::SpawnMultiProcessTestChild(
"ProtoChromePromptIPCClientMain", command_line_, launch_options_);
+ if (!child_process.IsRunning())
+ child_process_logger_.DumpLogs();
ASSERT_TRUE(child_process.IsRunning());
// Close our references to the handles as they are now handled by the child
@@ -705,10 +703,8 @@ class ParentProcess {
EXPECT_EQ(expected_exit_code, rv);
- if (!success || rv != 0) {
- internal::PrintChildProcessLogs(
- ScopedLogging::GetLogFilePath(kLogSuffix));
- }
+ if (!success || rv != 0)
+ child_process_logger_.DumpLogs();
}
TestConfig& GetTestConfig() { return test_config_; }
@@ -732,6 +728,8 @@ class ParentProcess {
// Blocks until we receive the response from Chrome or an error occurs.
base::RunLoop main_runloop_;
bool error_occurred_ = false;
+
+ ChildProcessLogger child_process_logger_;
};
// This contains calls to the chrome_cleaner_ipc implementation.
diff --git a/chrome/chrome_cleaner/test/BUILD.gn b/chrome/chrome_cleaner/test/BUILD.gn
index 118454c2bdcd2..4b053fdcaf182 100644
--- a/chrome/chrome_cleaner/test/BUILD.gn
+++ b/chrome/chrome_cleaner/test/BUILD.gn
@@ -148,6 +148,8 @@ source_set("test_util") {
testonly = true
sources = [
+ "child_process_logger.cc",
+ "child_process_logger.h",
"file_remover_test_util.cc",
"file_remover_test_util.h",
"reboot_deletion_helper.cc",
@@ -228,6 +230,7 @@ source_set("integration_test_sources") {
"//chrome/chrome_cleaner/os:common_os",
"//chrome/chrome_cleaner/pup_data:pup_data_base",
"//chrome/chrome_cleaner/pup_data:test_uws",
+ "//chrome/chrome_cleaner/test:test_util",
"//chrome/chrome_cleaner/zip_archiver:common",
"//components/chrome_cleaner/public/constants",
"//components/chrome_cleaner/test:test_name_helper",
diff --git a/chrome/chrome_cleaner/test/child_process_logger.cc b/chrome/chrome_cleaner/test/child_process_logger.cc
new file mode 100644
index 0000000000000..9f4836267aea6
--- /dev/null
+++ b/chrome/chrome_cleaner/test/child_process_logger.cc
@@ -0,0 +1,90 @@
+// Copyright 2019 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 "chrome/chrome_cleaner/test/child_process_logger.h"
+
+#include <vector>
+
+#include "base/files/file_util.h"
+#include "base/logging.h"
+#include "base/strings/string_piece.h"
+#include "base/strings/string_split.h"
+
+namespace chrome_cleaner {
+
+ChildProcessLogger::ChildProcessLogger() = default;
+
+ChildProcessLogger::~ChildProcessLogger() = default;
+
+bool ChildProcessLogger::Initialize() {
+ // Adapted from
+ // https://cs.chromium.org/chromium/src/sandbox/win/src/handle_inheritance_test.cc
+ if (!temp_dir_.CreateUniqueTempDir()) {
+ PLOG(ERROR) << "Could not create temp dir for child stdout";
+ return false;
+ }
+
+ if (!CreateTemporaryFileInDir(temp_dir_.GetPath(), &temp_file_name_)) {
+ PLOG(ERROR) << "Could not create temp file for child stdout";
+ return false;
+ }
+
+ SECURITY_ATTRIBUTES attrs = {};
+ attrs.nLength = sizeof(attrs);
+ attrs.bInheritHandle = true;
+
+ child_stdout_handle_.Set(
+ ::CreateFile(temp_file_name_.value().c_str(), GENERIC_WRITE,
+ FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
+ &attrs, OPEN_EXISTING, 0, nullptr));
+ if (!child_stdout_handle_.IsValid()) {
+ PLOG(ERROR) << "Could not open child stdout file";
+ return false;
+ }
+
+ return true;
+}
+
+void ChildProcessLogger::UpdateLaunchOptions(
+ base::LaunchOptions* options) const {
+ DCHECK(child_stdout_handle_.IsValid());
+ options->handles_to_inherit.push_back(child_stdout_handle_.Get());
+ options->stdin_handle = INVALID_HANDLE_VALUE;
+ options->stdout_handle = child_stdout_handle_.Get();
+ options->stderr_handle = child_stdout_handle_.Get();
+}
+
+void ChildProcessLogger::UpdateSandboxPolicy(
+ sandbox::TargetPolicy* policy) const {
+ DCHECK(child_stdout_handle_.IsValid());
+ policy->SetStdoutHandle(child_stdout_handle_.Get());
+ policy->SetStderrHandle(child_stdout_handle_.Get());
+}
+
+void ChildProcessLogger::DumpLogs() const {
+ DCHECK(!temp_file_name_.empty());
+
+ if (!base::PathExists(temp_file_name_)) {
+ LOG(ERROR) << "Child process log file doesn't exist";
+ return;
+ }
+
+ // Collect the child process log file, and dump the contents, to help
+ // debugging failures.
+ std::string log_file_contents;
+ if (!base::ReadFileToString(temp_file_name_, &log_file_contents)) {
+ LOG(ERROR) << "Failed to read child process log file";
+ return;
+ }
+
+ std::vector<base::StringPiece> lines =
+ base::SplitStringPiece(log_file_contents, "\n", base::TRIM_WHITESPACE,
+ base::SPLIT_WANT_NONEMPTY);
+ LOG(ERROR) << "Dumping child process logs";
+ for (const auto& line : lines) {
+ LOG(ERROR) << "Child process: " << line;
+ }
+}
+
+} // namespace chrome_cleaner
diff --git a/chrome/chrome_cleaner/test/child_process_logger.h b/chrome/chrome_cleaner/test/child_process_logger.h
new file mode 100644
index 0000000000000..215fa911d7899
--- /dev/null
+++ b/chrome/chrome_cleaner/test/child_process_logger.h
@@ -0,0 +1,62 @@
+// Copyright 2019 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 CHROME_CHROME_CLEANER_TEST_CHILD_PROCESS_LOGGER_H_
+#define CHROME_CHROME_CLEANER_TEST_CHILD_PROCESS_LOGGER_H_
+
+#include "base/files/scoped_temp_dir.h"
+#include "base/process/launch.h"
+#include "base/win/scoped_handle.h"
+#include "sandbox/win/src/sandbox_policy.h"
+
+namespace chrome_cleaner {
+
+// Redirects stdin and stdout of a child process to a temp file. Tests that
+// spawn children can add the contents of the temp file to the test output.
+//
+// Note that if the child process sets up ScopedLogging, ERROR and FATAL level
+// logs will still be captured by this, but other logs will start going to the
+// ScopedLogging log file. test_main.cc sets up ScopedLogging so usually this
+// class will capture:
+//
+// 1. All log lines from before the ScopedLogging constructor.
+// 2. ERROR and FATAL log lines from after that.
+// 3. stdout and stderr output that doesn't go through the logging system.
+// 4. Stack traces from any crashes.
+//
+// This should be all that's needed to diagnose errors in tests.
+class ChildProcessLogger {
+ public:
+ ChildProcessLogger();
+ ~ChildProcessLogger();
+
+ // Creates a temp file for child processes to log to. Logs an error and
+ // returns false on failure.
+ bool Initialize();
+
+ // Updates |options| to direct the child stdout and stderr to the temp file.
+ // For use with base::LaunchProcess and base::SpawnMultiProcessTestChild.
+ void UpdateLaunchOptions(base::LaunchOptions* options) const;
+
+ // Updates |policy| to direct the child stdout and stderr to the temp file.
+ // For use with sandbox::BrokerServices::SpawnTarget.
+ void UpdateSandboxPolicy(sandbox::TargetPolicy* policy) const;
+
+ // Writes every line in the temp file using LOG(ERROR) so that all lines are
+ // captured in the test suite output. The class-level comment above describes
+ // which log lines from the child will be captured.
+ void DumpLogs() const;
+
+ private:
+ ChildProcessLogger(const ChildProcessLogger& other) = delete;
+ ChildProcessLogger& operator=(const ChildProcessLogger& other) = delete;
+
+ base::ScopedTempDir temp_dir_;
+ base::FilePath temp_file_name_;
+ base::win::ScopedHandle child_stdout_handle_;
+};
+
+} // namespace chrome_cleaner
+
+#endif // CHROME_CHROME_CLEANER_TEST_CHILD_PROCESS_LOGGER_H_
diff --git a/chrome/chrome_cleaner/test/cleaner_test.cc b/chrome/chrome_cleaner/test/cleaner_test.cc
index d6df17e3516f1..f778103bfdad3 100644
--- a/chrome/chrome_cleaner/test/cleaner_test.cc
+++ b/chrome/chrome_cleaner/test/cleaner_test.cc
@@ -24,6 +24,7 @@
#include "chrome/chrome_cleaner/os/pre_fetched_paths.h"
#include "chrome/chrome_cleaner/pup_data/pup_data.h"
#include "chrome/chrome_cleaner/pup_data/test_uws.h"
+#include "chrome/chrome_cleaner/test/child_process_logger.h"
#include "chrome/chrome_cleaner/test/test_util.h"
#include "chrome/chrome_cleaner/zip_archiver/sandboxed_zip_archiver.h"
#include "components/chrome_cleaner/public/constants/constants.h"
@@ -311,8 +312,14 @@ class CleanerTest
void ExpectExitCode(const base::CommandLine& command_line,
int expected_exit_code) {
- base::Process process(
- base::LaunchProcess(command_line, base::LaunchOptions()));
+ chrome_cleaner::ChildProcessLogger logger;
+ ASSERT_TRUE(logger.Initialize());
+
+ base::LaunchOptions options;
+ logger.UpdateLaunchOptions(&options);
+ base::Process process(base::LaunchProcess(command_line, options));
+ if (!process.IsValid())
+ logger.DumpLogs();
ASSERT_TRUE(process.IsValid());
int exit_code = -1;
@@ -320,7 +327,8 @@ class CleanerTest
base::TimeDelta::FromMinutes(10), &exit_code);
EXPECT_TRUE(exited_within_timeout);
EXPECT_EQ(expected_exit_code, exit_code);
-
+ if (!exited_within_timeout || expected_exit_code != exit_code)
+ logger.DumpLogs();
if (!exited_within_timeout)
process.Terminate(/*exit_code=*/-1, /*wait=*/false);
}
diff --git a/chrome/chrome_cleaner/test/secure_dll_loading_test.cc b/chrome/chrome_cleaner/test/secure_dll_loading_test.cc
index fe10c44346b5e..92e2db19fde6c 100644
--- a/chrome/chrome_cleaner/test/secure_dll_loading_test.cc
+++ b/chrome/chrome_cleaner/test/secure_dll_loading_test.cc
@@ -8,22 +8,17 @@
#include <memory>
#include <set>
-#include <string>
#include <vector>
#include "base/base_paths.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
-#include "base/files/file_util.h"
-#include "base/files/scoped_temp_dir.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/process/process.h"
#include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_piece.h"
-#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/synchronization/waitable_event.h"
#include "base/test/test_timeouts.h"
@@ -32,54 +27,16 @@
#include "chrome/chrome_cleaner/constants/chrome_cleaner_switches.h"
#include "chrome/chrome_cleaner/os/inheritable_event.h"
#include "chrome/chrome_cleaner/os/process.h"
+#include "chrome/chrome_cleaner/test/child_process_logger.h"
#include "chrome/chrome_cleaner/test/test_util.h"
#include "components/chrome_cleaner/public/constants/constants.h"
#include "components/chrome_cleaner/test/test_name_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace {
-
-void PrintChildProcessLogs(const base::FilePath& log_dir,
- base::StringPiece16 file_name) {
- base::string16 base_name;
- if (file_name == L"software_reporter_tool") {
- base_name = L"software_reporter_tool";
- } else if (file_name == L"chrome_cleanup_tool") {
- base_name = L"chrome_cleanup";
- } else {
- LOG(ERROR) << "Unknown file name " << file_name.data();
- return;
- }
-
- base::FilePath log_path = log_dir.Append(base_name).AddExtension(L"log");
-
- if (!base::PathExists(log_path)) {
- LOG(ERROR) << "Child process log file doesn't exist";
- return;
- }
-
- // Collect the child process log file, and dump the contents, to help
- // debugging failures.
- std::string log_file_contents;
- if (!base::ReadFileToString(log_path, &log_file_contents)) {
- LOG(ERROR) << "Failed to read child process log file";
- return;
- }
-
- std::vector<base::StringPiece> lines =
- base::SplitStringPiece(log_file_contents, "\n", base::TRIM_WHITESPACE,
- base::SPLIT_WANT_NONEMPTY);
- LOG(ERROR) << "Dumping child process logs";
- for (const auto& line : lines) {
- LOG(ERROR) << "Child process: " << line;
- }
-}
-
-} // namespace
-
class SecureDLLLoadingTest : public testing::TestWithParam<base::string16> {
protected:
void SetUp() override {
+ ASSERT_TRUE(child_process_logger_.Initialize());
base::FilePath out_dir;
ASSERT_TRUE(base::PathService::Get(base::DIR_EXE, &out_dir));
exe_path_ = out_dir.Append(GetParam() + L".exe");
@@ -104,8 +61,6 @@ class SecureDLLLoadingTest : public testing::TestWithParam<base::string16> {
base::NumberToString16(
base::win::HandleToUint32(init_done_notifier->handle())));
command_line.AppendSwitch(chrome_cleaner::kLoadEmptyDLLSwitch);
- command_line.AppendSwitchPath(chrome_cleaner::kTestLoggingPathSwitch,
- log_dir.GetPath());
#if !BUILDFLAG(IS_OFFICIAL_CHROME_CLEANER_BUILD)
if (disable_secure_dll_loading)
@@ -121,7 +76,12 @@ class SecureDLLLoadingTest : public testing::TestWithParam<base::string16> {
base::LaunchOptions options;
options.handles_to_inherit.push_back(init_done_notifier->handle());
+ child_process_logger_.UpdateLaunchOptions(&options);
base::Process process = base::LaunchProcess(command_line, options);
+ if (!process.IsValid()) {
+ child_process_logger_.DumpLogs();
+ return process;
+ }
// Make sure the process has finished its initialization (including loading
// DLLs). Also check the process handle in case it exits with an error.
@@ -136,7 +96,7 @@ class SecureDLLLoadingTest : public testing::TestWithParam<base::string16> {
PLOG_IF(ERROR, !::GetExitCodeProcess(process.Handle(), &exit_code));
ADD_FAILURE() << "Process exited with " << exit_code
<< " before signalling init_done_notifier";
- PrintChildProcessLogs(log_dir.GetPath(), GetParam());
+ child_process_logger_.DumpLogs();
} else {
EXPECT_EQ(wait_result, WAIT_OBJECT_0);
}
@@ -157,6 +117,7 @@ class SecureDLLLoadingTest : public testing::TestWithParam<base::string16> {
}
private:
+ chrome_cleaner::ChildProcessLogger child_process_logger_;
base::FilePath exe_path_;
base::FilePath empty_dll_path_;
};

View file

@ -1,186 +0,0 @@
From 890956be1496b625967df0bbf620e8fc4aefb390 Mon Sep 17 00:00:00 2001
From: Joe Mason <joenotcharles@google.com>
Date: Wed, 4 Dec 2019 18:22:34 +0000
Subject: [PATCH] Use ChildProcessLogger in FileRemoverQuarantineTest and
SandboxedShortcutParserTest
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
R=proberge
(cherry picked from commit 814583834ebf35ede5dad0ba3574343851b1a8bd)
Bug: 1030333
Change-Id: I66b9b3dc73980e8ed03ee37d89eb172b5330c913
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948235
Commit-Queue: Joe Mason <joenotcharles@chromium.org>
Reviewed-by: proberge <proberge@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#721193}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948102
Reviewed-by: Joe Mason <joenotcharles@chromium.org>
Cr-Commit-Position: refs/branch-heads/3904@{#915}
Cr-Branched-From: 675968a8c657a3bd9c1c2c20c5d2935577bbc5e6-refs/heads/master@{#693954}
---
.../os/file_remover_unittest.cc | 39 ++++++++++++++++---
.../parsers/shortcut_parser/broker/BUILD.gn | 1 +
.../sandboxed_shortcut_parser_unittest.cc | 35 +++++++++++++++--
3 files changed, 67 insertions(+), 8 deletions(-)
diff --git a/chrome/chrome_cleaner/os/file_remover_unittest.cc b/chrome/chrome_cleaner/os/file_remover_unittest.cc
index 52c9b4f1c5089..c57983e83c6b9 100644
--- a/chrome/chrome_cleaner/os/file_remover_unittest.cc
+++ b/chrome/chrome_cleaner/os/file_remover_unittest.cc
@@ -30,6 +30,7 @@
#include "chrome/chrome_cleaner/os/pre_fetched_paths.h"
#include "chrome/chrome_cleaner/os/system_util.h"
#include "chrome/chrome_cleaner/os/whitelisted_directory.h"
+#include "chrome/chrome_cleaner/test/child_process_logger.h"
#include "chrome/chrome_cleaner/test/file_remover_test_util.h"
#include "chrome/chrome_cleaner/test/reboot_deletion_helper.h"
#include "chrome/chrome_cleaner/test/resources/grit/test_resources.h"
@@ -398,20 +399,47 @@ constexpr wchar_t kTestExpectArchiveName[] =
L"temp_file.exe_"
L"A591A6D40BF420404A011733CFB7B190D62C65BF0BCDA32B57B277D9AD9F146E.zip";
+class LoggedZipArchiverSandboxSetupHooks : public ZipArchiverSandboxSetupHooks {
+ public:
+ explicit LoggedZipArchiverSandboxSetupHooks(
+ scoped_refptr<MojoTaskRunner> mojo_task_runner,
+ base::OnceClosure connection_error_handler,
+ chrome_cleaner::ChildProcessLogger* child_process_logger)
+ : ZipArchiverSandboxSetupHooks(std::move(mojo_task_runner),
+ std::move(connection_error_handler)),
+ child_process_logger_(child_process_logger) {}
+
+ ResultCode UpdateSandboxPolicy(sandbox::TargetPolicy* policy,
+ base::CommandLine* command_line) override {
+ child_process_logger_->UpdateSandboxPolicy(policy);
+ return ZipArchiverSandboxSetupHooks::UpdateSandboxPolicy(policy,
+ command_line);
+ }
+
+ private:
+ chrome_cleaner::ChildProcessLogger* child_process_logger_;
+};
+
class FileRemoverQuarantineTest : public base::MultiProcessTest,
public ::testing::WithParamInterface<bool> {
public:
void SetUp() override {
use_reboot_removal_ = GetParam();
+ ASSERT_TRUE(child_process_logger_.Initialize());
+
scoped_refptr<MojoTaskRunner> mojo_task_runner = MojoTaskRunner::Create();
- ZipArchiverSandboxSetupHooks setup_hooks(
+ LoggedZipArchiverSandboxSetupHooks setup_hooks(
mojo_task_runner.get(), base::BindOnce([] {
FAIL() << "ZipArchiver sandbox connection error";
- }));
- ASSERT_EQ(RESULT_CODE_SUCCESS,
- StartSandboxTarget(MakeCmdLine("FileRemoverQuarantineTargetMain"),
- &setup_hooks, SandboxType::kTest));
+ }),
+ &child_process_logger_);
+ ResultCode result_code =
+ StartSandboxTarget(MakeCmdLine("FileRemoverQuarantineTargetMain"),
+ &setup_hooks, SandboxType::kTest);
+ if (result_code != RESULT_CODE_SUCCESS)
+ child_process_logger_.DumpLogs();
+ ASSERT_EQ(RESULT_CODE_SUCCESS, result_code);
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
@@ -447,6 +475,7 @@ class FileRemoverQuarantineTest : public base::MultiProcessTest,
base::test::SingleThreadTaskEnvironment task_environment_;
base::ScopedTempDir temp_dir_;
std::unique_ptr<FileRemover> file_remover_;
+ chrome_cleaner::ChildProcessLogger child_process_logger_;
};
} // namespace
diff --git a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/BUILD.gn b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/BUILD.gn
index bc7ba8188c83b..09ed07b761a4e 100644
--- a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/BUILD.gn
+++ b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/BUILD.gn
@@ -67,6 +67,7 @@ source_set("unittest_sources") {
"//chrome/chrome_cleaner/parsers/shortcut_parser:sandboxed_lnk_parser_test_util",
"//chrome/chrome_cleaner/parsers/shortcut_parser/target:lnk_parser",
"//chrome/chrome_cleaner/parsers/target:parser_sandbox_target",
+ "//chrome/chrome_cleaner/test:test_util",
"//mojo/public/cpp/bindings:bindings",
"//sandbox/win:sandbox",
"//testing/gtest",
diff --git a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser_unittest.cc b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser_unittest.cc
index 64ac91ed92016..4c033f21c77c3 100644
--- a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser_unittest.cc
+++ b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser_unittest.cc
@@ -18,6 +18,7 @@
#include "chrome/chrome_cleaner/parsers/broker/sandbox_setup_hooks.h"
#include "chrome/chrome_cleaner/parsers/shortcut_parser/sandboxed_lnk_parser_test_util.h"
#include "chrome/chrome_cleaner/parsers/target/sandbox_setup.h"
+#include "chrome/chrome_cleaner/test/child_process_logger.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "sandbox/win/src/sandbox_factory.h"
@@ -31,6 +32,26 @@ constexpr unsigned int kDirQuantity = 5;
const base::string16 kLnkArguments = L"-a -b -c -d GenericExample";
+class LoggedParserSandboxSetupHooks : public ParserSandboxSetupHooks {
+ public:
+ explicit LoggedParserSandboxSetupHooks(
+ scoped_refptr<MojoTaskRunner> mojo_task_runner,
+ base::OnceClosure connection_error_handler,
+ chrome_cleaner::ChildProcessLogger* child_process_logger)
+ : ParserSandboxSetupHooks(std::move(mojo_task_runner),
+ std::move(connection_error_handler)),
+ child_process_logger_(child_process_logger) {}
+
+ ResultCode UpdateSandboxPolicy(sandbox::TargetPolicy* policy,
+ base::CommandLine* command_line) override {
+ child_process_logger_->UpdateSandboxPolicy(policy);
+ return ParserSandboxSetupHooks::UpdateSandboxPolicy(policy, command_line);
+ }
+
+ private:
+ chrome_cleaner::ChildProcessLogger* child_process_logger_;
+};
+
} // namespace
class SandboxedShortcutParserTest : public base::MultiProcessTest {
@@ -40,14 +61,20 @@ class SandboxedShortcutParserTest : public base::MultiProcessTest {
temp_dirs_with_chrome_lnk_(kDirQuantity) {}
void SetUp() override {
+ ASSERT_TRUE(child_process_logger_.Initialize());
+
mojo_task_runner_ = MojoTaskRunner::Create();
ParserSandboxSetupHooks setup_hooks(
mojo_task_runner_.get(),
base::BindOnce([] { FAIL() << "Parser sandbox connection error"; }));
- ASSERT_EQ(
- RESULT_CODE_SUCCESS,
+
+ ResultCode result_code =
StartSandboxTarget(MakeCmdLine("SandboxedShortcutParserTargetMain"),
- &setup_hooks, SandboxType::kTest));
+ &setup_hooks, SandboxType::kTest);
+ if (result_code != RESULT_CODE_SUCCESS)
+ child_process_logger_.DumpLogs();
+ ASSERT_EQ(RESULT_CODE_SUCCESS, result_code);
+
parser_ptr_ = setup_hooks.TakeParserPtr();
shortcut_parser_ = std::make_unique<SandboxedShortcutParser>(
mojo_task_runner_.get(), parser_ptr_.get());
@@ -98,6 +125,8 @@ class SandboxedShortcutParserTest : public base::MultiProcessTest {
base::FilePath not_lnk_file_path_;
base::test::TaskEnvironment task_environment_;
+
+ chrome_cleaner::ChildProcessLogger child_process_logger_;
};
MULTIPROCESS_TEST_MAIN(SandboxedShortcutParserTargetMain) {

View file

@ -1,26 +0,0 @@
From c1109b707b1eda5d98eb2ed6bd74083bc352f482 Mon Sep 17 00:00:00 2001
From: chrome-release-bot <chrome-release-bot@chromium.org>
Date: Fri, 6 Dec 2019 01:09:50 +0000
Subject: [PATCH] Incrementing VERSION to 78.0.3904.130
TBR=govind@chromium.org
Change-Id: Ib675653e2605cf2c15ebdbd1320465b08a49994d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1954709
Reviewed-by: Chrome Release Bot (LUCI) <chrome-official-brancher@chops-service-accounts.iam.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/3904@{#917}
Cr-Branched-From: 675968a8c657a3bd9c1c2c20c5d2935577bbc5e6-refs/heads/master@{#693954}
---
chrome/VERSION | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/chrome/VERSION b/chrome/VERSION
index 7a4383a1ccb7f..50f887f746227 100644
--- a/chrome/VERSION
+++ b/chrome/VERSION
@@ -1,4 +1,4 @@
MAJOR=78
MINOR=0
BUILD=3904
-PATCH=108
+PATCH=130

View file

@ -1,13 +0,0 @@
diff --git a/base/location.h b/base/location.h
index c07e747..924db1c 100644
--- a/base/location.h
+++ b/base/location.h
@@ -18,7 +18,7 @@
namespace base {
-#if defined(__has_builtin)
+#if defined(__clang__)
// Clang allows detection of these builtins.
#define SUPPORTS_LOCATION_BUILTINS \
(__has_builtin(__builtin_FUNCTION) && __has_builtin(__builtin_FILE) && \

View file

@ -1,82 +0,0 @@
From 7ac85fb4cc6f44a21761a591ac497ae3d6bf966d Mon Sep 17 00:00:00 2001
From: Allan Sandfeld Jensen <allan.jensen@qt.io>
Date: Mon, 23 Sep 2019 13:49:53 +0200
Subject: [PATCH] Fix building with pulseaudio 13
The function signature changed though the ABI stayed the same.
(Modified to apply on chromium sources too)
Change-Id: I86ca361b5e4f0c523e1031910df438c23beee876
Fixes: QTBUG-77037
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
---
diff --git a/media/audio/pulse/pulse.sigs b/media/audio/pulse/pulse.sigs
index 8b58887..daaeb14 100644
--- a/media/audio/pulse/pulse.sigs
+++ b/media/audio/pulse/pulse.sigs
@@ -24,11 +24,11 @@
pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
-pa_context_state_t pa_context_get_state(pa_context* c);
+pa_context_state_t pa_context_get_state(const_pa_context_ptr c);
pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
-pa_operation_state_t pa_operation_get_state(pa_operation* o);
+pa_operation_state_t pa_operation_get_state(const_pa_operation_ptr o);
void pa_context_unref(pa_context* c);
void pa_operation_unref(pa_operation* o);
int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
@@ -38,23 +38,23 @@
int pa_stream_disconnect(pa_stream* s);
int pa_stream_drop(pa_stream *p);
pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
-uint32_t pa_stream_get_device_index(pa_stream* s);
+uint32_t pa_stream_get_device_index(const_pa_stream_ptr s);
int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
-pa_stream_state_t pa_stream_get_state(pa_stream* p);
+pa_stream_state_t pa_stream_get_state(const_pa_stream_ptr p);
pa_stream* pa_stream_new(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map * map);
pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
pa_proplist* pa_proplist_new(void);
-int pa_proplist_contains(pa_proplist* p, const char* key);
+int pa_proplist_contains(const_pa_proplist_ptr p, const char* key);
void pa_proplist_free(pa_proplist* p);
-const char* pa_proplist_gets(pa_proplist* p, const char* key);
+const char* pa_proplist_gets(const_pa_proplist_ptr p, const char* key);
int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
-size_t pa_stream_readable_size(pa_stream *p);
+size_t pa_stream_readable_size(const_pa_stream_ptr p);
int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
void pa_stream_unref(pa_stream* s);
-int pa_context_errno(pa_context *c);
+int pa_context_errno(const_pa_context_ptr c);
const char* pa_strerror(int error);
pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned channels, pa_volume_t v);
diff --git a/chromium/media/audio/pulse/pulse_stub_header.fragment b/chromium/media/audio/pulse/pulse_stub_header.fragment
index 2a2d3e7..cdaa841 100644
--- a/media/audio/pulse/pulse_stub_header.fragment
+++ b/media/audio/pulse/pulse_stub_header.fragment
@@ -5,4 +5,15 @@
#include <pulse/pulseaudio.h>
+#if PA_MAJOR > 12
+typedef const pa_context* const_pa_context_ptr;
+typedef const pa_operation* const_pa_operation_ptr;
+typedef const pa_proplist* const_pa_proplist_ptr;
+typedef const pa_stream* const_pa_stream_ptr;
+#else
+typedef pa_context* const_pa_context_ptr;
+typedef pa_operation* const_pa_operation_ptr;
+typedef pa_proplist* const_pa_proplist_ptr;
+typedef pa_stream* const_pa_stream_ptr;
+#endif
}

View file

@ -1,20 +0,0 @@
diff --git a/build/linux/unbundle/icu.gn b/build/linux/unbundle/icu.gn
index 4450e40..9ca36dd 100644
--- a/build/linux/unbundle/icu.gn
+++ b/build/linux/unbundle/icu.gn
@@ -96,6 +96,7 @@ shim_headers("icui18n_shim") {
"unicode/fpositer.h",
"unicode/gender.h",
"unicode/gregocal.h",
+ "unicode/listformatter.h",
"unicode/measfmt.h",
"unicode/measunit.h",
"unicode/measure.h",
@@ -178,7 +179,6 @@ shim_headers("icuuc_shim") {
"unicode/icudataver.h",
"unicode/icuplug.h",
"unicode/idna.h",
- "unicode/listformatter.h",
"unicode/localpointer.h",
"unicode/locdspnm.h",
"unicode/locid.h",

View file

@ -1,102 +0,0 @@
From 6b633c4b14850df376d5cec571699018772f358e Mon Sep 17 00:00:00 2001
From: Tomas Popela <tomas.popela@gmail.com>
Date: Tue, 17 Sep 2019 19:48:48 +0000
Subject: [PATCH] GCC: Can't use alignas() together with __attribute__()
It's because GCC has problems when mixing the alignas() together with
__attribute__() (that is used to export the symbols). The best
solution is to use ALIGNAS() macro from //base/compiler_specific.h
together with alignof() to have the equal functionality that compiles on
GCC as well as on clang.
Bug: 819294
Change-Id: Ieb169592a2965f17a18bfc88d28418eb723a4e5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1806735
Auto-Submit: Tom Popela <tomas.popela@gmail.com>
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697330}
---
diff --git a/base/task/promise/dependent_list.h b/base/task/promise/dependent_list.h
index 020bdbfc..3245c1c 100644
--- a/base/task/promise/dependent_list.h
+++ b/base/task/promise/dependent_list.h
@@ -59,7 +59,7 @@
// Align Node on an 8-byte boundary to ensure the first 3 bits are 0 and can
// be used to store additional state (see static_asserts below).
- class BASE_EXPORT alignas(8) Node {
+ class BASE_EXPORT ALIGNAS(8) Node {
public:
Node();
explicit Node(Node&& other) noexcept;
Re-use chromium alignas workaround in protobuf.
---
diff --git a/third_party/protobuf/src/google/protobuf/port_def.inc b/third_party/protobuf/src/google/protobuf/port_def.inc
index f1bd85d..9c204a1 100644
--- a/third_party/protobuf/src/google/protobuf/port_def.inc
+++ b/third_party/protobuf/src/google/protobuf/port_def.inc
@@ -528,6 +528,35 @@ PROTOBUF_EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport));
#undef IN
#endif // _MSC_VER
+// Specify memory alignment for structs, classes, etc.
+// Use like:
+// class PROTOBUF_ALIGNAS(16) MyClass { ... }
+// PROTOBUF_ALIGNAS(16) int array[4];
+//
+// In most places you can use the C++11 keyword "alignas", which is preferred.
+//
+// But compilers have trouble mixing __attribute__((...)) syntax with
+// alignas(...) syntax.
+//
+// Doesn't work in clang or gcc:
+// struct alignas(16) __attribute__((packed)) S { char c; };
+// Works in clang but not gcc:
+// struct __attribute__((packed)) alignas(16) S2 { char c; };
+// Works in clang and gcc:
+// struct alignas(16) S3 { char c; } __attribute__((packed));
+//
+// There are also some attributes that must be specified *before* a class
+// definition: visibility (used for exporting functions/classes) is one of
+// these attributes. This means that it is not possible to use alignas() with a
+// class that is marked as exported.
+#if defined(_MSC_VER)
+#define PROTOBUF_ALIGNAS(byte_alignment) __declspec(align(byte_alignment))
+#elif defined(__GNUC__)
+#define PROTOBUF_ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
+#else
+#define PROTOBUF_ALIGNAS(byte_alignment) alignas(byte_alignment)
+#endif
+
#if defined(__clang__)
#pragma clang diagnostic push
// TODO(gerbens) ideally we cleanup the code. But a cursory try shows many
diff --git a/third_party/protobuf/src/google/protobuf/arena.h b/third_party/protobuf/src/google/protobuf/arena.h
index dedc221..a8515ce 100644
--- a/third_party/protobuf/src/google/protobuf/arena.h
+++ b/third_party/protobuf/src/google/protobuf/arena.h
@@ -245,7 +245,7 @@ struct ArenaOptions {
// well as protobuf container types like RepeatedPtrField and Map. The protocol
// is internal to protobuf and is not guaranteed to be stable. Non-proto types
// should not rely on this protocol.
-class PROTOBUF_EXPORT alignas(8) Arena final {
+class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
public:
// Arena constructor taking custom options. See ArenaOptions below for
// descriptions of the options available.
diff --git a/third_party/protobuf/src/google/protobuf/port_undef.inc b/third_party/protobuf/src/google/protobuf/port_undef.inc
index b7e67fe..ba1fffc 100644
--- a/third_party/protobuf/src/google/protobuf/port_undef.inc
+++ b/third_party/protobuf/src/google/protobuf/port_undef.inc
@@ -80,6 +80,7 @@
#undef PROTOBUF_EXPORT_TEMPLATE_STYLE_MATCH_foj3FJo5StF0OvIzl7oMxA__declspec
#undef PROTOBUF_EXPORT_TEMPLATE_STYLE_MATCH_DECLSPEC_dllexport
#undef PROTOBUF_EXPORT_TEMPLATE_STYLE_MATCH_DECLSPEC_dllimport
+#undef PROTOBUF_ALIGNAS

View file

@ -1,46 +0,0 @@
From 9662ec844017690d5fd56bf0f05ef6a540dd29c1 Mon Sep 17 00:00:00 2001
From: Tom Anderson <thomasanderson@chromium.org>
Date: Mon, 09 Sep 2019 19:06:01 +0000
Subject: [PATCH] Fix GCC build error
Fixes this error:
[ 375s] In file included from ../../base/task/common/intrusive_heap.h:8,
[ 375s] from ../../base/task/thread_pool/task_source.h:17,
[ 375s] from ../../base/task/thread_pool/task_tracker.h:27,
[ 375s] from ./../../base/task/thread_pool/service_thread.cc:14,
[ 375s] from gen/base/base_jumbo_28.cc:5:
[ 375s] ../../base/containers/intrusive_heap.h:152:36: error: enumerator value
'-1' is outside the range of underlying type 'size_t' {aka 'long unsigned int'}
[ 375s] 152 | enum : size_t { kInvalidIndex = -1 };
[ 375s] |
Change-Id: I6044fb704931b2f8416f6b19a247ae297cd7b0d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1792763
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694853}
---
diff --git a/base/containers/intrusive_heap.h b/base/containers/intrusive_heap.h
index 53d3909..d7626bb 100644
--- a/base/containers/intrusive_heap.h
+++ b/base/containers/intrusive_heap.h
@@ -131,6 +131,7 @@
#include <algorithm>
#include <functional>
+#include <limits>
#include <type_traits>
#include <utility>
#include <vector>
@@ -149,7 +150,7 @@
// in place.
class BASE_EXPORT HeapHandle {
public:
- enum : size_t { kInvalidIndex = -1 };
+ enum : size_t { kInvalidIndex = std::numeric_limits<size_t>::max() };
constexpr HeapHandle() = default;
constexpr HeapHandle(const HeapHandle& other) = default;

View file

@ -1,32 +0,0 @@
From d16cda8fc3476cc534a756873cc8aa2692a57054 Mon Sep 17 00:00:00 2001
From: Jose Dapena Paz <jose.dapena@lge.com>
Date: Thu, 22 Aug 2019 13:13:36 +0200
Subject: [PATCH] GCC: declare noexcept move constructor/assign operators of V8StackTraceId
blink::BlinkCloneableMessage declares default implementation of
move operator/assign operator that requires v8_inspector::V8StackTraceId
to declare its move constructor/assign operator too.
Bug: chromium:819294
Change-Id: Iaf626ee8245efcba372a17cdf2de448e691d41d6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1796062
Commit-Queue: José Dapena Paz <jose.dapena@lge.com>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63799}
---
diff --git a/v8/include/v8-inspector.h b/v8/include/v8-inspector.h
index ce5b777..ed4cdec 100644
--- a/v8/include/v8-inspector.h
+++ b/v8/include/v8-inspector.h
@@ -231,7 +231,10 @@ struct V8_EXPORT V8StackTraceId {
std::pair<int64_t, int64_t> debugger_id;
V8StackTraceId();
+ V8StackTraceId(const V8StackTraceId&) = default;
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id);
+ V8StackTraceId& operator=(const V8StackTraceId&) = default;
+ V8StackTraceId& operator=(V8StackTraceId&&) noexcept = default;
~V8StackTraceId() = default;
bool IsInvalid() const;

View file

@ -1,12 +0,0 @@
diff --git a/ui/platform_window/x11/x11_window.cc b/ui/platform_window/x11/x11_window.cc
index 7a3a6eb..7c01534 100644
--- a/ui/platform_window/x11/x11_window.cc
+++ b/ui/platform_window/x11/x11_window.cc
@@ -67,6 +67,7 @@ ui::XWindow::Configuration ConvertInitPropertiesToXWindowConfig(
config.wm_role_name = properties.wm_role_name;
config.activatable = properties.activatable;
config.visual_id = properties.x_visual_id;
+ config.icon = properties.icon;
return config;
}

View file

@ -1,40 +0,0 @@
From bbfe2665923225b4a7c436ba2b6c7e5f695f2e52 Mon Sep 17 00:00:00 2001
From: David Landell <landell@vewd.com>
Date: Fri, 13 Sep 2019 12:24:13 +0000
Subject: [PATCH] Add missing include for unique_ptr
Change-Id: I614d2f42868d563eb6a92dfb2aae08286e20d687
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1803137
Reviewed-by: Henrik Boström <hbos@chromium.org>
Commit-Queue: Henrik Boström <hbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#696355}
---
diff --git a/third_party/blink/public/platform/web_rtc_rtp_source.h b/third_party/blink/public/platform/web_rtc_rtp_source.h
index 959440f..c3fd542 100644
--- a/third_party/blink/public/platform/web_rtc_rtp_source.h
+++ b/third_party/blink/public/platform/web_rtc_rtp_source.h
@@ -5,6 +5,8 @@
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_RTP_SOURCE_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_RTP_SOURCE_H_
+#include <memory>
+
#include "base/optional.h"
#include "third_party/blink/public/platform/web_common.h"
Missing include due to reverting ProfileManagerObserver
---
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_util.cc b/chrome/browser/web_applications/extensions/bookmark_app_util.cc
index ee4b70a..b31e5f5 100644
--- a/chrome/browser/web_applications/extensions/bookmark_app_util.cc
+++ b/chrome/browser/web_applications/extensions/bookmark_app_util.cc
@@ -7,6 +7,7 @@
#include "base/strings/string_piece.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/web_applications/components/app_registrar.h"
#include "chrome/browser/web_applications/components/web_app_provider_base.h"
#include "chrome/common/chrome_features.h"

View file

@ -1,43 +0,0 @@
From e73aed9a5ef15102f29ac31b70290faf5c90f9fe Mon Sep 17 00:00:00 2001
From: Evan Stade <estade@chromium.org>
Date: Wed, 16 Oct 2019 16:01:32 +0000
Subject: [PATCH] Fix shutdown crash in ProfileManager.
OnProfileMarkedForPermanentDeletion should move from
ProfileManagerObserver to ProfileObserver, which would also
fix this bug. However, changing the order of members is the
quickest and most cherry-pick-able way to avoid the crash.
Bug: 1005244
Change-Id: If2db68c846dd418cd02864b57b9b543687fa1e03
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1863518
Auto-Submit: Evan Stade <estade@chromium.org>
Reviewed-by: David Roger <droger@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706467}
---
diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h
index b60df76d..7d02af7 100644
--- a/chrome/browser/profiles/profile_manager.h
+++ b/chrome/browser/profiles/profile_manager.h
@@ -409,6 +409,10 @@ class ProfileManager : public content::NotificationObserver,
const base::FilePath& profile_dir);
#endif // !defined(OS_ANDROID)
+ // Destroy after |profile_info_cache_| since Profile destruction may trigger
+ // some observers to unregister themselves.
+ base::ObserverList<ProfileManagerObserver> observers_;
+
// Object to cache various information about profiles. Contains information
// about every profile which has been created for this instance of Chrome,
// if it has not been explicitly deleted. It must be destroyed after
@@ -450,8 +454,6 @@ class ProfileManager : public content::NotificationObserver,
// Controls whether to initialize some services. Only disabled for testing.
bool do_final_services_init_ = true;
- base::ObserverList<ProfileManagerObserver> observers_;
-
// TODO(chrome/browser/profiles/OWNERS): Usage of this in profile_manager.cc
// should likely be turned into DCHECK_CURRENTLY_ON(BrowserThread::UI) for
// consistency with surrounding code in the same file but that wasn't trivial

View file

@ -1,13 +0,0 @@
diff --git a/third_party/protobuf/src/google/protobuf/repeated_field.h b/third_party/protobuf/src/google/protobuf/repeated_field.h
index b5b193c..4434854 100644
--- a/third_party/protobuf/src/google/protobuf/repeated_field.h
+++ b/third_party/protobuf/src/google/protobuf/repeated_field.h
@@ -804,7 +804,7 @@ class StringTypeHandler {
// RepeatedPtrField is like RepeatedField, but used for repeated strings or
// Messages.
template <typename Element>
-class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
+class PROTOBUF_EXPORT RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
public:
RepeatedPtrField();
explicit RepeatedPtrField(Arena* arena);

View file

@ -1,39 +0,0 @@
From af77dc4014ead3d898fdc8a7a70fe5063ac9b102 Mon Sep 17 00:00:00 2001
From: Jose Dapena Paz <jose.dapena@lge.com>
Date: Fri, 25 Oct 2019 19:01:29 +0000
Subject: [PATCH] GCC: use brace-initializer for DohUpgrade vector
Constructing NoDestructor with parenthesis constructor is ambiguous
in GCC. Use brace-initializer to avoid that problem. This fixes this
build error:
Bug: 819294
Change-Id: I00dda42daa1794d11e022f26ac07f92e599d106d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879910
Reviewed-by: Eric Orth <ericorth@chromium.org>
Commit-Queue: José Dapena Paz <jose.dapena@lge.com>
Cr-Commit-Position: refs/heads/master@{#709569}
---
diff --git a/net/dns/dns_util.cc b/net/dns/dns_util.cc
index 14997c4..637b6f2 100644
--- a/net/dns/dns_util.cc
+++ b/net/dns/dns_util.cc
@@ -144,7 +144,7 @@
// DohProviderId histogram suffix list in
// tools/metrics/histograms/histograms.xml.
static const base::NoDestructor<std::vector<DohUpgradeEntry>>
- upgradable_servers({
+ upgradable_servers{{
DohUpgradeEntry(
"CleanBrowsingAdult",
{"185.228.168.10", "185.228.169.11", "2a0d:2a00:1::1",
@@ -215,7 +215,7 @@
{"9.9.9.9", "149.112.112.112", "2620:fe::fe", "2620:fe::9"},
{"dns.quad9.net", "dns9.quad9.net"} /* DoT hostname */,
{"https://dns.quad9.net/dns-query", true /* use_post */}),
- });
+ }};
return *upgradable_servers;
}

View file

@ -1,102 +0,0 @@
From cf2022b11cd3e28f1f3777b060fd509f665ff8e1 Mon Sep 17 00:00:00 2001
From: Elvis Pranskevichus <elvis@magic.io>
Date: Mon, 6 Jul 2020 10:21:27 -0700
Subject: [PATCH] GCC 10 Fixes
---
base/trace_event/trace_event_memory_overhead.h | 1 +
third_party/angle/include/platform/Platform.h | 1 +
third_party/perfetto/include/perfetto/base/task_runner.h | 2 ++
third_party/webrtc/call/rtx_receive_stream.h | 1 +
4 files changed, 5 insertions(+)
diff --git a/base/trace_event/trace_event_memory_overhead.h b/base/trace_event/trace_event_memory_overhead.h
index 69468d4..e10a3ec 100644
--- a/base/trace_event/trace_event_memory_overhead.h
+++ b/base/trace_event/trace_event_memory_overhead.h
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <string>
#include <unordered_map>
#include "base/base_export.h"
diff --git a/third_party/angle/include/platform/Platform.h b/third_party/angle/include/platform/Platform.h
index cea6070..0fbd64f 100644
--- a/third_party/angle/include/platform/Platform.h
+++ b/third_party/angle/include/platform/Platform.h
@@ -9,6 +9,7 @@
#ifndef ANGLE_PLATFORM_H
#define ANGLE_PLATFORM_H
+#include <stddef.h>
#include <stdint.h>
#include <array>
diff --git a/third_party/perfetto/include/perfetto/base/task_runner.h b/third_party/perfetto/include/perfetto/base/task_runner.h
index cf60401..040aab2 100644
--- a/third_party/perfetto/include/perfetto/base/task_runner.h
+++ b/third_party/perfetto/include/perfetto/base/task_runner.h
@@ -17,6 +17,8 @@
#ifndef INCLUDE_PERFETTO_BASE_TASK_RUNNER_H_
#define INCLUDE_PERFETTO_BASE_TASK_RUNNER_H_
+#include <stdint.h>
+
#include <functional>
#include "perfetto/base/export.h"
diff --git a/third_party/webrtc/call/rtx_receive_stream.h b/third_party/webrtc/call/rtx_receive_stream.h
index 8ffa440..fb2f9f4 100644
--- a/third_party/webrtc/call/rtx_receive_stream.h
+++ b/third_party/webrtc/call/rtx_receive_stream.h
@@ -11,6 +11,8 @@
#ifndef CALL_RTX_RECEIVE_STREAM_H_
#define CALL_RTX_RECEIVE_STREAM_H_
+#include <stdint.h>
+
#include <map>
#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..2ba90bb 100644
--- a/third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h
+++ b/third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h
@@ -11,6 +11,8 @@
#ifndef MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_
#define MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_
+#include <stddef.h>
+
#include <array>
namespace webrtc {
diff --git a/media/cdm/supported_cdm_versions.h b/media/cdm/supported_cdm_versions.h
index 3f220da..c54e3bb 100644
--- a/media/cdm/supported_cdm_versions.h
+++ b/media/cdm/supported_cdm_versions.h
@@ -6,6 +6,7 @@
#define MEDIA_CDM_SUPPORTED_CDM_VERSIONS_H_
#include <array>
+#include <cstddef>
#include "media/base/media_export.h"
#include "media/cdm/api/content_decryption_module.h"
diff --git a/third_party/webrtc/modules/video_coding/decoding_state.h b/third_party/webrtc/modules/video_coding/decoding_state.h
index b87fb2d..ec97294 100644
--- a/third_party/webrtc/modules/video_coding/decoding_state.h
+++ b/third_party/webrtc/modules/video_coding/decoding_state.h
@@ -11,6 +11,7 @@
#ifndef MODULES_VIDEO_CODING_DECODING_STATE_H_
#define MODULES_VIDEO_CODING_DECODING_STATE_H_
+#include <cstdint>
#include <map>
#include <set>
#include <vector>
--
2.26.2

View file

@ -1,31 +0,0 @@
From d48486507d6b4ed130696721a758e2a231066cf7 Mon Sep 17 00:00:00 2001
From: Elvis Pranskevichus <elvis@magic.io>
Date: Mon, 6 Jul 2020 16:33:14 -0700
Subject: [PATCH] GCC-X11-Success-enum
---
components/viz/host/host_display_client.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/components/viz/host/host_display_client.h b/components/viz/host/host_display_client.h
index 72a807e..257bc86 100644
--- a/components/viz/host/host_display_client.h
+++ b/components/viz/host/host_display_client.h
@@ -13,7 +13,14 @@
#include "build/build_config.h"
#include "components/viz/host/viz_host_export.h"
#include "mojo/public/cpp/bindings/binding.h"
+#ifdef Success
+#undef Success
+#define __X11_SUCCESS
+#endif
#include "services/viz/privileged/mojom/compositing/display_private.mojom.h"
+#ifdef __X11_SUCCESS
+#define Success 0
+#endif
#include "ui/gfx/native_widget_types.h"
namespace viz {
--
2.26.2

View file

@ -1,13 +0,0 @@
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc
index 5a62770..1fae2aa 100644
--- a/third_party/blink/renderer/core/dom/document.cc
+++ b/third_party/blink/renderer/core/dom/document.cc
@@ -6192,7 +6192,7 @@ static ParseQualifiedNameResult ParseQualifiedNameInternal(
for (unsigned i = 0; i < length;) {
UChar32 c;
- U16_NEXT(characters, i, length, c)
+ U16_NEXT(characters, i, length, c);
if (c == ':') {
if (saw_colon)
return ParseQualifiedNameResult(kQNMultipleColons);

View file

@ -1,167 +0,0 @@
From 64b8ee6fc65bcce07bcaa4bba5f61f29c5495253 Mon Sep 17 00:00:00 2001
From: Frank Tang <ftang@chromium.org>
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 <jkummerow@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67027}
---
v8/src/objects/js-number-format.cc | 76 +++++++++++++++++----------------
1 file changed, 40 insertions(+), 36 deletions(-)
diff --git a/v8/src/objects/js-number-format.cc b/v8/src/objects/js-number-format.cc
index ff564975d6..ad8e173b59 100644
--- a/v8/src/objects/js-number-format.cc
+++ b/v8/src/objects/js-number-format.cc
@@ -1257,42 +1257,33 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
}
namespace {
-Maybe<icu::UnicodeString> IcuFormatNumber(
+Maybe<bool> IcuFormatNumber(
Isolate* isolate,
const icu::number::LocalizedNumberFormatter& number_format,
- Handle<Object> numeric_obj, icu::FieldPositionIterator* fp_iter) {
+ Handle<Object> 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<BigInt> big_int = Handle<BigInt>::cast(numeric_obj);
Handle<String> big_int_string;
ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, big_int_string,
BigInt::ToString(isolate, big_int),
- Nothing<icu::UnicodeString>());
- formatted = number_format.formatDecimal(
+ Nothing<bool>());
+ *formatted = number_format.formatDecimal(
{big_int_string->ToCString().get(), big_int_string->length()}, status);
} else {
- double number = numeric_obj->Number();
- formatted = number_format.formatDouble(number, status);
+ double number = numeric_obj->IsNaN()
+ ? std::numeric_limits<double>::quiet_NaN()
+ : numeric_obj->Number();
+ *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<icu::UnicodeString>());
- }
- if (fp_iter) {
- formatted.getAllFieldPositions(*fp_iter, status);
+ THROW_NEW_ERROR_RETURN_VALUE(
+ isolate, NewTypeError(MessageTemplate::kIcuError), Nothing<bool>());
}
- icu::UnicodeString result = formatted.toString(status);
- if (U_FAILURE(status)) {
- THROW_NEW_ERROR_RETURN_VALUE(isolate,
- NewTypeError(MessageTemplate::kIcuError),
- Nothing<icu::UnicodeString>());
- }
- return Just(result);
+ return Just(true);
}
} // namespace
@@ -1303,10 +1294,16 @@ MaybeHandle<String> JSNumberFormat::FormatNumeric(
Handle<Object> numeric_obj) {
DCHECK(numeric_obj->IsNumeric());
- Maybe<icu::UnicodeString> maybe_format =
- IcuFormatNumber(isolate, number_format, numeric_obj, nullptr);
+ icu::number::FormattedNumber formatted;
+ Maybe<bool> maybe_format =
+ IcuFormatNumber(isolate, number_format, numeric_obj, &formatted);
MAYBE_RETURN(maybe_format, Handle<String>());
- 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 {
@@ -1419,12 +1416,18 @@ std::vector<NumberFormatSpan> FlattenRegionsToParts(
}
namespace {
-Maybe<int> ConstructParts(Isolate* isolate, const icu::UnicodeString& formatted,
- icu::FieldPositionIterator* fp_iter,
+Maybe<int> ConstructParts(Isolate* isolate,
+ icu::number::FormattedNumber* formatted,
Handle<JSArray> result, int start_index,
Handle<Object> 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<int>());
+ }
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);
@@ -1433,13 +1436,14 @@ Maybe<int> 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()));
}
}
@@ -1461,7 +1465,7 @@ Maybe<int> ConstructParts(Isolate* isolate, const icu::UnicodeString& formatted,
Handle<String> 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<int>());
Intl::AddElement(isolate, result, index, field_type_string, substring);
++index;
@@ -1481,14 +1485,14 @@ MaybeHandle<JSArray> JSNumberFormat::FormatToParts(
number_format->icu_number_formatter().raw();
CHECK_NOT_NULL(fmt);
- icu::FieldPositionIterator fp_iter;
- Maybe<icu::UnicodeString> maybe_format =
- IcuFormatNumber(isolate, *fmt, numeric_obj, &fp_iter);
+ icu::number::FormattedNumber formatted;
+ Maybe<bool> maybe_format =
+ IcuFormatNumber(isolate, *fmt, numeric_obj, &formatted);
MAYBE_RETURN(maybe_format, Handle<JSArray>());
Handle<JSArray> result = factory->NewJSArray(0);
Maybe<int> maybe_format_to_parts = ConstructParts(
- isolate, maybe_format.FromJust(), &fp_iter, result, 0, numeric_obj,
+ isolate, &formatted, result, 0, numeric_obj,
number_format->style() == JSNumberFormat::Style::UNIT);
MAYBE_RETURN(maybe_format_to_parts, Handle<JSArray>());
--
2.26.2

View file

@ -1,17 +0,0 @@
diff --git a/build/config/ui.gni b/build/config/ui.gni
index 547b42f..966b00c 100644
--- a/build/config/ui.gni
+++ b/build/config/ui.gni
@@ -51,8 +51,10 @@ if (use_ozone) {
use_glib = false
}
-# Whether to use atk, the Accessibility ToolKit library
-use_atk = is_desktop_linux && use_x11
+declare_args() {
+ # Whether to use atk, the Accessibility ToolKit library
+ use_atk = is_desktop_linux && use_x11
+}
# =============================================
# PLEASE DO NOT ADD MORE FLAGS TO THIS FILE
# =============================================

View file

@ -1,25 +0,0 @@
From 24b3e8384e93f3e73b6aa14ea00a30574112f9ba Mon Sep 17 00:00:00 2001
From: Reid Kleckner <rnk@google.com>
Date: Wed, 4 Dec 2019 14:09:03 -0800
Subject: [PATCH] Remove glslang::pool_allocator::setAllocator
TPoolAllocator is not copy assignable, so this setter could never have
been used. After a recent change (878a24ee2), new versions of Clang
reject this code outright.
---
glslang/Include/PoolAlloc.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/glslang/Include/PoolAlloc.h b/glslang/Include/PoolAlloc.h
index 0e237a6a2..b8eccb883 100644
--- a/third_party/glslang/src/glslang/Include/PoolAlloc.h
+++ b/third_party/glslang/src/glslang/Include/PoolAlloc.h
@@ -304,7 +304,6 @@ class pool_allocator {
size_type max_size() const { return static_cast<size_type>(-1) / sizeof(T); }
size_type max_size(int size) const { return static_cast<size_type>(-1) / size; }
- void setAllocator(TPoolAllocator* a) { allocator = *a; }
TPoolAllocator& getAllocator() const { return allocator; }
protected:

View file

@ -1,185 +0,0 @@
From a1207cc75454e653030716948d27ec27412f6fe8 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Sat, 16 Jun 2019 15:43:27 +0100
Subject: [PATCH] Disable various compiler configs
---
build/config/compiler/BUILD.gn | 64 +++++++++++++---------------------
1 file changed, 25 insertions(+), 39 deletions(-)
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index a3f21b7..0a7bec6 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -230,8 +230,6 @@ config("compiler") {
configs += [
# See the definitions below.
- ":clang_revision",
- ":compiler_cpu_abi",
":compiler_codegen",
":compiler_deterministic",
]
@@ -471,20 +469,6 @@ config("compiler") {
}
}
- if (is_clang && !is_nacl && !use_xcode_clang) {
- cflags += [ "-fcrash-diagnostics-dir=" +
- rebase_path("//tools/clang/crashreports", root_build_dir) ]
-
- cflags += [
- # TODO(hans): Remove this once Clang generates better optimized debug info
- # by default. https://crbug.com/765793
- "-Xclang",
- "-mllvm",
- "-Xclang",
- "-instcombine-lower-dbg-declare=0",
- ]
- }
-
# C11/C++11 compiler flags setup.
# ---------------------------
if (is_linux || is_android || (is_nacl && is_clang) || current_os == "aix") {
@@ -1431,6 +1415,12 @@ config("default_warnings") {
"-Wno-narrowing",
]
+ # -Wno-class-memaccess warns about hash table and vector in blink.
+ # But the violation is intentional.
+ if (!is_nacl) {
+ cflags_cc += [ "-Wno-class-memaccess" ]
+ }
+
# -Wunused-local-typedefs is broken in gcc,
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63872
cflags += [ "-Wno-unused-local-typedefs" ]
@@ -1525,7 +1515,7 @@ config("chromium_code") {
defines = [ "_HAS_NODISCARD" ]
}
} else {
- cflags = [ "-Wall" ]
+ cflags = []
if (treat_warnings_as_errors) {
cflags += [ "-Werror" ]
@@ -1534,10 +1524,6 @@ config("chromium_code") {
# well.
ldflags = [ "-Werror" ]
}
- if (is_clang) {
- # Enable extra warnings for chromium_code when we control the compiler.
- cflags += [ "-Wextra" ]
- }
# In Chromium code, we define __STDC_foo_MACROS in order to get the
# C99 macros on Mac and Linux.
@@ -1546,15 +1532,6 @@ config("chromium_code") {
"__STDC_FORMAT_MACROS",
]
- if (!is_debug && !using_sanitizer && current_cpu != "s390x" &&
- current_cpu != "s390" && current_cpu != "ppc64" &&
- current_cpu != "mips" && current_cpu != "mips64") {
- # Non-chromium code is not guaranteed to compile cleanly with
- # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are
- # disabled, so only do that for Release build.
- defines += [ "_FORTIFY_SOURCE=2" ]
- }
-
if (is_mac) {
cflags_objc = [ "-Wobjc-missing-property-synthesis" ]
cflags_objcc = [ "-Wobjc-missing-property-synthesis" ]
@@ -1943,7 +1920,8 @@ config("default_stack_frames") {
}
# Default "optimization on" config.
-config("optimize") {
+config("optimize") { }
+config("xoptimize") {
if (is_win) {
# TODO(thakis): Remove is_clang here, https://crbug.com/598772
if (is_official_build && full_wpo_on_official && !is_clang) {
@@ -1977,7 +1955,8 @@ config("optimize") {
}
# Same config as 'optimize' but without the WPO flag.
-config("optimize_no_wpo") {
+config("optimize_no_wpo") { }
+config("xoptimize_no_wpo") {
if (is_win) {
# Favor size over speed, /O1 must be before the common flags. The GYP
# build also specifies /Os and /GF but these are implied by /O1.
@@ -2000,7 +1979,8 @@ config("optimize_no_wpo") {
}
# Turn off optimizations.
-config("no_optimize") {
+config("no_optimize") { }
+config("xno_optimize") {
if (is_win) {
cflags = [
"/Od", # Disable optimization.
@@ -2028,7 +2008,8 @@ config("no_optimize") {
# Turns up the optimization level. On Windows, this implies whole program
# optimization and link-time code generation which is very expensive and should
# be used sparingly.
-config("optimize_max") {
+config("optimize_max") { }
+config("xoptimize_max") {
if (is_nacl && is_nacl_irt) {
# The NaCl IRT is a special case and always wants its own config.
# Various components do:
@@ -2075,7 +2056,8 @@ config("optimize_max") {
#
# TODO(crbug.com/621335) - rework how all of these configs are related
# so that we don't need this disclaimer.
-config("optimize_speed") {
+config("optimize_speed") { }
+config("xoptimize_speed") {
if (is_nacl && is_nacl_irt) {
# The NaCl IRT is a special case and always wants its own config.
# Various components do:
@@ -2113,7 +2095,8 @@ config("optimize_speed") {
}
}
-config("optimize_fuzzing") {
+config("optimize_fuzzing") { }
+config("xoptimize_fuzzing") {
cflags = [ "-O1" ] + common_optimize_on_cflags
ldflags = common_optimize_on_ldflags
visibility = [ ":default_optimization" ]
@@ -2215,7 +2198,8 @@ config("win_pdbaltpath") {
}
# Full symbols.
-config("symbols") {
+config("symbols") { }
+config("xsymbols") {
if (is_win) {
if (use_goma || is_clang) {
# Note that with VC++ this requires is_win_fastlink, enforced elsewhere.
@@ -2325,7 +2309,8 @@ config("symbols") {
# Minimal symbols.
# This config guarantees to hold symbol for stack trace which are shown to user
# when crash happens in unittests running on buildbot.
-config("minimal_symbols") {
+config("minimal_symbols") { }
+config("xminimal_symbols") {
if (is_win) {
# Linker symbols for backtraces only.
cflags = []
@@ -2382,7 +2367,8 @@ config("minimal_symbols") {
}
# No symbols.
-config("no_symbols") {
+config("no_symbols") { }
+config("xno_symbols") {
if (!is_win) {
cflags = [ "-g0" ]
asmflags = cflags
--
2.21.0

View file

@ -1,14 +0,0 @@
--- a/base/strings/char_traits.h
+++ b/base/strings/char_traits.h
@@ -67,9 +67,9 @@
return __builtin_memcmp(s1, s2, n);
#else
for (; n; --n, ++s1, ++s2) {
- if (*s1 < *s2)
+ if ((unsigned char)*s1 < (unsigned char)*s2)
return -1;
- if (*s1 > *s2)
+ if ((unsigned char)*s1 > (unsigned char)*s2)
return 1;
}
return 0;

View file

@ -1,44 +0,0 @@
Electron patches the file to use base::CommandLine, but forgot to include
the necessary header for it.
--- a/third_party/blink/renderer/platform/graphics/canvas_color_params.cc.orig 2020-04-27 13:49:41.408592941 +0200
+++ b/third_party/blink/renderer/platform/graphics/canvas_color_params.cc 2020-04-27 13:49:53.841071830 +0200
@@ -4,6 +4,7 @@
#include "third_party/blink/renderer/platform/graphics/canvas_color_params.h"
+#include "base/command_line.h"
#include "cc/paint/skia_paint_canvas.h"
#include "components/viz/common/resources/resource_format_utils.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
--- a/third_party/blink/public/platform/web_rtc_rtp_source.h.orig 2020-04-27 14:16:05.323085814 +0200
+++ b/third_party/blink/public/platform/web_rtc_rtp_source.h 2020-04-27 14:16:17.279480838 +0200
@@ -7,6 +7,7 @@
#include "base/optional.h"
#include "third_party/blink/public/platform/web_common.h"
+#include <memory>
namespace base {
class TimeTicks;
--- a/chrome/browser/chrome_content_browser_client.cc.orig 2020-04-27 16:16:27.291208394 +0200
+++ b/chrome/browser/chrome_content_browser_client.cc 2020-04-27 16:16:49.283984217 +0200
@@ -2896,6 +2896,8 @@
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
+ const std::vector<std::string>& additional_features,
+ const scoped_refptr<network::ResourceRequestBody>& body,
bool user_gesture,
bool opener_suppressed,
bool* no_javascript_access) {
--- a/chrome/browser/chrome_content_browser_client.h.orig 2020-04-27 16:15:41.932359753 +0200
+++ b/chrome/browser/chrome_content_browser_client.h 2020-04-27 16:16:09.798318845 +0200
@@ -303,6 +303,8 @@
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
+ const std::vector<std::string>& additional_features,
+ const scoped_refptr<network::ResourceRequestBody>& body,
bool user_gesture,
bool opener_suppressed,
bool* no_javascript_access) override;

View file

@ -1,15 +0,0 @@
X11.h defines a macro called "Success", which is 0. This breaks an enum
that is generated in Chromium that has a member "Success", so undefine
it.
--- a/chrome/browser/ui/libgtkui/select_file_dialog_impl_kde.cc.orig 2020-04-27 18:42:15.457297544 +0200
+++ b/chrome/browser/ui/libgtkui/select_file_dialog_impl_kde.cc 2020-04-27 18:42:21.760454304 +0200
@@ -24,7 +24,9 @@
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
#include "base/threading/thread_restrictions.h"
+#undef Success
#include "chrome/browser/ui/libgtkui/select_file_dialog_impl.h"
+#define Success 0
#include "content/public/browser/browser_thread.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/l10n/l10n_util.h"

View file

@ -1,131 +0,0 @@
From 15d9b2515631cedcbd427e4c6de2dd4e7a0bfa36 Mon Sep 17 00:00:00 2001
From: Elvis Pranskevichus <elvis@magic.io>
Date: Sat, 4 Jan 2020 16:03:03 -0500
Subject: [PATCH] GCC LTO Support
---
build/config/BUILD.gn | 6 +++++-
build/config/compiler/BUILD.gn | 30 ++++++++++++++++++++++--------
build/config/compiler/compiler.gni | 2 +-
sandbox/linux/BUILD.gn | 3 +++
4 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn
index 514ab7b..f8d36fe 100644
--- a/build/config/BUILD.gn
+++ b/build/config/BUILD.gn
@@ -260,9 +260,13 @@ config("default_libs") {
} else if (is_linux) {
libs = [
"dl",
- "pthread",
"rt",
]
+ ldflags = [
+ "-Wl,--no-as-needed",
+ "-lpthread",
+ "-Wl,--as-needed"
+ ]
}
}
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index a3f21b7..48747f7 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -558,12 +558,13 @@ config("compiler") {
# TODO(pcc): Make this conditional on is_official_build rather than on gn
# flags for specific features.
if (!is_debug && use_thin_lto && is_a_target_toolchain) {
- assert(use_lld || target_os == "chromeos",
- "gold plugin only supported with ChromeOS")
-
- cflags += [ "-flto=thin" ]
+ if (is_clang) {
+ cflags += [ "-flto=thin" ]
+ } else {
+ cflags += [ "-flto=2", "-fno-fat-lto-objects", "-fuse-linker-plugin" ]
+ }
- if (target_os != "chromeos") {
+ if (target_os != "chromeos" && is_clang) {
cflags += [ "-fsplit-lto-unit" ]
}
@@ -586,7 +587,11 @@ config("compiler") {
"-mllvm:-import-instr-limit=10",
]
} else {
- ldflags += [ "-flto=thin" ]
+ if (is_clang) {
+ ldflags += [ "-flto=thin" ]
+ } else {
+ ldflags += [ "-flto=8", "-fno-fat-lto-objects", "-fuse-linker-plugin" ]
+ }
# Limit the parallelism to avoid too aggressive competition between
# linker jobs. This is still suboptimal to a potential dynamic
@@ -607,7 +612,7 @@ config("compiler") {
"-Wl,--thinlto-cache-policy,$cache_policy",
]
}
- } else {
+ } else if (is_clang) {
ldflags += [ "-Wl,-plugin-opt,jobs=8" ]
}
@@ -630,7 +635,7 @@ config("compiler") {
# TODO(pcc): Re-enable this flag on Android. This will require libc++ to be
# built with ThinLTO (see https://crbug.com/767901) as well as the GVR shim.
- if (!is_android) {
+ if (!is_android && is_clang) {
cflags += [ "-fwhole-program-vtables" ]
if (!is_win) {
ldflags += [ "-fwhole-program-vtables" ]
@@ -697,6 +702,15 @@ config("compiler") {
}
}
+config("compiler_no_lto") {
+ cflags = []
+ ldflags = []
+ if (!is_debug && use_thin_lto && is_a_target_toolchain) {
+ cflags += ["-fno-lto"]
+ ldflags += ["-fno-lto"]
+ }
+}
+
# This provides the basic options to select the target CPU and ABI.
# It is factored out of "compiler" so that special cases can use this
# without using everything that "compiler" brings in. Options that
diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni
index c351d6b..e567372 100644
--- a/build/config/compiler/compiler.gni
+++ b/build/config/compiler/compiler.gni
@@ -57,7 +57,7 @@ declare_args() {
# Enables support for ThinLTO, which links 3x-10x faster than full LTO. See
# also http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html
- use_thin_lto = is_cfi || (is_android && is_official_build)
+ use_thin_lto = false
# Tell VS to create a PDB that references information in .obj files rather
# than copying it all. This should improve linker performance. mspdbcmf.exe
diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
index b00a88c..e4615c0 100644
--- a/sandbox/linux/BUILD.gn
+++ b/sandbox/linux/BUILD.gn
@@ -256,6 +256,9 @@ component("seccomp_bpf") {
"//base",
"//base/third_party/dynamic_annotations",
]
+ configs += [
+ "//build/config/compiler:compiler_no_lto"
+ ]
if (is_nacl_nonsfi) {
cflags = [ "-fgnu-inline-asm" ]
--
2.24.1

View file

@ -1,20 +0,0 @@
--- 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\""

View file

@ -1,32 +0,0 @@
Patch by Michael Forney <mforney@mforney.org>
Already merged https://chromium-review.googlesource.com/c/chromium/src/+/1975453
--- a/tools/gn/bootstrap/bootstrap.py
+++ b/tools/gn/bootstrap/bootstrap.py
@@ -70,6 +70,7 @@
out_dir = os.path.join(SRC_ROOT, build_rel)
gn_path = options.output or os.path.join(out_dir, 'gn')
gn_build_dir = os.path.join(out_dir, 'gn_build')
+ ninja_binary = os.environ.get('NINJA', 'ninja')
# TODO(thomasanderson): Remove this once Ubuntu Trusty reaches EOL, or when
# Chromium's infrastructure is upgraded from Trusty to Xenial, whichever comes
@@ -90,7 +91,7 @@
os.environ.get('CFLAGS', '').split() +
os.environ.get('CXXFLAGS', '').split()),
]) + '\n')
- subprocess.check_call(['ninja', '-C', libcxx_dir])
+ subprocess.check_call([ninja_binary, '-C', libcxx_dir])
shutil.copy2(os.path.join(gn_build_dir, 'libc++.gn.so'), out_dir)
def append_to_env(var, vals):
@@ -120,7 +121,7 @@
shutil.copy2(
os.path.join(BOOTSTRAP_DIR, 'last_commit_position.h'), gn_build_dir)
subprocess.check_call(
- ['ninja', '-C', gn_build_dir, 'gn', '-w', 'dupbuild=err'])
+ [ninja_binary, '-C', gn_build_dir, '-w', 'dupbuild=err', 'gn'])
shutil.copy2(os.path.join(gn_build_dir, 'gn'), gn_path)
if not options.skip_generate_buildfiles:

View file

@ -1,26 +0,0 @@
--- 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

View file

@ -1,11 +0,0 @@
--- 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
}
}

View file

@ -1,13 +0,0 @@
diff --git a/third_party/perfetto/gn/BUILD.gn b/third_party/perfetto/gn/BUILD.gn
index 3bc618a..e0ddf6d 100644
--- a/third_party/perfetto/gn/BUILD.gn
+++ b/third_party/perfetto/gn/BUILD.gn
@@ -244,7 +244,7 @@ if (enable_perfetto_trace_processor || perfetto_build_standalone ||
"//buildtools:zlib",
]
} else {
- public_configs = [ "//third_party/zlib:zlib_config" ]
+ public_configs = [ "//third_party/zlib:system_zlib" ]
public_deps = [
"//third_party/zlib",
]

View file

@ -1,38 +0,0 @@
From 192fc3899f76e9487d77895f31df8d2d13bf9619 Mon Sep 17 00:00:00 2001
From: Dale Curtis <dalecurtis@chromium.org>
Date: Fri, 26 Jun 2020 01:10:55 +0000
Subject: [PATCH] Force mp3 files to have a start time of zero.
This will allow us to remove our custom patch which breaks upstream
ffmpeg functionality for unknown reasons.
R=sandersd
Fixed: 1062037
Change-Id: I253011843dee4dd6a8c958b14990ad836a9f1dca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2268221
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Dan Sanders <sandersd@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782792}
---
media/filters/ffmpeg_demuxer.cc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 01266e1a072..a7ed542b5fc 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -1522,6 +1522,12 @@ void FFmpegDemuxer::OnFindStreamInfoDone(int result) {
if (glue_->container() == container_names::CONTAINER_AVI)
format_context->flags |= AVFMT_FLAG_GENPTS;
+ // FFmpeg will incorrectly adjust the start time of MP3 files into the future
+ // based on discard samples. We were unable to fix this upstream without
+ // breaking ffmpeg functionality. https://crbug.com/1062037
+ if (glue_->container() == container_names::CONTAINER_MP3)
+ start_time_ = base::TimeDelta();
+
// For testing purposes, don't overwrite the timeline offset if set already.
if (timeline_offset_.is_null()) {
timeline_offset_ =

File diff suppressed because it is too large Load diff

View file

@ -1,42 +0,0 @@
From ff4122f236b70c272c746d0c336cdbd588d78cd1 Mon Sep 17 00:00:00 2001
From: Elvis Pranskevichus <elvis@magic.io>
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

View file

@ -1,57 +0,0 @@
diff --git a/build/args/all.gn b/build/args/all.gn
index 8bbb86e28..8476d09ea 100644
--- a/build/args/all.gn
+++ b/build/args/all.gn
@@ -1,5 +1,4 @@
is_electron_build = true
-use_jumbo_build = true
root_extra_deps = [ "//electron" ]
# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
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.

View file

@ -1,17 +0,0 @@
--- 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

View file

@ -1,19 +0,0 @@
--- a/patches/chromium/feat_offscreen_rendering_with_viz_compositor.patch.orig 2020-04-27 16:37:09.934271227 +0200
+++ b/patches/chromium/feat_offscreen_rendering_with_viz_compositor.patch 2020-04-27 16:37:50.903207166 +0200
@@ -350,7 +350,7 @@
index 0000000000000000000000000000000000000000..3865939d0445a23a468770f57207ba5ef23277ed
--- /dev/null
+++ b/components/viz/service/display_embedder/software_output_device_proxy.h
-@@ -0,0 +1,88 @@
+@@ -0,0 +1,89 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
@@ -364,6 +364,7 @@
+
+#include <memory>
+
++#include "base/threading/thread_checker.h"
+#include "components/viz/host/host_display_client.h"
+#include "components/viz/service/display/software_output_device.h"
+#include "components/viz/service/viz_service_export.h"

View file

@ -1,47 +0,0 @@
diff --git a/patches/v8/make_createdynamicfunction_throw_if_disallowed.patch b/patches/v8/make_createdynamicfunction_throw_if_disallowed.patch
index bafd0b0..949cb2d 100644
--- a/patches/v8/make_createdynamicfunction_throw_if_disallowed.patch
+++ b/patches/v8/make_createdynamicfunction_throw_if_disallowed.patch
@@ -25,42 +25,3 @@ index f75014d034626643ae83dc8f167a473b7291522c..b5c2e8b25f10f2fff9011a0a1bd1aeef
}
// Build the source string.
-diff --git a/test/mjsunit/mjsunit.status b/test/mjsunit/mjsunit.status
-index 134a49f7480c87acbb08133a2d6a4d028bbdd090..7dcaa412199770d7c4f688d7f8a66d887130bf82 100644
---- a/test/mjsunit/mjsunit.status
-+++ b/test/mjsunit/mjsunit.status
-@@ -232,6 +232,9 @@
- # BUG(v8:6306).
- 'wasm/huge-memory': [SKIP],
-
-+ # Needs to be adapted after changes to Function constructor. chromium:1065094
-+ 'cross-realm-filtering': [SKIP],
-+
- # Allocates a huge string and then flattens it, very slow in debug mode.
- 'regress/regress-752764': [PASS, ['mode == debug', SLOW]],
-
-diff --git a/test/mjsunit/regress-1065094.js b/test/mjsunit/regress-1065094.js
-new file mode 100644
-index 0000000000000000000000000000000000000000..365e20285bb0505dec3f84c4df57db0525e7acc3
---- /dev/null
-+++ b/test/mjsunit/regress-1065094.js
-@@ -0,0 +1,19 @@
-+// Copyright 2020 the V8 project authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+// Flags: --allow-natives-syntax
-+
-+function f(fnConstructor) {
-+ return Object.is(new fnConstructor(), undefined);
-+}
-+
-+const realmIndex = Realm.createAllowCrossRealmAccess();
-+const otherFunction = Realm.global(realmIndex).Function;
-+Realm.detachGlobal(realmIndex);
-+
-+%PrepareFunctionForOptimization(f);
-+assertFalse(f(Function));
-+assertThrows(_ => f(otherFunction));
-+%OptimizeFunctionOnNextCall(f);
-+assertThrows(_ => f(otherFunction));

View file

@ -1,341 +0,0 @@
# Template file for 'electron7'
pkgname=electron7
version=7.3.3
revision=1
_nodever=12.8.1
_chromiumver=78.0.3904.108
archs="x86_64* aarch64* ppc64le* i686*"
create_wrksrc=yes
build_wrksrc="src"
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"
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
ffmpeg-devel libva-devel libuv-devel c-ares-devel libnotify-devel"
short_desc="Application development framework based on web technologies"
maintainer="John <me@johnnynator.dev>"
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="cd216520c38d9669d37704a401e85a88eb5c9e4811cfc1fee37e92acbb54a180
f9c53839f306d2973de27723360024f7904101d426b9e7e9cdb56e8bcc775b0e
11648d586f68ee5fc38e4cadf3974541aac4a67709fa028e9075aff42e28d9b9"
no_generic_pkgconfig_link=yes
lib32disabled=yes
nodebug=yes
nopie=yes # contains tools that are not PIE, enables PIE itself
# XXX: pulseaudio broken at compile time
build_options="pulseaudio clang"
build_options_default="pulseaudio"
if [ -z "$CROSS_BUILD" ]; then
build_options_default+=" clang"
fi
if [ "$build_option_clang" ]; then
nocross="No proper setup for using clang as cross compiler in void yet"
elif [ "$CROSS_BUILD" ] && [ "${XBPS_TARGET_MACHINE%%-musl}" = "aarch64" ]; then
broken="{standard input}: Error: unaligned opcodes detected in executable segment"
# This might also happen with non-cross 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...
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
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
}
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
zlib
"
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/libxml/*' \
\! -path './third_party/pdfium/third_party/freetype/include/pstables.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
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
}

View file

@ -1,2 +0,0 @@
site=https://www.electronjs.org/releases/stable?version=${version%%.*}
pattern='tag/v\K[\d\.]+(?=")'