Avoid calling OneGroupPerRendererEnabled where blocking is not allowed
Occasionally OnFirstIdle() can be called before the first call to the
base::Process cgroup subsystem. When OnFirstIdle() is called we cleanup
stale Process cgroups but only after validating that the feature is
enabled and that the system supports our cgroups by calling
OneGroupPerRendererEnabled(). However, that function is blocking.
Instead, we will initially check the feature is enabled and then post a
task to perform additional checks and cleanup.
Bug: chromium:1334522
Change-Id: I4be3c31a96b67847df710f93f32deb04a30473a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3696446
Reviewed-by: Erik Chen <[email protected]>
Commit-Queue: Youssef Esmat <[email protected]>
Reviewed-by: Lei Zhang <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1012891}
diff --git a/base/process/process.h b/base/process/process.h
index 619374c..2e112b5 100644
--- a/base/process/process.h
+++ b/base/process/process.h
@@ -229,10 +229,8 @@
#endif
#if BUILDFLAG(IS_CHROMEOS)
- // Returns true if the 'OneGroupPerRenderer' feature is enabled. The feature
- // is enabled if the kOneGroupPerRenderer feature flag is enabled and the
- // system supports the chrome cgroups.
- static bool OneGroupPerRendererEnabled();
+ // Exposes OneGroupPerRendererEnabled() to unit tests.
+ static bool OneGroupPerRendererEnabledForTesting();
// If OneGroupPerRenderer is enabled, runs at process startup to clean up
// any stale cgroups that were left behind from any unclean exits of the