Commit fe15e1f6 authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

[Arm Mac] Fix crash under Rosetta

CPU load data isn't kept for simulated processors, so early
return if running under Rosetta.

Fixed: 1138707
Change-Id: Iac2e84dd12cc0150edf84d3608caab82197e1b9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505458
Commit-Queue: Shuliang Han <leonhsl@chromium.org>
Reviewed-by: default avatarShuliang Han <leonhsl@chromium.org>
Reviewed-by: default avatarLeon Han <leon.han@intel.com>
Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822004}
parent 02d0b00a
......@@ -6,6 +6,7 @@
#include <mach/mach_host.h>
#include "base/mac/mac_util.h"
#include "base/mac/scoped_mach_port.h"
#include "base/system/sys_info.h"
......@@ -13,6 +14,16 @@ namespace extensions {
bool CpuInfoProvider::QueryCpuTimePerProcessor(
std::vector<api::system_cpu::ProcessorInfo>* infos) {
if (base::mac::GetCPUType() == base::mac::CPUType::kTranslatedIntel) {
// In writing Rosetta, Apple needed to stop simulating an x86 environment
// somewhere, and they did so before they got to `host_processor_info()`.
// `host_processor_info()` is a Mach call to a host server in the kernel,
// and that server does not maintain data corresponding to the simulated
// processors. See https://crbug.com/1138707#c42 for details. See also
// FB8832191.
return false;
}
DCHECK(infos);
natural_t num_of_processors;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment