Bug 1349363 - Use a centralized function to tell if e10s-multi is on. r=Felipe draft
authorBlake Kaplan <mrbkap@gmail.com>
Mon, 17 Apr 2017 14:58:52 -0700
changeset 564565 e60ef55ff64e3e74ee23b0bd77ef0e0bcc0c6c3a
parent 564564 6a0541ec0e0c613a4eafa4e8e3729dcda1f3f8cf
child 564566 d74358832040b3862d8e96ed5d311326a2b99825
push id54642
push userbmo:mrbkap@mozilla.com
push dateTue, 18 Apr 2017 19:22:13 +0000
reviewersFelipe
bugs1349363
milestone55.0a1
Bug 1349363 - Use a centralized function to tell if e10s-multi is on. r=Felipe MozReview-Commit-ID: JQJtCanIv3a
browser/base/content/tabbrowser.xml
devtools/client/aboutdebugging/components/workers/multi-e10s-warning.js
devtools/client/aboutdebugging/components/workers/panel.js
dom/base/ProcessSelector.js
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -4893,17 +4893,17 @@
               label = this.mStringBundle.getString(stringID);
             }
           } else {
             label = tab.getAttribute("label");
             if (AppConstants.E10S_TESTING_ONLY &&
                 tab.linkedBrowser &&
                 tab.linkedBrowser.isRemoteBrowser) {
               label += " - e10s";
-              if (Services.prefs.getIntPref("dom.ipc.processCount") > 1) {
+              if (Services.appinfo.maxWebProcessCount > 1) {
                 label += " (" + tab.linkedBrowser.frameLoader.tabParent.osPid + ")";
               }
             }
             if (tab.userContextId) {
               label = this.mStringBundle.getFormattedString("tabs.containers.tooltip", [label, ContextualIdentityService.getUserContextLabel(tab.userContextId)]);
             }
           }
 
--- a/devtools/client/aboutdebugging/components/workers/multi-e10s-warning.js
+++ b/devtools/client/aboutdebugging/components/workers/multi-e10s-warning.js
@@ -15,25 +15,27 @@ const { Ci } = require("chrome");
 
 loader.lazyImporter(this, "PrivateBrowsingUtils",
   "resource://gre/modules/PrivateBrowsingUtils.jsm");
 
 loader.lazyRequireGetter(this, "DebuggerClient",
   "devtools/shared/client/main", true);
 
 const Strings = Services.strings.createBundle("chrome://devtools/locale/aboutdebugging.properties");
-const PROCESS_COUNT_PREF = "dom.ipc.processCount";
+const MULTI_OPT_OUT_PREF = "dom.ipc.multiOptOut";
 
 module.exports = createClass({
   displayName: "multiE10SWarning",
 
   onUpdatePreferenceClick() {
     let message = Strings.GetStringFromName("multiProcessWarningConfirmUpdate");
     if (window.confirm(message)) {
-      Services.prefs.setIntPref(PROCESS_COUNT_PREF, 1);
+      // Disable multi until at least the next experiment.
+      Services.prefs.setIntPref(MULTI_OPT_OUT_PREF,
+                                Services.appinfo.E10S_MULTI_EXPERIMENT);
       // Restart the browser.
       Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
     }
   },
 
   render() {
     return dom.div(
       {
--- a/devtools/client/aboutdebugging/components/workers/panel.js
+++ b/devtools/client/aboutdebugging/components/workers/panel.js
@@ -70,17 +70,19 @@ module.exports = createClass({
     client.removeListener("serviceWorkerRegistrationListChanged", this.updateWorkers);
     client.removeListener("workerListChanged", this.updateWorkers);
     client.removeListener("registration-changed", this.updateWorkers);
 
     Services.prefs.removeObserver(PROCESS_COUNT_PREF, this.updateMultiE10S);
   },
 
   updateMultiE10S() {
-    let processCount = Services.prefs.getIntPref(PROCESS_COUNT_PREF);
+    // We watch the pref but set the state based on
+    // nsIXULRuntime::maxWebProcessCount.
+    let processCount = Services.appinfo.maxWebProcessCount;
     this.setState({ processCount });
   },
 
   updateWorkers() {
     let workers = this.getInitialState().workers;
 
     getWorkerForms(this.props.client).then(forms => {
       forms.registrations.forEach(form => {
--- a/dom/base/ProcessSelector.js
+++ b/dom/base/ProcessSelector.js
@@ -2,19 +2,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import('resource://gre/modules/Services.jsm');
 
-const BASE_PREF = "dom.ipc.processCount"
-const PREF_BRANCH = BASE_PREF + ".";
-
 // Fills up aProcesses until max and then selects randomly from the available
 // ones.
 function RandomSelector() {
 }
 
 RandomSelector.prototype = {
   classID:          Components.ID("{c616fcfd-9737-41f1-aa74-cee72a38f91b}"),
   QueryInterface:   XPCOMUtils.generateQI([Ci.nsIContentProcessProvider]),