Bug 1382649 - Unset dom.ipc.processCount pref value should be taken as a user opt-in value if browser.preferences.defaultPerformanceSettings.enabled is false. r=mrbkap, a=jcristau
authorTimothy Guan-tin Chien <timdream@gmail.com>
Fri, 21 Jul 2017 11:48:07 +0800
changeset 414444 78829e0f0362bcfdcceb7cef5ba163d16e2e643e
parent 414443 650bd331efd05fc5f26dae3e1d0b6e1ec4d3008a
child 414445 162941857ff4c933642a064f17beebe33257b8a1
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap, jcristau
bugs1382649
milestone55.0
Bug 1382649 - Unset dom.ipc.processCount pref value should be taken as a user opt-in value if browser.preferences.defaultPerformanceSettings.enabled is false. r=mrbkap, a=jcristau MozReview-Commit-ID: 5zSix0koTc4
browser/extensions/e10srollout/bootstrap.js
toolkit/xre/nsAppRunner.cpp
--- a/browser/extensions/e10srollout/bootstrap.js
+++ b/browser/extensions/e10srollout/bootstrap.js
@@ -68,16 +68,17 @@ const PREF_E10S_OPTED_IN       = "browse
 const PREF_E10S_FORCE_ENABLED  = "browser.tabs.remote.force-enable";
 const PREF_E10S_FORCE_DISABLED = "browser.tabs.remote.force-disable";
 const PREF_TOGGLE_E10S         = "browser.tabs.remote.autostart.2";
 const PREF_E10S_ADDON_POLICY   = "extensions.e10s.rollout.policy";
 const PREF_E10S_ADDON_BLOCKLIST = "extensions.e10s.rollout.blocklist";
 const PREF_E10S_HAS_NONEXEMPT_ADDON = "extensions.e10s.rollout.hasAddon";
 const PREF_E10S_MULTI_OPTOUT   = "dom.ipc.multiOptOut";
 const PREF_E10S_PROCESSCOUNT   = "dom.ipc.processCount";
+const PREF_USE_DEFAULT_PERF_SETTINGS = "browser.preferences.defaultPerformanceSettings.enabled";
 const PREF_E10S_MULTI_ADDON_BLOCKS = "extensions.e10sMultiBlocksEnabling";
 const PREF_E10S_MULTI_BLOCKED_BY_ADDONS = "extensions.e10sMultiBlockedByAddons";
 
 function startup() {
   // In theory we only need to run this once (on install()), but
   // it's better to also run it on every startup. If the user has
   // made manual changes to the prefs, this will keep the data
   // reported more accurate.
@@ -250,17 +251,18 @@ function setCohort(cohortName) {
       Services.appinfo.QueryInterface(Ci.nsICrashReporter).annotateCrashReport("E10SCohort", cohortName);
     }
   } catch (e) {}
 }
 
 function optedIn() {
   let e10s = Preferences.get(PREF_E10S_OPTED_IN, false) ||
              Preferences.get(PREF_E10S_FORCE_ENABLED, false);
-  let multi = Preferences.isSet(PREF_E10S_PROCESSCOUNT);
+  let multi = Preferences.isSet(PREF_E10S_PROCESSCOUNT) ||
+             !Preferences.get(PREF_USE_DEFAULT_PERF_SETTINGS, true);
   return { e10s, multi };
 }
 
 function optedOut() {
   // Users can also opt-out by toggling back the pref to false.
   // If they reset the pref instead they might be re-enabled if
   // they are still part of the threshold.
   let e10s = Preferences.get(PREF_E10S_FORCE_DISABLED, false) ||
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -5145,21 +5145,26 @@ GetMaxWebProcessCount()
   // introducing multiple prefs a la the autostart.N prefs.
   if (Preferences::GetInt("dom.ipc.multiOptOut", 0) >=
           nsIXULRuntime::E10S_MULTI_EXPERIMENT) {
     return 1;
   }
 
   const char* optInPref = "dom.ipc.processCount";
   uint32_t optInPrefValue = Preferences::GetInt(optInPref, 1);
-
-  // If the user has set dom.ipc.processCount, respect their decision
-  // regardless of add-ons that might affect their experience or experiment
-  // cohort.
-  if (Preferences::HasUserValue(optInPref)) {
+  const char* useDefaultPerformanceSettings =
+    "browser.preferences.defaultPerformanceSettings.enabled";
+  bool useDefaultPerformanceSettingsValue =
+    Preferences::GetBool(useDefaultPerformanceSettings, true);
+
+  // If the user has set dom.ipc.processCount, or if they have opt out of
+  // default performances settings from about:preferences, respect their
+  // decision regardless of add-ons that might affect their experience or
+  // experiment cohort.
+  if (Preferences::HasUserValue(optInPref) || !useDefaultPerformanceSettingsValue) {
     return std::max(1u, optInPrefValue);
   }
 
   if (Preferences::HasUserValue("dom.ipc.processCount.web")) {
     // The user didn't opt in or out so read the .web version of the pref.
     return std::max(1, Preferences::GetInt("dom.ipc.processCount.web", 1));
   }
   return optInPrefValue;