mirror of
https://github.com/morgan9e/helium
synced 2026-04-14 00:14:20 +09:00
helium: add flag for setting energy saver fps
This commit is contained in:
68
patches/helium/core/add-low-power-framerate-flag.patch
Normal file
68
patches/helium/core/add-low-power-framerate-flag.patch
Normal file
@@ -0,0 +1,68 @@
|
||||
--- a/chrome/browser/helium_flag_choices.h
|
||||
+++ b/chrome/browser/helium_flag_choices.h
|
||||
@@ -7,6 +7,15 @@
|
||||
namespace helium {
|
||||
using namespace ::helium;
|
||||
|
||||
+ constexpr const char kEnergySaverFrameRateCommandLine[] = "energy-saver-fps-limit";
|
||||
+ constexpr const FeatureEntry::Choice kEnergySaverFrameRateChoices[] = {
|
||||
+ {flags_ui::kGenericExperimentChoiceAutomatic, "", ""},
|
||||
+ {"30", kEnergySaverFrameRateCommandLine, "30"},
|
||||
+ {"60", kEnergySaverFrameRateCommandLine, "60"},
|
||||
+ {"120", kEnergySaverFrameRateCommandLine, "120"},
|
||||
+ {"Disabled", kEnergySaverFrameRateCommandLine, "9001"},
|
||||
+ };
|
||||
+
|
||||
} // namespace helium
|
||||
|
||||
#endif /* CHROME_BROWSER_HELIUM_FLAG_CHOICES_H_ */
|
||||
--- a/chrome/browser/helium_flag_entries.h
|
||||
+++ b/chrome/browser/helium_flag_entries.h
|
||||
@@ -1,3 +1,7 @@
|
||||
#ifndef CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_
|
||||
#define CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_
|
||||
+ {helium::kEnergySaverFrameRateCommandLine,
|
||||
+ "Maximum frame rate for Energy Saver",
|
||||
+ "Configures the frame rate the browser is throttled to when Energy Saver is enabled. Helium flag",
|
||||
+ kOsDesktop, MULTI_VALUE_TYPE(helium::kEnergySaverFrameRateChoices)},
|
||||
#endif /* CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_ */
|
||||
--- a/chrome/browser/performance_manager/user_tuning/battery_saver_mode_manager.cc
|
||||
+++ b/chrome/browser/performance_manager/user_tuning/battery_saver_mode_manager.cc
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "base/power_monitor/power_observer.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/scoped_multi_source_observation.h"
|
||||
+#include "base/strings/string_number_conversions.h"
|
||||
#include "base/values.h"
|
||||
#include "components/performance_manager/freezing/freezing_policy.h"
|
||||
#include "components/performance_manager/performance_manager_impl.h"
|
||||
@@ -68,12 +69,28 @@ constexpr int kBatterySaverModeThreshold
|
||||
constexpr int kBatterySaverModeThresholdAdjustmentForDisplayLevel = 0;
|
||||
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||
|
||||
+int GetMaxRate() {
|
||||
+ auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||
+ int fps;
|
||||
+
|
||||
+ if (command_line->HasSwitch("energy-saver-fps-limit") &&
|
||||
+ base::StringToInt(command_line->GetSwitchValueASCII(
|
||||
+ "energy-saver-fps-limit"), &fps) && fps > 0) {
|
||||
+ return fps;
|
||||
+ }
|
||||
+
|
||||
+ return 30;
|
||||
+}
|
||||
+
|
||||
class FrameThrottlingDelegateImpl
|
||||
: public performance_manager::user_tuning::BatterySaverModeManager::
|
||||
FrameThrottlingDelegate {
|
||||
public:
|
||||
void StartThrottlingAllFrameSinks() override {
|
||||
- content::StartThrottlingAllFrameSinks(base::Hertz(30));
|
||||
+ static int max_rate = GetMaxRate();
|
||||
+ if (max_rate < 9000) {
|
||||
+ content::StartThrottlingAllFrameSinks(base::Hertz(max_rate));
|
||||
+ }
|
||||
}
|
||||
|
||||
void StopThrottlingAllFrameSinks() override {
|
||||
@@ -8,20 +8,6 @@
|
||||
#include "chrome/browser/devtools/features.h"
|
||||
#include "chrome/browser/flag_descriptions.h"
|
||||
#include "chrome/browser/ip_protection/ip_protection_switches.h"
|
||||
@@ -4733,11 +4734,13 @@ const FeatureEntry::FeatureVariation kHi
|
||||
#include "chrome/browser/bromite_flag_choices.h"
|
||||
#include "chrome/browser/ungoogled_platform_flag_choices.h"
|
||||
#include "chrome/browser/existing_switch_flag_choices.h"
|
||||
+#include "chrome/browser/helium_flag_choices.h"
|
||||
const FeatureEntry kFeatureEntries[] = {
|
||||
#include "chrome/browser/ungoogled_flag_entries.h"
|
||||
#include "chrome/browser/bromite_flag_entries.h"
|
||||
#include "chrome/browser/ungoogled_platform_flag_entries.h"
|
||||
#include "chrome/browser/existing_switch_flag_entries.h"
|
||||
+#include "chrome/browser/helium_flag_entries.h"
|
||||
// Include generated flags for flag unexpiry; see //docs/flag_expiry.md and
|
||||
// //tools/flags/generate_unexpire_flags.py.
|
||||
#include "build/chromeos_buildflags.h"
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/channel_selection.cc
|
||||
@@ -0,0 +1,25 @@
|
||||
@@ -68,36 +54,32 @@
|
||||
+
|
||||
+} // namespace helium
|
||||
+#endif /* CHROME_BROWSER_CHANNEL_SELECTION_H_ */
|
||||
--- /dev/null
|
||||
--- a/chrome/browser/helium_flag_choices.h
|
||||
+++ b/chrome/browser/helium_flag_choices.h
|
||||
@@ -0,0 +1,18 @@
|
||||
+#ifndef CHROME_BROWSER_HELIUM_FLAG_CHOICES_H_
|
||||
+#define CHROME_BROWSER_HELIUM_FLAG_CHOICES_H_
|
||||
+
|
||||
+#include "components/webui/flags/feature_entry.h"
|
||||
+#include "chrome/browser/channel_selection.h"
|
||||
+
|
||||
+namespace helium {
|
||||
+ using namespace ::helium;
|
||||
+
|
||||
@@ -16,6 +16,12 @@ namespace helium {
|
||||
{"Disabled", kEnergySaverFrameRateCommandLine, "9001"},
|
||||
};
|
||||
|
||||
+ constexpr const FeatureEntry::Choice kChannelChoices[] = {
|
||||
+ {flags_ui::kGenericExperimentChoiceAutomatic, "", ""},
|
||||
+ {kChannelStable, kChannelCommandLine, kChannelStable},
|
||||
+ {kChannelBeta, kChannelCommandLine, kChannelBeta},
|
||||
+ };
|
||||
+
|
||||
+} // namespace helium
|
||||
+
|
||||
+#endif /* CHROME_BROWSER_HELIUM_FLAG_CHOICES_H_ */
|
||||
--- /dev/null
|
||||
} // namespace helium
|
||||
|
||||
#endif /* CHROME_BROWSER_HELIUM_FLAG_CHOICES_H_ */
|
||||
--- a/chrome/browser/helium_flag_entries.h
|
||||
+++ b/chrome/browser/helium_flag_entries.h
|
||||
@@ -0,0 +1,6 @@
|
||||
+#ifndef CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_
|
||||
+#define CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_
|
||||
@@ -1,5 +1,8 @@
|
||||
#ifndef CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_
|
||||
#define CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_
|
||||
+ {helium::kChannelCommandLine,
|
||||
+ "Update channel", "Selects which update channel to use for update checking. Helium flag.",
|
||||
+ kOsAll, MULTI_VALUE_TYPE(helium::kChannelChoices)},
|
||||
+#endif /* CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_ */
|
||||
{helium::kEnergySaverFrameRateCommandLine,
|
||||
"Maximum frame rate for Energy Saver",
|
||||
"Configures the frame rate the browser is throttled to when Energy Saver is enabled. Helium flag",
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -281,6 +281,8 @@ static_library("browser") {
|
||||
37
patches/helium/core/flags-setup.patch
Normal file
37
patches/helium/core/flags-setup.patch
Normal file
@@ -0,0 +1,37 @@
|
||||
--- a/chrome/browser/about_flags.cc
|
||||
+++ b/chrome/browser/about_flags.cc
|
||||
@@ -4733,11 +4733,13 @@ const FeatureEntry::FeatureVariation kHi
|
||||
#include "chrome/browser/bromite_flag_choices.h"
|
||||
#include "chrome/browser/ungoogled_platform_flag_choices.h"
|
||||
#include "chrome/browser/existing_switch_flag_choices.h"
|
||||
+#include "chrome/browser/helium_flag_choices.h"
|
||||
const FeatureEntry kFeatureEntries[] = {
|
||||
#include "chrome/browser/ungoogled_flag_entries.h"
|
||||
#include "chrome/browser/bromite_flag_entries.h"
|
||||
#include "chrome/browser/ungoogled_platform_flag_entries.h"
|
||||
#include "chrome/browser/existing_switch_flag_entries.h"
|
||||
+#include "chrome/browser/helium_flag_entries.h"
|
||||
// Include generated flags for flag unexpiry; see //docs/flag_expiry.md and
|
||||
// //tools/flags/generate_unexpire_flags.py.
|
||||
#include "build/chromeos_buildflags.h"
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/helium_flag_choices.h
|
||||
@@ -0,0 +1,12 @@
|
||||
+#ifndef CHROME_BROWSER_HELIUM_FLAG_CHOICES_H_
|
||||
+#define CHROME_BROWSER_HELIUM_FLAG_CHOICES_H_
|
||||
+
|
||||
+#include "components/webui/flags/feature_entry.h"
|
||||
+#include "chrome/browser/channel_selection.h"
|
||||
+
|
||||
+namespace helium {
|
||||
+ using namespace ::helium;
|
||||
+
|
||||
+} // namespace helium
|
||||
+
|
||||
+#endif /* CHROME_BROWSER_HELIUM_FLAG_CHOICES_H_ */
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/helium_flag_entries.h
|
||||
@@ -0,0 +1,3 @@
|
||||
+#ifndef CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_
|
||||
+#define CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_
|
||||
+#endif /* CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_ */
|
||||
@@ -144,7 +144,9 @@ helium/core/hide-extensions-via-toolbar-prefs.patch
|
||||
helium/core/clean-context-menu.patch
|
||||
helium/core/split-view.patch
|
||||
helium/core/fix-tab-sync-unreached-error.patch
|
||||
helium/core/add-update-channels.patch
|
||||
helium/core/flags-setup.patch
|
||||
helium/core/add-low-power-framerate-flag.patch
|
||||
helium/core/add-update-channel-flag.patch
|
||||
helium/core/add-updater-preference.patch
|
||||
|
||||
helium/settings/move-search-suggest.patch
|
||||
|
||||
Reference in New Issue
Block a user