Skip to content

Commit

Permalink
[power] Clean up PowerScheduler experiment infrastructure
Browse files Browse the repository at this point in the history
This change removes the code for the PowerScheduler feature and all
related earlier experiments for Chrome and WebView.

Bug: 1166695,b/214586482
Change-Id: Iadb5a3c1591e648734e84e0df600a876000d8007
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3533415
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Weilun Shi <sweilun@chromium.org>
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#984574}
  • Loading branch information
Oksana Zhuravlova authored and Chromium LUCI CQ committed Mar 23, 2022
1 parent 02ddf71 commit f5e2434
Show file tree
Hide file tree
Showing 18 changed files with 16 additions and 1,153 deletions.
1 change: 0 additions & 1 deletion android_webview/BUILD.gn
Expand Up @@ -844,7 +844,6 @@ android_library("common_java") {
"//components/feature_engagement/public:public_java",
"//components/metrics:metrics_java",
"//components/network_session_configurator/android:network_session_configurator_java",
"//components/power_scheduler:power_scheduler_java",
"//components/viz:viz_java",
"//components/webrtc:components_webrtc_java",
"//content/public/android:content_java",
Expand Down
Expand Up @@ -11,7 +11,6 @@
import org.chromium.components.feature_engagement.FeatureConstants;
import org.chromium.components.metrics.MetricsSwitches;
import org.chromium.components.network_session_configurator.NetworkSessionSwitches;
import org.chromium.components.power_scheduler.PowerSchedulerFeatures;
import org.chromium.components.viz.common.VizFeatures;
import org.chromium.components.webrtc.ComponentsWebRtcFeatures;
import org.chromium.content_public.common.ContentFeatures;
Expand Down Expand Up @@ -127,20 +126,6 @@ private ProductionSupportedFlagList() {}
+ "feature flag until the true runtime cost can be measured."),
Flag.baseFeature(AwFeatures.WEBVIEW_DISPLAY_CUTOUT,
"Enables display cutout (notch) support in WebView for Android P and above."),
Flag.baseFeature(PowerSchedulerFeatures.WEBVIEW_CPU_AFFINITY_RESTRICT_TO_LITTLE_CORES,
"Forces WebView to do rendering work on LITTLE CPU cores on big.LITTLE "
+ "architectures"),
Flag.baseFeature(PowerSchedulerFeatures.WEBVIEW_POWER_SCHEDULER_THROTTLE_IDLE,
"Restricts all of WebView's out-of-process renderer threads to use only LITTLE "
+ "CPU cores on big.LITTLE architectures when the power mode is idle. "
+ "WebViewCpuAffinityRestrictToLittleCores, if set, takes precedence "
+ "over this flag."),
Flag.baseFeature(PowerSchedulerFeatures.POWER_SCHEDULER,
"Enables the Power Scheduler. Defaults to throttling when idle or in no-op "
+ "animations, if at least 250ms of CPU time were spent "
+ "in the first 500ms after entering idle/no-op animation mode. "
+ "Can be further configured via field trial parameters, "
+ "see power_scheduler.h/cc for details."),
Flag.baseFeature(BlinkFeatures.WEBVIEW_ACCELERATE_SMALL_CANVASES,
"Accelerate all canvases in webview."),
Flag.baseFeature(AwFeatures.WEBVIEW_MIXED_CONTENT_AUTOUPGRADES,
Expand Down
13 changes: 2 additions & 11 deletions android_webview/lib/aw_main_delegate.cc
Expand Up @@ -41,12 +41,11 @@
#include "components/crash/core/common/crash_key.h"
#include "components/gwp_asan/buildflags/buildflags.h"
#include "components/metrics/unsent_log_store_metrics.h"
#include "components/power_scheduler/power_scheduler.h"
#include "components/safe_browsing/android/safe_browsing_api_handler_bridge.h"
#include "components/services/heap_profiling/public/cpp/profiling_client.h"
#include "components/spellcheck/spellcheck_buildflags.h"
#include "components/variations/variations_ids_provider.h"
#include "components/translate/core/common/translate_util.h"
#include "components/variations/variations_ids_provider.h"
#include "components/version_info/android/channel_getter.h"
#include "components/viz/common/features.h"
#include "content/public/browser/android/media_url_interceptor_register.h"
Expand Down Expand Up @@ -397,15 +396,7 @@ void AwMainDelegate::PostFieldTrialInitialization() {
*base::CommandLine::ForCurrentProcess();
std::string process_type =
command_line.GetSwitchValueASCII(switches::kProcessType);
bool is_browser_process = process_type.empty();

// Enable LITTLE-cores only mode/idle power mode throttling if the features
// are enabled, but only for child processes, as the browser process is shared
// with the hosting app.
if (!is_browser_process) {
power_scheduler::PowerScheduler::GetInstance()
->InitializePolicyFromFeatureList();
}
[[maybe_unused]] bool is_browser_process = process_type.empty();

#if BUILDFLAG(ENABLE_GWP_ASAN_MALLOC)
gwp_asan::EnableForMalloc(is_canary_dev || is_browser_process,
Expand Down
1 change: 0 additions & 1 deletion android_webview/renderer/aw_render_thread_observer.cc
Expand Up @@ -4,7 +4,6 @@

#include "android_webview/renderer/aw_render_thread_observer.h"

#include "components/power_scheduler/power_scheduler.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/platform/web_cache.h"
#include "third_party/blink/public/platform/web_network_state_notifier.h"
Expand Down
9 changes: 0 additions & 9 deletions chrome/app/chrome_main_delegate.cc
Expand Up @@ -144,7 +144,6 @@
#include "chrome/browser/flags/android/chrome_feature_list.h"
#include "chrome/common/chrome_descriptors.h"
#include "components/crash/android/pure_java_exception_handler.h"
#include "components/power_scheduler/power_scheduler.h"
#include "net/android/network_change_notifier_factory_android.h"
#else // BUILDFLAG(IS_ANDROID)
// Diagnostics is only available on non-android platforms.
Expand Down Expand Up @@ -655,14 +654,6 @@ void ChromeMainDelegate::PostFieldTrialInitialization() {
// it if not already overridden by command line, field trial etc.
net::HttpCache::SplitCacheFeatureEnableByDefault();

#if BUILDFLAG(IS_ANDROID)
// For child processes, this requires allowlisting of the sched_setaffinity()
// syscall in the sandbox (baseline_policy_android.cc). When this call is
// removed, the sandbox allowlist should be updated too.
power_scheduler::PowerScheduler::GetInstance()
->InitializePolicyFromFeatureList();
#endif

#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
// Threading features.
base::PlatformThread::InitThreadPostFieldTrial();
Expand Down
8 changes: 0 additions & 8 deletions chrome/browser/about_flags.cc
Expand Up @@ -222,7 +222,6 @@
#include "components/content_creation/notes/core/note_features.h"
#include "components/content_creation/reactions/core/reactions_features.h"
#include "components/external_intents/android/external_intents_features.h"
#include "components/power_scheduler/power_scheduler_features.h"
#include "components/translate/content/android/translate_message.h"
#include "components/webapps/browser/android/features.h"
#else // BUILDFLAG(IS_ANDROID)
Expand Down Expand Up @@ -6964,13 +6963,6 @@ const FeatureEntry kFeatureEntries[] = {
FEATURE_VALUE_TYPE(features::kConsolidatedSiteStorageControls)},

#if BUILDFLAG(IS_ANDROID)
{"cpu-affinity-restrict-to-little-cores",
flag_descriptions::kCpuAffinityRestrictToLittleCoresName,
flag_descriptions::kCpuAffinityRestrictToLittleCoresDescription,
kOsAndroid,
FEATURE_VALUE_TYPE(
power_scheduler::features::kCpuAffinityRestrictToLittleCores)},

{"enable-surface-control", flag_descriptions::kAndroidSurfaceControlName,
flag_descriptions::kAndroidSurfaceControlDescription, kOsAndroid,
FEATURE_VALUE_TYPE(features::kAndroidSurfaceControl)},
Expand Down
28 changes: 0 additions & 28 deletions components/power_scheduler/BUILD.gn
Expand Up @@ -18,15 +18,6 @@ component("power_scheduler") {
"traced_power_mode.h",
]

if (is_android) {
sources += [
"power_scheduler.cc",
"power_scheduler.h",
"power_scheduler_features.cc",
"power_scheduler_features.h",
]
}

defines = [ "IS_POWER_SCHEDULER_IMPL" ]

deps = [
Expand All @@ -39,29 +30,10 @@ source_set("unit_tests") {
testonly = true
sources = [ "power_mode_arbiter_unittest.cc" ]

if (is_android) {
sources += [ "power_scheduler_unittest.cc" ]
}

deps = [
":power_scheduler",
"//base/test:test_support",
"//testing/gmock",
"//testing/gtest",
]
}

if (is_android) {
java_cpp_features("java_features_srcjar") {
# External code should depend on ":power_scheduler_java" instead.
visibility = [ ":*" ]
sources = [ "power_scheduler_features.cc" ]
template = "java/src/org/chromium/components/power_scheduler/PowerSchedulerFeatures.java.tmpl"
}

android_library("power_scheduler_java") {
# Right now, this only includes the Java features. But if we need more Java
# files, they should be added here as necessary.
srcjar_deps = [ ":java_features_srcjar" ]
}
}

This file was deleted.

0 comments on commit f5e2434

Please sign in to comment.