Disabled "Terminate" button in about:support if no GPU process is running. (bug 1331818, r=gwright)
☠☠ backed out by dde8ef8cf38e ☠ ☠
authorDavid Anderson <danderson@mozilla.com>
Tue, 07 Feb 2017 00:48:59 -0800
changeset 341177 959e338a566a64a8c268f72d7f1ada2d2b184468
parent 341176 9f2ed9ef1d89012f5f95639deee327ea24cf3be4
child 341178 2d01a306f0f424783e36b79cbb83662243569af8
push id86653
push userdanderson@mozilla.com
push dateTue, 07 Feb 2017 18:19:01 +0000
treeherdermozilla-inbound@959e338a566a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgwright
bugs1331818
milestone54.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
Disabled "Terminate" button in about:support if no GPU process is running. (bug 1331818, r=gwright)
gfx/ipc/GPUProcessManager.cpp
toolkit/content/aboutSupport.js
--- a/gfx/ipc/GPUProcessManager.cpp
+++ b/gfx/ipc/GPUProcessManager.cpp
@@ -151,16 +151,20 @@ GPUProcessManager::DisableGPUProcess(con
     return;
   }
 
   gfxConfig::SetFailed(Feature::GPU_PROCESS, FeatureStatus::Failed, aMessage);
   gfxCriticalNote << aMessage;
 
   DestroyProcess();
   ShutdownVsyncIOThread();
+
+  if (nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService()) {
+    obs->NotifyObservers(nullptr, "gpu-process:disabled", nullptr);
+  }
 }
 
 void
 GPUProcessManager::EnsureGPUReady()
 {
   if (mProcess && !mProcess->IsConnected()) {
     if (!mProcess->WaitForLaunch()) {
       // If this fails, we should have fired OnProcessLaunchComplete and
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -292,16 +292,30 @@ var snapshotFormatters = {
 
       if (gpuProcessPid != -1) {
         let gpuProcessKillButton = $.new("button");
 
         gpuProcessKillButton.addEventListener("click", function() {
           windowUtils.terminateGPUProcess();
         });
 
+        let removeObserver = function() {
+          if (listener !== null) {
+            Services.obs.removeObserver(listener, "gpu-process:disabled");
+            listener = null;
+          }
+        };
+        let listener = function(subject, topic) {
+          gpuProcessKillButton.disabled = true;
+          removeObserver();
+        };
+
+        Services.obs.addObserver(listener, "gpu-process:disabled", false);
+        window.addEventListener("unload", removeObserver);
+
         gpuProcessKillButton.textContent = strings.GetStringFromName("gpuProcessKillButton");
         addRow("diagnostics", "GPUProcessPid", gpuProcessPid);
         addRow("diagnostics", "GPUProcess", [gpuProcessKillButton]);
       }
     }
 
     // graphics-failures-tbody tbody
     if ("failures" in data) {