[PA] Control the thread cache size with a feature on 32-bit Android.

Large thread cache is always enabled on 64-bit Android, but always
disabled on 32-bit. This makes the decision controlled by a (disabled by
default) feature.

Bug: 1286293
Change-Id: I70ef33527ba60f6d87c2d40e47ce69f8aa86667b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3380488
Reviewed-by: Thiabaud Engelbrecht <[email protected]>
Commit-Queue: Benoit Lize <[email protected]>
Cr-Commit-Position: refs/heads/main@{#958044}
diff --git a/base/allocator/partition_alloc_features.cc b/base/allocator/partition_alloc_features.cc
index 8926bba..16dd0e7 100644
--- a/base/allocator/partition_alloc_features.cc
+++ b/base/allocator/partition_alloc_features.cc
@@ -5,6 +5,7 @@
 #include "base/allocator/partition_alloc_features.h"
 
 #include "base/feature_list.h"
+#include "build/build_config.h"
 
 namespace base {
 namespace features {
@@ -32,7 +33,15 @@
 
 // Use a larger maximum thread cache cacheable bucket size.
 const Feature kPartitionAllocLargeThreadCacheSize{
-    "PartitionAllocLargeThreadCacheSize", FEATURE_ENABLED_BY_DEFAULT};
+  "PartitionAllocLargeThreadCacheSize",
+#if defined(OS_ANDROID) && defined(ARCH_CPU_32_BITS)
+      // Not unconditionally enabled on 32 bit Android, since it is a more
+      // memory-constrained platform.
+      FEATURE_DISABLED_BY_DEFAULT
+#else
+      FEATURE_ENABLED_BY_DEFAULT
+#endif
+};
 
 const BASE_EXPORT Feature kPartitionAllocLargeEmptySlotSpanRing{
     "PartitionAllocLargeEmptySlotSpanRing", FEATURE_DISABLED_BY_DEFAULT};