Commit 1898d739 authored by Laís Minchillo's avatar Laís Minchillo Committed by Commit Bot

[aw] Add flag to run renderer in little cores

Bug: 1111789
Change-Id: I53dec0cac2c6a28ea70aa7ee215cd4c1325ef054
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2421653
Commit-Queue: Laís Minchillo <laisminchillo@chromium.org>
Auto-Submit: Laís Minchillo <laisminchillo@chromium.org>
Reviewed-by: default avatarEric Seckler <eseckler@chromium.org>
Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811696}
parent 9d158132
...@@ -420,6 +420,11 @@ void AwContentBrowserClient::AppendExtraCommandLineSwitches( ...@@ -420,6 +420,11 @@ void AwContentBrowserClient::AppendExtraCommandLineSwitches(
::switches::kEnableCrashReporterForTesting)) { ::switches::kEnableCrashReporterForTesting)) {
command_line->AppendSwitch(::switches::kEnableCrashReporterForTesting); command_line->AppendSwitch(::switches::kEnableCrashReporterForTesting);
} }
// Pass WebView's force little cores flag to renderer process.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kWebViewForceLittleCores)) {
command_line->AppendSwitch(::switches::kWebViewForceLittleCores);
}
} }
} }
......
...@@ -49,4 +49,7 @@ const char kFinchSeedMinDownloadPeriod[] = "finch-seed-min-download-period"; ...@@ -49,4 +49,7 @@ const char kFinchSeedMinDownloadPeriod[] = "finch-seed-min-download-period";
// variations seed. // variations seed.
const char kFinchSeedMinUpdatePeriod[] = "finch-seed-min-update-period"; const char kFinchSeedMinUpdatePeriod[] = "finch-seed-min-update-period";
// Force WebView renderer to run in little cores
const char kWebViewForceLittleCores[] = "webview-force-little-cores";
} // namespace switches } // namespace switches
...@@ -18,6 +18,7 @@ extern const char kFinchSeedExpirationAge[]; ...@@ -18,6 +18,7 @@ extern const char kFinchSeedExpirationAge[];
extern const char kFinchSeedIgnorePendingDownload[]; extern const char kFinchSeedIgnorePendingDownload[];
extern const char kFinchSeedMinDownloadPeriod[]; extern const char kFinchSeedMinDownloadPeriod[];
extern const char kFinchSeedMinUpdatePeriod[]; extern const char kFinchSeedMinUpdatePeriod[];
extern const char kWebViewForceLittleCores[];
} // namespace switches } // namespace switches
......
...@@ -88,5 +88,7 @@ public final class ProductionSupportedFlagList { ...@@ -88,5 +88,7 @@ public final class ProductionSupportedFlagList {
+ "Elements v0, and HTML Imports)."), + "Elements v0, and HTML Imports)."),
Flag.baseFeature(AwFeatures.WEBVIEW_DISPLAY_CUTOUT, Flag.baseFeature(AwFeatures.WEBVIEW_DISPLAY_CUTOUT,
"Enables display cutout (notch) support in WebView for Android P and above."), "Enables display cutout (notch) support in WebView for Android P and above."),
Flag.commandLine(AwSwitches.WEBVIEW_FORCE_LITTLE_CORES,
"Forces WebView to do rendering work in little cores"),
}; };
} }
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "base/check_op.h" #include "base/check_op.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/cpu.h" #include "base/cpu.h"
#include "base/cpu_affinity_posix.h"
#include "base/i18n/icu_util.h" #include "base/i18n/icu_util.h"
#include "base/i18n/rtl.h" #include "base/i18n/rtl.h"
#include "base/posix/global_descriptors.h" #include "base/posix/global_descriptors.h"
...@@ -298,6 +299,10 @@ void AwMainDelegate::PreSandboxStartup() { ...@@ -298,6 +299,10 @@ void AwMainDelegate::PreSandboxStartup() {
if (process_type == switches::kRendererProcess) { if (process_type == switches::kRendererProcess) {
InitResourceBundleRendererSide(); InitResourceBundleRendererSide();
if (command_line.HasSwitch(switches::kWebViewForceLittleCores)) {
base::SetProcessCpuAffinityMode(base::GetCurrentProcessHandle(),
base::CpuAffinityMode::kLittleCoresOnly);
}
} }
EnableCrashReporter(process_type); EnableCrashReporter(process_type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment