xref: /aosp_15_r20/external/cronet/base/allocator/partition_alloc_features.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "base/allocator/partition_alloc_features.h"
6 
7 #include "base/allocator/miracle_parameter.h"
8 #include "base/base_export.h"
9 #include "base/feature_list.h"
10 #include "base/features.h"
11 #include "base/metrics/field_trial_params.h"
12 #include "base/time/time.h"
13 #include "build/build_config.h"
14 #include "build/chromecast_buildflags.h"
15 #include "build/chromeos_buildflags.h"
16 #include "partition_alloc/partition_alloc_base/time/time.h"
17 #include "partition_alloc/partition_alloc_buildflags.h"
18 #include "partition_alloc/partition_root.h"
19 #include "partition_alloc/shim/allocator_shim_dispatch_to_noop_on_free.h"
20 #include "partition_alloc/thread_cache.h"
21 
22 namespace base {
23 namespace features {
24 
25 BASE_FEATURE(kPartitionAllocUnretainedDanglingPtr,
26              "PartitionAllocUnretainedDanglingPtr",
27              FEATURE_ENABLED_BY_DEFAULT);
28 
29 constexpr FeatureParam<UnretainedDanglingPtrMode>::Option
30     kUnretainedDanglingPtrModeOption[] = {
31         {UnretainedDanglingPtrMode::kCrash, "crash"},
32         {UnretainedDanglingPtrMode::kDumpWithoutCrashing,
33          "dump_without_crashing"},
34 };
35 const base::FeatureParam<UnretainedDanglingPtrMode>
36     kUnretainedDanglingPtrModeParam = {
37         &kPartitionAllocUnretainedDanglingPtr,
38         "mode",
39         UnretainedDanglingPtrMode::kCrash,
40         &kUnretainedDanglingPtrModeOption,
41 };
42 
43 BASE_FEATURE(kPartitionAllocDanglingPtr,
44              "PartitionAllocDanglingPtr",
45 #if BUILDFLAG(ENABLE_DANGLING_RAW_PTR_FEATURE_FLAG)
46              FEATURE_ENABLED_BY_DEFAULT
47 #else
48              FEATURE_DISABLED_BY_DEFAULT
49 #endif
50 );
51 
52 constexpr FeatureParam<DanglingPtrMode>::Option kDanglingPtrModeOption[] = {
53     {DanglingPtrMode::kCrash, "crash"},
54     {DanglingPtrMode::kLogOnly, "log_only"},
55 };
56 const base::FeatureParam<DanglingPtrMode> kDanglingPtrModeParam{
57     &kPartitionAllocDanglingPtr,
58     "mode",
59     DanglingPtrMode::kCrash,
60     &kDanglingPtrModeOption,
61 };
62 constexpr FeatureParam<DanglingPtrType>::Option kDanglingPtrTypeOption[] = {
63     {DanglingPtrType::kAll, "all"},
64     {DanglingPtrType::kCrossTask, "cross_task"},
65 };
66 const base::FeatureParam<DanglingPtrType> kDanglingPtrTypeParam{
67     &kPartitionAllocDanglingPtr,
68     "type",
69     DanglingPtrType::kAll,
70     &kDanglingPtrTypeOption,
71 };
72 
73 #if BUILDFLAG(USE_STARSCAN)
74 // If enabled, PCScan is turned on by default for all partitions that don't
75 // disable it explicitly.
76 BASE_FEATURE(kPartitionAllocPCScan,
77              "PartitionAllocPCScan",
78              FEATURE_DISABLED_BY_DEFAULT);
79 #endif  // BUILDFLAG(USE_STARSCAN)
80 
81 #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
82 // If enabled, PCScan is turned on only for the browser's malloc partition.
83 BASE_FEATURE(kPartitionAllocPCScanBrowserOnly,
84              "PartitionAllocPCScanBrowserOnly",
85              FEATURE_DISABLED_BY_DEFAULT);
86 
87 // If enabled, PCScan is turned on only for the renderer's malloc partition.
88 BASE_FEATURE(kPartitionAllocPCScanRendererOnly,
89              "PartitionAllocPCScanRendererOnly",
90              FEATURE_DISABLED_BY_DEFAULT);
91 
92 // Use a larger maximum thread cache cacheable bucket size.
93 BASE_FEATURE(kPartitionAllocLargeThreadCacheSize,
94              "PartitionAllocLargeThreadCacheSize",
95              FEATURE_ENABLED_BY_DEFAULT);
96 
97 MIRACLE_PARAMETER_FOR_INT(
98     GetPartitionAllocLargeThreadCacheSizeValue,
99     kPartitionAllocLargeThreadCacheSize,
100     "PartitionAllocLargeThreadCacheSizeValue",
101     ::partition_alloc::ThreadCacheLimits::kLargeSizeThreshold)
102 
103 MIRACLE_PARAMETER_FOR_INT(
104     GetPartitionAllocLargeThreadCacheSizeValueForLowRAMAndroid,
105     kPartitionAllocLargeThreadCacheSize,
106     "PartitionAllocLargeThreadCacheSizeValueForLowRAMAndroid",
107     ::partition_alloc::ThreadCacheLimits::kDefaultSizeThreshold)
108 
109 BASE_FEATURE(kPartitionAllocLargeEmptySlotSpanRing,
110              "PartitionAllocLargeEmptySlotSpanRing",
111              FEATURE_DISABLED_BY_DEFAULT);
112 
113 BASE_FEATURE(kPartitionAllocSchedulerLoopQuarantine,
114              "PartitionAllocSchedulerLoopQuarantine",
115              FEATURE_DISABLED_BY_DEFAULT);
116 // Scheduler Loop Quarantine's capacity in bytes.
117 const base::FeatureParam<int> kPartitionAllocSchedulerLoopQuarantineCapacity{
118     &kPartitionAllocSchedulerLoopQuarantine,
119     "PartitionAllocSchedulerLoopQuarantineCapacity", 0};
120 
121 BASE_FEATURE(kPartitionAllocZappingByFreeFlags,
122              "PartitionAllocZappingByFreeFlags",
123              FEATURE_DISABLED_BY_DEFAULT);
124 #endif  // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
125 
126 BASE_FEATURE(kPartitionAllocBackupRefPtr,
127              "PartitionAllocBackupRefPtr",
128 #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
129     BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) ||     \
130     (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) ||                  \
131     BUILDFLAG(ENABLE_BACKUP_REF_PTR_FEATURE_FLAG)
132              FEATURE_ENABLED_BY_DEFAULT
133 #else
134              FEATURE_DISABLED_BY_DEFAULT
135 #endif
136 );
137 
138 constexpr FeatureParam<BackupRefPtrEnabledProcesses>::Option
139     kBackupRefPtrEnabledProcessesOptions[] = {
140         {BackupRefPtrEnabledProcesses::kBrowserOnly, "browser-only"},
141         {BackupRefPtrEnabledProcesses::kBrowserAndRenderer,
142          "browser-and-renderer"},
143         {BackupRefPtrEnabledProcesses::kNonRenderer, "non-renderer"},
144         {BackupRefPtrEnabledProcesses::kAllProcesses, "all-processes"}};
145 
146 const base::FeatureParam<BackupRefPtrEnabledProcesses>
147     kBackupRefPtrEnabledProcessesParam{
148         &kPartitionAllocBackupRefPtr, "enabled-processes",
149         BackupRefPtrEnabledProcesses::kNonRenderer,
150         &kBackupRefPtrEnabledProcessesOptions};
151 
152 constexpr FeatureParam<BackupRefPtrMode>::Option kBackupRefPtrModeOptions[] = {
153     {BackupRefPtrMode::kDisabled, "disabled"},
154     {BackupRefPtrMode::kEnabled, "enabled"},
155     {BackupRefPtrMode::kEnabled, "enabled-in-same-slot-mode"},
156 };
157 
158 const base::FeatureParam<BackupRefPtrMode> kBackupRefPtrModeParam{
159     &kPartitionAllocBackupRefPtr, "brp-mode", BackupRefPtrMode::kEnabled,
160     &kBackupRefPtrModeOptions};
161 
162 BASE_FEATURE(kPartitionAllocMemoryTagging,
163              "PartitionAllocMemoryTagging",
164 #if BUILDFLAG(USE_FULL_MTE)
165              FEATURE_ENABLED_BY_DEFAULT
166 #else
167              FEATURE_DISABLED_BY_DEFAULT
168 #endif
169 );
170 
171 constexpr FeatureParam<MemtagMode>::Option kMemtagModeOptions[] = {
172     {MemtagMode::kSync, "sync"},
173     {MemtagMode::kAsync, "async"}};
174 
175 const base::FeatureParam<MemtagMode> kMemtagModeParam{
176     &kPartitionAllocMemoryTagging, "memtag-mode",
177 #if BUILDFLAG(USE_FULL_MTE)
178     MemtagMode::kSync,
179 #else
180     MemtagMode::kAsync,
181 #endif
182     &kMemtagModeOptions};
183 
184 constexpr FeatureParam<MemoryTaggingEnabledProcesses>::Option
185     kMemoryTaggingEnabledProcessesOptions[] = {
186         {MemoryTaggingEnabledProcesses::kBrowserOnly, "browser-only"},
187         {MemoryTaggingEnabledProcesses::kNonRenderer, "non-renderer"},
188         {MemoryTaggingEnabledProcesses::kAllProcesses, "all-processes"}};
189 
190 const base::FeatureParam<MemoryTaggingEnabledProcesses>
191     kMemoryTaggingEnabledProcessesParam{
192         &kPartitionAllocMemoryTagging, "enabled-processes",
193 #if BUILDFLAG(USE_FULL_MTE)
194         MemoryTaggingEnabledProcesses::kAllProcesses,
195 #else
196         MemoryTaggingEnabledProcesses::kBrowserOnly,
197 #endif
198         &kMemoryTaggingEnabledProcessesOptions};
199 
200 BASE_FEATURE(kKillPartitionAllocMemoryTagging,
201              "KillPartitionAllocMemoryTagging",
202              FEATURE_DISABLED_BY_DEFAULT);
203 
204 BASE_EXPORT BASE_DECLARE_FEATURE(kPartitionAllocPermissiveMte);
205 BASE_FEATURE(kPartitionAllocPermissiveMte,
206              "PartitionAllocPermissiveMte",
207 #if BUILDFLAG(USE_FULL_MTE)
208              // We want to actually crash if USE_FULL_MTE is enabled.
209              FEATURE_DISABLED_BY_DEFAULT
210 #else
211              FEATURE_ENABLED_BY_DEFAULT
212 #endif
213 );
214 
215 const base::FeatureParam<bool> kBackupRefPtrAsanEnableDereferenceCheckParam{
216     &kPartitionAllocBackupRefPtr, "asan-enable-dereference-check", true};
217 const base::FeatureParam<bool> kBackupRefPtrAsanEnableExtractionCheckParam{
218     &kPartitionAllocBackupRefPtr, "asan-enable-extraction-check",
219     false};  // Not much noise at the moment to enable by default.
220 const base::FeatureParam<bool> kBackupRefPtrAsanEnableInstantiationCheckParam{
221     &kPartitionAllocBackupRefPtr, "asan-enable-instantiation-check", true};
222 
223 // If enabled, switches the bucket distribution to a denser one.
224 //
225 // We enable this by default everywhere except for 32-bit Android, since we saw
226 // regressions there.
227 BASE_FEATURE(kPartitionAllocUseDenserDistribution,
228              "PartitionAllocUseDenserDistribution",
229 #if BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_32_BITS)
230              FEATURE_DISABLED_BY_DEFAULT
231 #else
232              FEATURE_ENABLED_BY_DEFAULT
233 #endif  // BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_32_BITS)
234 );
235 const base::FeatureParam<BucketDistributionMode>::Option
236     kPartitionAllocBucketDistributionOption[] = {
237         {BucketDistributionMode::kDefault, "default"},
238         {BucketDistributionMode::kDenser, "denser"},
239 };
240 const base::FeatureParam<BucketDistributionMode>
241     kPartitionAllocBucketDistributionParam {
242   &kPartitionAllocUseDenserDistribution, "mode",
243 #if BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_32_BITS)
244       BucketDistributionMode::kDefault,
245 #else
246       BucketDistributionMode::kDenser,
247 #endif  // BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_32_BITS)
248       &kPartitionAllocBucketDistributionOption
249 };
250 
251 BASE_FEATURE(kPartitionAllocMemoryReclaimer,
252              "PartitionAllocMemoryReclaimer",
253              FEATURE_ENABLED_BY_DEFAULT);
254 const base::FeatureParam<TimeDelta> kPartitionAllocMemoryReclaimerInterval = {
255     &kPartitionAllocMemoryReclaimer, "interval",
256     TimeDelta(),  // Defaults to zero.
257 };
258 
259 // Configures whether we set a lower limit for renderers that do not have a main
260 // frame, similar to the limit that is already done for backgrounded renderers.
261 BASE_FEATURE(kLowerPAMemoryLimitForNonMainRenderers,
262              "LowerPAMemoryLimitForNonMainRenderers",
263              FEATURE_DISABLED_BY_DEFAULT);
264 
265 // If enabled, switches PCScan scheduling to a mutator-aware scheduler. Does not
266 // affect whether PCScan is enabled itself.
267 BASE_FEATURE(kPartitionAllocPCScanMUAwareScheduler,
268              "PartitionAllocPCScanMUAwareScheduler",
269              FEATURE_ENABLED_BY_DEFAULT);
270 
271 // If enabled, PCScan frees unconditionally all quarantined objects.
272 // This is a performance testing feature.
273 BASE_FEATURE(kPartitionAllocPCScanImmediateFreeing,
274              "PartitionAllocPCScanImmediateFreeing",
275              FEATURE_DISABLED_BY_DEFAULT);
276 
277 // If enabled, PCScan clears eagerly (synchronously) on free().
278 BASE_FEATURE(kPartitionAllocPCScanEagerClearing,
279              "PartitionAllocPCScanEagerClearing",
280              FEATURE_DISABLED_BY_DEFAULT);
281 
282 // In addition to heap, scan also the stack of the current mutator.
283 BASE_FEATURE(kPartitionAllocPCScanStackScanning,
284              "PartitionAllocPCScanStackScanning",
285 #if BUILDFLAG(STACK_SCAN_SUPPORTED)
286              FEATURE_ENABLED_BY_DEFAULT
287 #else
288              FEATURE_DISABLED_BY_DEFAULT
289 #endif  // BUILDFLAG(STACK_SCAN_SUPPORTED)
290 );
291 
292 BASE_FEATURE(kPartitionAllocDCScan,
293              "PartitionAllocDCScan",
294              FEATURE_DISABLED_BY_DEFAULT);
295 
296 // Whether to straighten free lists for larger slot spans in PurgeMemory() ->
297 // ... -> PartitionPurgeSlotSpan().
298 BASE_FEATURE(kPartitionAllocStraightenLargerSlotSpanFreeLists,
299              "PartitionAllocStraightenLargerSlotSpanFreeLists",
300              FEATURE_ENABLED_BY_DEFAULT);
301 const base::FeatureParam<
302     partition_alloc::StraightenLargerSlotSpanFreeListsMode>::Option
303     kPartitionAllocStraightenLargerSlotSpanFreeListsModeOption[] = {
304         {partition_alloc::StraightenLargerSlotSpanFreeListsMode::
305              kOnlyWhenUnprovisioning,
306          "only-when-unprovisioning"},
307         {partition_alloc::StraightenLargerSlotSpanFreeListsMode::kAlways,
308          "always"},
309 };
310 const base::FeatureParam<partition_alloc::StraightenLargerSlotSpanFreeListsMode>
311     kPartitionAllocStraightenLargerSlotSpanFreeListsMode = {
312         &kPartitionAllocStraightenLargerSlotSpanFreeLists,
313         "mode",
314         partition_alloc::StraightenLargerSlotSpanFreeListsMode::
315             kOnlyWhenUnprovisioning,
316         &kPartitionAllocStraightenLargerSlotSpanFreeListsModeOption,
317 };
318 
319 // Whether to sort free lists for smaller slot spans in PurgeMemory().
320 BASE_FEATURE(kPartitionAllocSortSmallerSlotSpanFreeLists,
321              "PartitionAllocSortSmallerSlotSpanFreeLists",
322              FEATURE_ENABLED_BY_DEFAULT);
323 
324 // Whether to sort the active slot spans in PurgeMemory().
325 BASE_FEATURE(kPartitionAllocSortActiveSlotSpans,
326              "PartitionAllocSortActiveSlotSpans",
327              FEATURE_DISABLED_BY_DEFAULT);
328 
329 #if BUILDFLAG(IS_WIN)
330 // Whether to retry allocations when commit fails.
331 BASE_FEATURE(kPageAllocatorRetryOnCommitFailure,
332              "PageAllocatorRetryOnCommitFailure",
333              FEATURE_DISABLED_BY_DEFAULT);
334 #endif
335 
336 #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
337 // A parameter to exclude or not exclude PartitionAllocSupport from
338 // PartialLowModeOnMidRangeDevices. This is used to see how it affects
339 // renderer performances, e.g. blink_perf.parser benchmark.
340 // The feature: kPartialLowEndModeOnMidRangeDevices is defined in
341 // //base/features.cc. Since the following feature param is related to
342 // PartitionAlloc, define the param here.
343 const FeatureParam<bool> kPartialLowEndModeExcludePartitionAllocSupport{
344     &kPartialLowEndModeOnMidRangeDevices, "exclude-partition-alloc-support",
345     false};
346 #endif
347 
348 BASE_FEATURE(kEnableConfigurableThreadCacheMultiplier,
349              "EnableConfigurableThreadCacheMultiplier",
350              base::FEATURE_DISABLED_BY_DEFAULT);
351 
352 MIRACLE_PARAMETER_FOR_DOUBLE(GetThreadCacheMultiplier,
353                              kEnableConfigurableThreadCacheMultiplier,
354                              "ThreadCacheMultiplier",
355                              2.)
356 
357 MIRACLE_PARAMETER_FOR_DOUBLE(GetThreadCacheMultiplierForAndroid,
358                              kEnableConfigurableThreadCacheMultiplier,
359                              "ThreadCacheMultiplierForAndroid",
360                              1.)
361 
ToPartitionAllocTimeDelta(base::TimeDelta time_delta)362 constexpr partition_alloc::internal::base::TimeDelta ToPartitionAllocTimeDelta(
363     base::TimeDelta time_delta) {
364   return partition_alloc::internal::base::Microseconds(
365       time_delta.InMicroseconds());
366 }
367 
FromPartitionAllocTimeDelta(partition_alloc::internal::base::TimeDelta time_delta)368 constexpr base::TimeDelta FromPartitionAllocTimeDelta(
369     partition_alloc::internal::base::TimeDelta time_delta) {
370   return base::Microseconds(time_delta.InMicroseconds());
371 }
372 
373 BASE_FEATURE(kEnableConfigurableThreadCachePurgeInterval,
374              "EnableConfigurableThreadCachePurgeInterval",
375              base::FEATURE_DISABLED_BY_DEFAULT);
376 
377 MIRACLE_PARAMETER_FOR_TIME_DELTA(
378     GetThreadCacheMinPurgeIntervalValue,
379     kEnableConfigurableThreadCachePurgeInterval,
380     "ThreadCacheMinPurgeInterval",
381     FromPartitionAllocTimeDelta(partition_alloc::kMinPurgeInterval))
382 
383 MIRACLE_PARAMETER_FOR_TIME_DELTA(
384     GetThreadCacheMaxPurgeIntervalValue,
385     kEnableConfigurableThreadCachePurgeInterval,
386     "ThreadCacheMaxPurgeInterval",
387     FromPartitionAllocTimeDelta(partition_alloc::kMaxPurgeInterval))
388 
389 MIRACLE_PARAMETER_FOR_TIME_DELTA(
390     GetThreadCacheDefaultPurgeIntervalValue,
391     kEnableConfigurableThreadCachePurgeInterval,
392     "ThreadCacheDefaultPurgeInterval",
393     FromPartitionAllocTimeDelta(partition_alloc::kDefaultPurgeInterval))
394 
395 const partition_alloc::internal::base::TimeDelta
GetThreadCacheMinPurgeInterval()396 GetThreadCacheMinPurgeInterval() {
397   return ToPartitionAllocTimeDelta(GetThreadCacheMinPurgeIntervalValue());
398 }
399 
400 const partition_alloc::internal::base::TimeDelta
GetThreadCacheMaxPurgeInterval()401 GetThreadCacheMaxPurgeInterval() {
402   return ToPartitionAllocTimeDelta(GetThreadCacheMaxPurgeIntervalValue());
403 }
404 
405 const partition_alloc::internal::base::TimeDelta
GetThreadCacheDefaultPurgeInterval()406 GetThreadCacheDefaultPurgeInterval() {
407   return ToPartitionAllocTimeDelta(GetThreadCacheDefaultPurgeIntervalValue());
408 }
409 
410 BASE_FEATURE(kEnableConfigurableThreadCacheMinCachedMemoryForPurging,
411              "EnableConfigurableThreadCacheMinCachedMemoryForPurging",
412              base::FEATURE_DISABLED_BY_DEFAULT);
413 
414 MIRACLE_PARAMETER_FOR_INT(
415     GetThreadCacheMinCachedMemoryForPurgingBytes,
416     kEnableConfigurableThreadCacheMinCachedMemoryForPurging,
417     "ThreadCacheMinCachedMemoryForPurgingBytes",
418     partition_alloc::kMinCachedMemoryForPurgingBytes)
419 
420 // An apparent quarantine leak in the buffer partition unacceptably
421 // bloats memory when MiraclePtr is enabled in the renderer process.
422 // We believe we have found and patched the leak, but out of an
423 // abundance of caution, we provide this toggle that allows us to
424 // wholly disable MiraclePtr in the buffer partition, if necessary.
425 //
426 // TODO(crbug.com/1444624): this is unneeded once
427 // MiraclePtr-for-Renderer launches.
428 BASE_FEATURE(kPartitionAllocDisableBRPInBufferPartition,
429              "PartitionAllocDisableBRPInBufferPartition",
430              FEATURE_DISABLED_BY_DEFAULT);
431 
432 #if BUILDFLAG(USE_FREELIST_POOL_OFFSETS)
433 BASE_FEATURE(kUsePoolOffsetFreelists,
434              "PartitionAllocUsePoolOffsetFreelists",
435              base::FEATURE_DISABLED_BY_DEFAULT);
436 #endif
437 
438 BASE_FEATURE(kPartitionAllocMakeFreeNoOpOnShutdown,
439              "PartitionAllocMakeFreeNoOpOnShutdown",
440              FEATURE_DISABLED_BY_DEFAULT);
441 
442 constexpr FeatureParam<WhenFreeBecomesNoOp>::Option
443     kPartitionAllocMakeFreeNoOpOnShutdownOptions[] = {
444         {
445             WhenFreeBecomesNoOp::kBeforeShutDownThreads,
446             "before-shutdown-threads",
447         },
448         {
449             WhenFreeBecomesNoOp::kInShutDownThreads,
450             "in-shutdown-threads",
451         },
452         {
453             WhenFreeBecomesNoOp::kAfterShutDownThreads,
454             "after-shutdown-threads",
455         },
456 };
457 
458 const base::FeatureParam<WhenFreeBecomesNoOp>
459     kPartitionAllocMakeFreeNoOpOnShutdownParam{
460         &kPartitionAllocMakeFreeNoOpOnShutdown, "callsite",
461         WhenFreeBecomesNoOp::kBeforeShutDownThreads,
462         &kPartitionAllocMakeFreeNoOpOnShutdownOptions};
463 
MakeFreeNoOp(WhenFreeBecomesNoOp callsite)464 void MakeFreeNoOp(WhenFreeBecomesNoOp callsite) {
465   CHECK(base::FeatureList::GetInstance());
466   // Ignoring `free()` during Shutdown would allow developers to introduce new
467   // dangling pointers. So we want to avoid ignoring free when it is enabled.
468   // Note: For now, the DanglingPointerDetector is only enabled on 5 bots, and
469   // on linux non-official configuration.
470   // TODO(b/40802063): Reconsider this decision after the experiment.
471 #if BUILDFLAG(ENABLE_DANGLING_RAW_PTR_CHECKS)
472   if (base::FeatureList::IsEnabled(features::kPartitionAllocDanglingPtr)) {
473     return;
474   }
475 #endif  // BUILDFLAG(ENABLE_DANGLING_RAW_PTR_CHECKS)
476 #if BUILDFLAG(USE_ALLOCATOR_SHIM)
477   if (base::FeatureList::IsEnabled(kPartitionAllocMakeFreeNoOpOnShutdown) &&
478       kPartitionAllocMakeFreeNoOpOnShutdownParam.Get() == callsite) {
479     allocator_shim::InsertNoOpOnFreeAllocatorShimOnShutDown();
480   }
481 #endif  // BUILDFLAG(USE_ALLOCATOR_SHIM)
482 }
483 
484 BASE_FEATURE(kPartitionAllocAdjustSizeWhenInForeground,
485              "PartitionAllocAdjustSizeWhenInForeground",
486              base::FEATURE_DISABLED_BY_DEFAULT);
487 
488 }  // namespace features
489 }  // namespace base
490