Disabled "Terminate" button in about:support if no GPU process is running. (bug 1331818, r=gwright)

--HG--
extra : rebase_source : c8b78efb9ba542cad08ace044fa1124f284eb2e9
This commit is contained in:
David Anderson 2017-02-07 00:48:59 -08:00
parent fdb497ba5d
commit 5c8e4bed65
2 changed files with 18 additions and 0 deletions

View File

@ -156,6 +156,10 @@ GPUProcessManager::DisableGPUProcess(const char* aMessage)
DestroyProcess();
ShutdownVsyncIOThread();
if (nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService()) {
obs->NotifyObservers(nullptr, "gpu-process:disabled", nullptr);
}
}
void

View File

@ -297,6 +297,20 @@ var snapshotFormatters = {
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]);