0

[A11y] Exclude AXTree::Unserialize() from memory safety checks

Our safety feature regresses blink_perf.accessibility so excluding
unserialization function.

Fixed: 388873485, 414862272
Change-Id: I3675ad47f8c8969187458ee43cfe23bed9c0b4a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6471452
Reviewed-by: Katie Dektar <katie@chromium.org>
Commit-Queue: Mikihito Matsuura <mikt@google.com>
Cr-Commit-Position: refs/heads/main@{#1454810}
This commit is contained in:
mikt
2025-05-01 20:18:47 -07:00
committed by Chromium LUCI CQ
parent f172a12730
commit 8556e409ab

@ -19,6 +19,7 @@
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ref.h"
#include "base/memory/safety_checks.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
@ -1171,6 +1172,13 @@ const std::set<AXTreeID> AXTree::GetAllChildTreeIds() const {
}
bool AXTree::Unserialize(const AXTreeUpdate& update) {
// This function is known to be heap allocation heavy and performance
// critical. Extra memory safety checks can introduce regression
// (https://crbug.com/388873485) and these are disabled here.
// TODO(https://crbug.com/391797366): Optimize memory allocation patterns and
// remove this exclusion.
base::ScopedSafetyChecksExclusion scoped_unsafe;
#if AX_FAIL_FAST_BUILD() && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
for (const auto& new_data : update.nodes)
CHECK(new_data.id != kInvalidAXNodeID)