Add feature to ensure existing renderer is alive when used in RPH
When using an existing renderer, the OS process may have been killed by
the system (especially on Android). This feature makes sure the process
is started back up ASAP to decrease latency when using the renderer
process.
Bug: 332706093
Change-Id: I9c92b83ff8656e0d3803d9a97c37454df886d52d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5495030
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1293864}
diff --git a/android_webview/java/src/org/chromium/android_webview/common/ProductionSupportedFlagList.java b/android_webview/java/src/org/chromium/android_webview/common/ProductionSupportedFlagList.java
index 0ee6610..492fcf4 100644
--- a/android_webview/java/src/org/chromium/android_webview/common/ProductionSupportedFlagList.java
+++ b/android_webview/java/src/org/chromium/android_webview/common/ProductionSupportedFlagList.java
@@ -982,6 +982,7 @@
Flag.baseFeature(
"MojoPredictiveAllocation",
"Predictively allocate some serialization buffers for Mojo"),
+ Flag.baseFeature("EnsureExistingRendererAlive"),
// Add new commandline switches and features above. The final entry should have a
// trailing comma for cleaner diffs.
};
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 9d2105b..47ee80b 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1126,6 +1126,10 @@
blink::features::kAttributionReportingInBrowserMigration);
}
+BASE_FEATURE(kEnsureExistingRendererAlive,
+ "EnsureExistingRendererAlive",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
} // namespace
// A RenderProcessHostImpl's IO thread implementation of the
@@ -4844,6 +4848,11 @@
}
}
+ if (render_process_host &&
+ base::FeatureList::IsEnabled(kEnsureExistingRendererAlive)) {
+ render_process_host->Init();
+ }
+
// If we found a process to reuse, double-check that it is suitable for
// |site_instance|. For example, if the SiteInfo for |site_instance| requires
// a dedicated process, we should never pick a process used by, or locked to,
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json
index 1377128..3630f2f 100644
--- a/testing/variations/fieldtrial_testing_config.json
+++ b/testing/variations/fieldtrial_testing_config.json
@@ -7196,6 +7196,27 @@
]
}
],
+ "EnsureExistingRendererAlive": [
+ {
+ "platforms": [
+ "android",
+ "android_webview",
+ "chromeos",
+ "chromeos_lacros",
+ "linux",
+ "mac",
+ "windows"
+ ],
+ "experiments": [
+ {
+ "name": "Enabled",
+ "enable_features": [
+ "EnsureExistingRendererAlive"
+ ]
+ }
+ ]
+ }
+ ],
"EnterprisePolicyOnSignin": [
{
"platforms": [