Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2102)

Unified Diff: base/process/process_mac.cc

Issue 2914913002: [Mac] Enable AppNap for renderers (Closed)
Patch Set: Add comment for magic numbers Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process/process.h ('k') | chrome/app/helper-Info.plist » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_mac.cc
diff --git a/base/process/process_mac.cc b/base/process/process_mac.cc
index f83fbb9991e952e3859e6db9dc8811761b1ea4b0..bc045cd72aa73350f8beb39515564f85a33e34e4 100644
--- a/base/process/process_mac.cc
+++ b/base/process/process_mac.cc
@@ -8,15 +8,27 @@
#include "base/feature_list.h"
#include "base/mac/mach_logging.h"
+#include "base/metrics/field_trial_params.h"
namespace base {
+namespace {
+const char kAppNapFeatureParamName[] = "app_nap";
+}
+
// Enables backgrounding hidden renderers on Mac.
const Feature kMacAllowBackgroundingProcesses{"MacAllowBackgroundingProcesses",
FEATURE_DISABLED_BY_DEFAULT};
+bool Process::IsAppNapEnabled() {
+ return !base::GetFieldTrialParamValueByFeature(
+ kMacAllowBackgroundingProcesses, kAppNapFeatureParamName)
+ .empty();
+}
+
bool Process::CanBackgroundProcesses() {
- return FeatureList::IsEnabled(kMacAllowBackgroundingProcesses);
+ return FeatureList::IsEnabled(kMacAllowBackgroundingProcesses) &&
+ !IsAppNapEnabled();
}
bool Process::IsProcessBackgrounded(PortProvider* port_provider) const {
« no previous file with comments | « base/process/process.h ('k') | chrome/app/helper-Info.plist » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698