Bug 1382649 - Take the process count value set by e10s rollout as the default in the about:preferences UI, r=evanxd,jaws,mrbkap
authorTimothy Guan-tin Chien <timdream@gmail.com>
Fri, 21 Jul 2017 12:42:19 +0800
changeset 419434 e2089c0f89cd02481e565ae6be028dce1aa6377b
parent 419433 ce12a37d69269d47680b5e0a3169a4601672b0b8
child 419435 c48bb95530b16c70ab078e3fa55a2770aa8bf39b
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevanxd, jaws, mrbkap
bugs1382649
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382649 - Take the process count value set by e10s rollout as the default in the about:preferences UI, r=evanxd,jaws,mrbkap When the user sets browser.preferences.defaultPerformanceSettings.enabled to false and want to set custom process count, we want to offer the process count value given by e10s rollout add-on as the default, instead of the default value of dom.ipc.processCount. MozReview-Commit-ID: 1hXWHA9j4xw
browser/components/preferences/in-content-new/main.js
browser/components/preferences/in-content-new/main.xul
browser/components/preferences/in-content/main.js
browser/components/preferences/in-content/main.xul
--- a/browser/components/preferences/in-content-new/main.js
+++ b/browser/components/preferences/in-content-new/main.js
@@ -1113,36 +1113,49 @@ var gMainPane = {
       defaultPerformancePref.value = false;
     }
   },
 
   updatePerformanceSettingsBox() {
     let defaultPerformancePref =
       document.getElementById("browser.preferences.defaultPerformanceSettings.enabled");
     let performanceSettings = document.getElementById("performanceSettings");
+    let processCountPref = document.getElementById("dom.ipc.processCount");
     if (defaultPerformancePref.value) {
-      let processCountPref = document.getElementById("dom.ipc.processCount");
       let accelerationPref = document.getElementById("layers.acceleration.disabled");
+      // Unset the value so process count will be decided by e10s rollout.
       processCountPref.value = processCountPref.defaultValue;
       accelerationPref.value = accelerationPref.defaultValue;
       performanceSettings.hidden = true;
     } else {
+      let e10sRolloutProcessCountPref =
+        document.getElementById("dom.ipc.processCount.web");
+      // Take the e10s rollout value as the default value (if it exists),
+      // but don't overwrite the user set value.
+      if (e10sRolloutProcessCountPref.value &&
+          processCountPref.value == processCountPref.defaultValue) {
+        processCountPref.value = e10sRolloutProcessCountPref.value;
+      }
       performanceSettings.hidden = false;
     }
   },
 
   buildContentProcessCountMenuList() {
     if (gMainPane.isE10SEnabled()) {
       let processCountPref = document.getElementById("dom.ipc.processCount");
+      let e10sRolloutProcessCountPref =
+        document.getElementById("dom.ipc.processCount.web");
+      let defaultProcessCount =
+        e10sRolloutProcessCountPref.value || processCountPref.defaultValue;
       let bundlePreferences = document.getElementById("bundlePreferences");
       let label = bundlePreferences.getFormattedString("defaultContentProcessCount",
-        [processCountPref.defaultValue]);
+        [defaultProcessCount]);
       let contentProcessCount =
         document.querySelector(`#contentProcessCount > menupopup >
-                                menuitem[value="${processCountPref.defaultValue}"]`);
+                                menuitem[value="${defaultProcessCount}"]`);
       contentProcessCount.label = label;
 
       document.getElementById("limitContentProcess").disabled = false;
       document.getElementById("contentProcessCount").disabled = false;
       document.getElementById("contentProcessCountEnabledDescription").hidden = false;
       document.getElementById("contentProcessCountDisabledDescription").hidden = true;
     } else {
       document.getElementById("limitContentProcess").disabled = true;
--- a/browser/components/preferences/in-content-new/main.xul
+++ b/browser/components/preferences/in-content-new/main.xul
@@ -179,16 +179,20 @@
   <preference id="browser.preferences.defaultPerformanceSettings.enabled"
               name="browser.preferences.defaultPerformanceSettings.enabled"
               type="bool"/>
 
   <preference id="dom.ipc.processCount"
               name="dom.ipc.processCount"
               type="int"/>
 
+  <preference id="dom.ipc.processCount.web"
+              name="dom.ipc.processCount.web"
+              type="int"/>
+
   <preference id="layers.acceleration.disabled"
               name="layers.acceleration.disabled"
               type="bool"
               inverted="true"/>
 
   <!-- Files and Applications -->
   <preference id="browser.feeds.handler"
               name="browser.feeds.handler"
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -424,36 +424,49 @@ var gMainPane = {
       defaultPerformancePref.value = false;
     }
   },
 
   updatePerformanceSettingsBox() {
     let defaultPerformancePref =
       document.getElementById("browser.preferences.defaultPerformanceSettings.enabled");
     let performanceSettings = document.getElementById("performanceSettings");
+    let processCountPref = document.getElementById("dom.ipc.processCount");
     if (defaultPerformancePref.value) {
-      let processCountPref = document.getElementById("dom.ipc.processCount");
       let accelerationPref = document.getElementById("layers.acceleration.disabled");
+      // Unset the value so process count will be decided by e10s rollout.
       processCountPref.value = processCountPref.defaultValue;
       accelerationPref.value = accelerationPref.defaultValue;
       performanceSettings.hidden = true;
     } else {
+      let e10sRolloutProcessCountPref =
+        document.getElementById("dom.ipc.processCount.web");
+      // Take the e10s rollout value as the default value (if it exists),
+      // but don't overwrite the user set value.
+      if (e10sRolloutProcessCountPref.value &&
+          processCountPref.value == processCountPref.defaultValue) {
+        processCountPref.value = e10sRolloutProcessCountPref.value;
+      }
       performanceSettings.hidden = false;
     }
   },
 
   buildContentProcessCountMenuList() {
     if (gMainPane.isE10SEnabled()) {
       let processCountPref = document.getElementById("dom.ipc.processCount");
+      let e10sRolloutProcessCountPref =
+        document.getElementById("dom.ipc.processCount.web");
+      let defaultProcessCount =
+        e10sRolloutProcessCountPref.value || processCountPref.defaultValue;
       let bundlePreferences = document.getElementById("bundlePreferences");
       let label = bundlePreferences.getFormattedString("defaultContentProcessCount",
-        [processCountPref.defaultValue]);
+        [defaultProcessCount]);
       let contentProcessCount =
         document.querySelector(`#contentProcessCount > menupopup >
-                                menuitem[value="${processCountPref.defaultValue}"]`);
+                                menuitem[value="${defaultProcessCount}"]`);
       contentProcessCount.label = label;
 
       document.getElementById("limitContentProcess").disabled = false;
       document.getElementById("contentProcessCount").disabled = false;
       document.getElementById("contentProcessCountEnabledDescription").hidden = false;
       document.getElementById("contentProcessCountDisabledDescription").hidden = true;
     } else {
       document.getElementById("limitContentProcess").disabled = true;
--- a/browser/components/preferences/in-content/main.xul
+++ b/browser/components/preferences/in-content/main.xul
@@ -114,16 +114,20 @@
   <preference id="browser.preferences.defaultPerformanceSettings.enabled"
               name="browser.preferences.defaultPerformanceSettings.enabled"
               type="bool"/>
 
   <preference id="dom.ipc.processCount"
               name="dom.ipc.processCount"
               type="int"/>
 
+  <preference id="dom.ipc.processCount.web"
+              name="dom.ipc.processCount.web"
+              type="int"/>
+
   <preference id="layers.acceleration.disabled"
               name="layers.acceleration.disabled"
               type="bool"
               inverted="true"/>
 </preferences>
 
 <hbox id="header-general"
       class="header"