Rework Performance Tuning prefs
This CL moves the high-efficiency and battery saver mode prefs to local
state, and adds the pref that will contain the tab discarding exceptions
to the profile pref store.
The existing prefs being moved from Profile to Local State have never been read from or written to yet.
Bug: 1308741
Change-Id: I120a326c0466e13b5f577ec925a6f94e316c0bf3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3569704
Reviewed-by: Francois Pierre Doray <[email protected]>
Reviewed-by: David Roger <[email protected]>
Reviewed-by: Dominic Battré <[email protected]>
Commit-Queue: Anthony Vallée-Dubois <[email protected]>
Cr-Commit-Position: refs/heads/main@{#995713}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 156d377..771ecb3 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -1085,6 +1085,7 @@
IntranetRedirectDetector::RegisterPrefs(registry);
media_router::RegisterLocalStatePrefs(registry);
metrics::TabStatsTracker::RegisterPrefs(registry);
+ performance_manager::user_tuning::prefs::RegisterLocalStatePrefs(registry);
RegisterBrowserPrefs(registry);
speech::SodaInstaller::RegisterLocalStatePrefs(registry);
StartupBrowserCreator::RegisterLocalStatePrefs(registry);
diff --git a/components/performance_manager/BUILD.gn b/components/performance_manager/BUILD.gn
index 66e69e7..69f19436 100644
--- a/components/performance_manager/BUILD.gn
+++ b/components/performance_manager/BUILD.gn
@@ -192,6 +192,7 @@
deps = [
"//build:chromeos_buildflags",
"//components/pref_registry:pref_registry",
+ "//components/prefs:prefs",
"//third_party/blink/public/common:headers",
]
diff --git a/components/performance_manager/DEPS b/components/performance_manager/DEPS
index e33abcc..3531954 100644
--- a/components/performance_manager/DEPS
+++ b/components/performance_manager/DEPS
@@ -1,6 +1,7 @@
include_rules = [
"+components/memory_pressure",
"+components/pref_registry",
+ "+components/prefs",
"+components/services/storage/public/cpp",
"+components/ukm",
"+content/public/common",
diff --git a/components/performance_manager/public/user_tuning/prefs.h b/components/performance_manager/public/user_tuning/prefs.h
index a2ea8c2..50edf6a0 100644
--- a/components/performance_manager/public/user_tuning/prefs.h
+++ b/components/performance_manager/public/user_tuning/prefs.h
@@ -5,6 +5,8 @@
#ifndef COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_USER_TUNING_PREFS_H_
#define COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_USER_TUNING_PREFS_H_
+class PrefRegistrySimple;
+
namespace user_prefs {
class PrefRegistrySyncable;
}
@@ -15,6 +17,10 @@
extern const char kBatterySaverModeEnabled[];
+extern const char kTabDiscardingExceptions[];
+
+void RegisterLocalStatePrefs(PrefRegistrySimple* registry);
+
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
} // namespace performance_manager::user_tuning::prefs
diff --git a/components/performance_manager/user_tuning/prefs.cc b/components/performance_manager/user_tuning/prefs.cc
index 0c698319..997d553 100644
--- a/components/performance_manager/user_tuning/prefs.cc
+++ b/components/performance_manager/user_tuning/prefs.cc
@@ -5,6 +5,7 @@
#include "components/performance_manager/public/user_tuning/prefs.h"
#include "components/pref_registry/pref_registry_syncable.h"
+#include "components/prefs/pref_registry_simple.h"
namespace performance_manager::user_tuning::prefs {
@@ -14,9 +15,16 @@
const char kBatterySaverModeEnabled[] =
"performance_tuning.battery_saver_mode.enabled";
-void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
+const char kTabDiscardingExceptions[] =
+ "performance_tuning.tab_discarding.exceptions";
+
+void RegisterLocalStatePrefs(PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(kHighEfficiencyModeEnabled, false);
registry->RegisterBooleanPref(kBatterySaverModeEnabled, false);
}
+void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
+ registry->RegisterListPref(kTabDiscardingExceptions);
+}
+
} // namespace performance_manager::user_tuning::prefs
\ No newline at end of file