Compare commits

...

1 Commits

Author SHA1 Message Date
deepak1556
f61947dd80 feat: enable spare renderer for site per process feature 2025-05-06 22:10:56 +09:00
3 changed files with 24 additions and 5 deletions

View File

@@ -794,6 +794,26 @@ base::FilePath ElectronBrowserClient::GetLoggingFileName(
return logging::GetLogFileName(cmd_line);
}
std::optional<
content::ContentBrowserClient::SpareProcessRefusedByEmbedderReason>
ElectronBrowserClient::ShouldUseSpareRenderProcessHost(
content::BrowserContext* browser_context,
const GURL& site_url) {
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
// Extensions should not use a spare process, because they require passing a
// command-line flag (switches::kExtensionProcess) to the renderer process
// when it launches. A spare process is launched earlier, before it is known
// which navigation will use it, so it lacks this flag.
if (site_url.SchemeIs(extensions::kExtensionScheme)) {
return content::ContentBrowserClient::SpareProcessRefusedByEmbedderReason::
ExtensionProcess;
}
return std::nullopt;
#else
return std::nullopt;
#endif
}
std::unique_ptr<net::ClientCertStore>
ElectronBrowserClient::CreateClientCertStore(
content::BrowserContext* browser_context) {

View File

@@ -319,6 +319,10 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
const blink::StorageKey& storage_key,
base::OnceCallback<void(bool, const std::string&)> callback) override;
base::FilePath GetLoggingFileName(const base::CommandLine& cmd_line) override;
std::optional<
content::ContentBrowserClient::SpareProcessRefusedByEmbedderReason>
ShouldUseSpareRenderProcessHost(content::BrowserContext* browser_context,
const GURL& site_url) override;
// content::RenderProcessHostObserver:
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;

View File

@@ -45,12 +45,7 @@ void InitializeFeatureList() {
cmd_line->GetSwitchValueASCII(::switches::kEnableFeatures);
auto disable_features =
cmd_line->GetSwitchValueASCII(::switches::kDisableFeatures);
// Disable creation of spare renderer process with site-per-process mode,
// it interferes with our process preference tracking for non sandboxed mode.
// Can be reenabled when our site instance policy is aligned with chromium
// when node integration is enabled.
disable_features +=
std::string(",") + features::kSpareRendererForSitePerProcess.name +
// See https://chromium-review.googlesource.com/c/chromium/src/+/6487926
// this breaks PDFs locally as we don't have GLIC infra enabled.
std::string(",") + ax::mojom::features::kScreenAIOCREnabled.name;