Bug 1505322 - Display a breakdown of remote processes in about:support. r=mconley,flod
authorFelipe Gomes <felipc@gmail.com>
Sat, 06 Apr 2019 05:49:47 +0000
changeset 468278 6b15d6c337b39b7a6ed533525fe1a565c818031d
parent 468277 57c5d5e19c71138889753f5e96c9e198f814cc90
child 468279 7e40ec0c948d98106fcb558c7650889f10f399a7
push id35826
push usernerli@mozilla.com
push dateSat, 06 Apr 2019 21:48:00 +0000
treeherdermozilla-central@dc53fe5c9ced [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, flod
bugs1505322
milestone68.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 1505322 - Display a breakdown of remote processes in about:support. r=mconley,flod Differential Revision: https://phabricator.services.mozilla.com/D26015
toolkit/content/aboutSupport.js
toolkit/content/aboutSupport.xhtml
toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
toolkit/locales/en-US/toolkit/global/processTypes.ftl
toolkit/modules/Troubleshoot.jsm
toolkit/modules/tests/browser/browser_Troubleshoot.js
toolkit/themes/shared/aboutSupport.css
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -88,24 +88,16 @@ var snapshotFormatters = {
     document.l10n.setAttributes($("multiprocess-box-process-count"),
                                 "multi-process-windows",
                                 {
                                   remoteWindows: data.numRemoteWindows,
                                   totalWindows: data.numTotalWindows,
                                 });
     document.l10n.setAttributes($("multiprocess-box-status"), statusTextId);
 
-    if (data.remoteAutoStart) {
-      $("contentprocesses-box").textContent = data.currentContentProcesses +
-                                              "/" +
-                                              data.maxContentProcesses;
-    } else {
-      $("contentprocesses-row").hidden = true;
-    }
-
     if (Services.policies) {
       let policiesStrId = "";
       let aboutPolicies = "about:policies";
       switch (data.policiesStatus) {
         case Services.policies.INACTIVE:
           policiesStrId = "policies-inactive";
           break;
 
@@ -226,16 +218,42 @@ var snapshotFormatters = {
       return $.new("tr", [
         $.new("td", feature.name),
         $.new("td", feature.version),
         $.new("td", feature.id),
       ]);
     }));
   },
 
+  async processes(data) {
+    async function buildEntry(name, value) {
+      let entryName = (await document.l10n.formatValue(`process-type-${name.toLowerCase()}`))
+                      || name;
+
+      $("processes-tbody").appendChild($.new("tr", [
+        $.new("td", entryName),
+        $.new("td", value),
+      ]));
+    }
+
+    let remoteProcessesCount = Object.values(data.remoteTypes).reduce((a, b) => a + b, 0);
+    document.querySelector("#remoteprocesses-row a").textContent = remoteProcessesCount;
+
+    // Display the regular "web" process type first in the list,
+    // and with special formatting.
+    if (data.remoteTypes.web) {
+      await buildEntry("web", `${data.remoteTypes.web} / ${data.maxWebContentProcesses}`);
+      delete data.remoteTypes.web;
+    }
+
+    for (let remoteProcessType in data.remoteTypes) {
+      await buildEntry(remoteProcessType, data.remoteTypes[remoteProcessType]);
+    }
+  },
+
   modifiedPreferences(data) {
     $.append($("prefs-tbody"), sortedArrayFromObject(data).map(
       function([name, value]) {
         return $.new("tr", [
           $.new("td", name, "pref-name"),
           // Very long preference values can cause users problems when they
           // copy and paste them into some text editors.  Long values generally
           // aren't useful anyway, so truncate them to a reasonable length.
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -18,16 +18,17 @@
     <link rel="stylesheet" href="chrome://global/skin/aboutSupport.css"
           type="text/css"/>
 
     <script type="application/javascript"
             src="chrome://global/content/aboutSupport.js"/>
     <link rel="localization" href="branding/brand.ftl"/>
     <link rel="localization" href="toolkit/about/aboutSupport.ftl"/>
     <link rel="localization" href="toolkit/global/resetProfile.ftl"/>
+    <link rel="localization" href="toolkit/global/processTypes.ftl"/>
   </head>
 
   <body class="wide-container">
 
 #ifndef ANDROID
     <div id="action-box" class="notice-box">
       <div id="reset-box">
         <h3 data-l10n-id="refresh-profile"/>
@@ -174,20 +175,21 @@
             <th class="column" data-l10n-id="app-basics-multi-process-support"/>
 
             <td id="multiprocess-box">
               <span id="multiprocess-box-process-count"/>
               <span id="multiprocess-box-status"/>
             </td>
           </tr>
 
-          <tr id="contentprocesses-row">
-            <th class="column" data-l10n-id="app-basics-process-count"/>
+          <tr id="remoteprocesses-row">
+            <th class="column" data-l10n-id="app-basics-remote-processes-count"/>
 
-            <td id="contentprocesses-box">
+            <td>
+              <a href="#remote-processes"></a>
             </td>
           </tr>
 
           <tr id="policies-status-row">
             <th class="column" data-l10n-id="app-basics-enterprise-policies"/>
 
             <td id="policies-status">
             </td>
@@ -255,30 +257,45 @@
       </p>
       <p id="crashes-noConfig" class="hidden no-copy" data-l10n-id="crashes-no-config"/>
 
 #endif
       <!-- - - - - - - - - - - - - - - - - - - - - -->
 
       <h2 class="major-section" data-l10n-id="features-title"/>
 
-      <table>
+      <table id="features-table">
         <thead>
           <tr>
             <th data-l10n-id="features-name"/>
             <th data-l10n-id="features-version"/>
             <th data-l10n-id="features-id"/>
           </tr>
         </thead>
         <tbody id="features-tbody">
         </tbody>
       </table>
 
       <!-- - - - - - - - - - - - - - - - - - - - - -->
 
+      <h2 class="major-section" data-l10n-id="processes-title" id="remote-processes"/>
+
+      <table id="remote-processes-table">
+        <thead>
+          <tr>
+            <th data-l10n-id="processes-type"/>
+            <th data-l10n-id="processes-count"/>
+          </tr>
+        </thead>
+        <tbody id="processes-tbody">
+        </tbody>
+      </table>
+
+      <!-- - - - - - - - - - - - - - - - - - - - - -->
+
       <h2 class="major-section" data-l10n-id="extensions-title"/>
 
       <table>
         <thead>
           <tr>
             <th data-l10n-id="extensions-name"/>
             <th data-l10n-id="extensions-version"/>
             <th data-l10n-id="extensions-enabled"/>
--- a/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
+++ b/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
@@ -23,16 +23,19 @@ security-software-type = Type
 security-software-name = Name
 security-software-antivirus = Antivirus
 security-software-antispyware = Antispyware
 security-software-firewall = Firewall
 features-title = { -brand-short-name } Features
 features-name = Name
 features-version = Version
 features-id = ID
+processes-title = Remote Processes
+processes-type = Type
+processes-count = Count
 app-basics-title = Application Basics
 app-basics-name = Name
 app-basics-version = Version
 app-basics-build-id = Build ID
 app-basics-update-channel = Update Channel
 app-basics-update-history = Update History
 app-basics-show-update-history = Show Update History
 app-basics-profile-dir =
@@ -45,17 +48,17 @@ app-basics-build-config = Build Configur
 app-basics-user-agent = User Agent
 app-basics-os = OS
 app-basics-memory-use = Memory Use
 app-basics-performance = Performance
 app-basics-service-workers = Registered Service Workers
 app-basics-profiles = Profiles
 app-basics-launcher-process-status = Launcher Process
 app-basics-multi-process-support = Multiprocess Windows
-app-basics-process-count = Web Content Processes
+app-basics-remote-processes-count = Remote Processes
 app-basics-enterprise-policies = Enterprise Policies
 app-basics-location-service-key-google = Google Location Service Key
 app-basics-safebrowsing-key-google = Google Safebrowsing Key
 app-basics-key-mozilla = Mozilla Location Service Key
 app-basics-safe-mode = Safe Mode
 show-dir-label =
     { PLATFORM() ->
         [macos] Show in Finder
new file mode 100644
--- /dev/null
+++ b/toolkit/locales/en-US/toolkit/global/processTypes.ftl
@@ -0,0 +1,22 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# 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/.
+
+process-type-web = Web Content
+
+# process used to run privileged pages,
+# such as about:home
+process-type-privileged = Privileged Content
+
+process-type-extension = Extension
+
+# process used to open file:// URLs
+process-type-file = Local File
+
+# process used to isolate webpages that requested special
+# permission to allocate large amounts of memory
+process-type-weblargeallocation = Large Allocation
+
+# process used to communicate with the GPU for
+# graphics acceleration
+process-type-gpu = GPU
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -200,23 +200,16 @@ var dataProviders = {
     }
 
     try {
       data.launcherProcessState = Services.appinfo.launcherProcessState;
     } catch (e) {}
 
     data.remoteAutoStart = Services.appinfo.browserTabsRemoteAutostart;
 
-    // Services.ppmm.childCount is a count of how many processes currently
-    // exist that might respond to messages sent through the ppmm, including
-    // the parent process. So we subtract the parent process with the "- 1",
-    // and that’s how many content processes we’re waiting for.
-    data.currentContentProcesses = Services.ppmm.childCount - 1;
-    data.maxContentProcesses = Services.appinfo.maxWebProcessCount;
-
     try {
       let e10sStatus = Cc["@mozilla.org/supports-PRUint64;1"]
                          .createInstance(Ci.nsISupportsPRUint64);
       let appinfo = Services.appinfo.QueryInterface(Ci.nsIObserver);
       appinfo.observe(e10sStatus, "getE10SBlocked", "");
       data.autoStartStatus = e10sStatus.data;
     } catch (e) {
       data.autoStartStatus = -1;
@@ -303,16 +296,53 @@ var dataProviders = {
     done(features.map(function(f) {
       return props.reduce(function(fData, prop) {
         fData[prop] = f[prop];
         return fData;
       }, {});
     }));
   },
 
+  processes: function processes(done) {
+    let remoteTypes = {};
+
+    for (let i = 0; i < Services.ppmm.childCount; i++) {
+      let remoteType;
+      try {
+        remoteType = Services.ppmm.getChildAt(i).remoteType;
+      } catch (e) {}
+
+      // The parent process is also managed by the ppmm (because
+      // of non-remote tabs), but it doesn't have a remoteType.
+      if (!remoteType) {
+        continue;
+      }
+
+      if (remoteTypes[remoteType]) {
+        remoteTypes[remoteType]++;
+      } else {
+        remoteTypes[remoteType] = 1;
+      }
+    }
+
+    try {
+      let winUtils = Services.wm.getMostRecentWindow("").windowUtils;
+      if (winUtils.gpuProcessId != -1) {
+        remoteTypes.gpu = 1;
+      }
+    } catch (e) {}
+
+    let data = {
+      remoteTypes,
+      maxWebContentProcesses: Services.appinfo.maxWebProcessCount,
+    };
+
+    done(data);
+  },
+
   modifiedPreferences: function modifiedPreferences(done) {
     done(getPrefList(name => Services.prefs.prefHasUserValue(name)));
   },
 
   lockedPreferences: function lockedPreferences(done) {
     done(getPrefList(name => Services.prefs.prefIsLocked(name)));
   },
 
--- a/toolkit/modules/tests/browser/browser_Troubleshoot.js
+++ b/toolkit/modules/tests/browser/browser_Troubleshoot.js
@@ -135,22 +135,16 @@ const SNAPSHOT_SCHEMA = {
           type: "number",
         },
         numTotalWindows: {
           type: "number",
         },
         numRemoteWindows: {
           type: "number",
         },
-        currentContentProcesses: {
-          type: "number",
-        },
-        maxContentProcesses: {
-          type: "number",
-        },
         policiesStatus: {
           type: "number",
         },
         keyLocationServiceGoogleFound: {
           type: "boolean",
         },
         keySafebrowsingGoogleFound: {
           type: "boolean",
@@ -253,16 +247,30 @@ const SNAPSHOT_SCHEMA = {
           },
           id: {
             required: true,
             type: "string",
           },
         },
       },
     },
+    processes: {
+      required: true,
+      type: "object",
+      properties: {
+        maxWebContentProcesses: {
+          required: true,
+          type: "number",
+        },
+        remoteTypes: {
+          required: true,
+          type: "object",
+        },
+      },
+    },
     modifiedPreferences: {
       required: true,
       type: "object",
     },
     lockedPreferences: {
       required: true,
       type: "object",
     },
--- a/toolkit/themes/shared/aboutSupport.css
+++ b/toolkit/themes/shared/aboutSupport.css
@@ -45,16 +45,29 @@ td.integer {
 }
 
 .pref-value {
   width: 30%;
   white-space: nowrap;
   overflow: hidden;
 }
 
+#crashes-table th:first-child {
+  width: 50%;
+}
+
+#features-table th:first-child,
+#remote-processes-table th:first-child {
+  width: 30%;
+}
+
+#features-table th:nth-child(2) {
+  width: 20%;
+}
+
 #action-box {
   float: right;
   margin-top: 2em;
   margin-bottom: 20px;
   margin-inline-start: 20px;
   margin-inline-end: 0;
   width: 30%;
 }