diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 65186d8769e8..56619a7f4249 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1443,6 +1443,15 @@ pref("devtools.performance.ui.show-idle-blocks", true); pref("devtools.performance.ui.enable-memory", false); pref("devtools.performance.ui.enable-framerate", true); pref("devtools.performance.ui.show-jit-optimizations", false); +// If in aurora (40.0, will revert for 40.1), set default +// to retro mode. +// TODO bug 1160313 +#if MOZ_UPDATE_CHANNEL == aurora + pref("devtools.performance.ui.retro-mode", true); +#else + pref("devtools.performance.ui.retro-mode", false); +#endif + // The default cache UI setting pref("devtools.cache.disabled", false); diff --git a/browser/devtools/performance/modules/graphs.js b/browser/devtools/performance/modules/graphs.js index fa23b22c2064..a71b2f13f591 100644 --- a/browser/devtools/performance/modules/graphs.js +++ b/browser/devtools/performance/modules/graphs.js @@ -26,6 +26,9 @@ loader.lazyRequireGetter(this, "MarkersOverview", loader.lazyRequireGetter(this, "EventEmitter", "devtools/toolkit/event-emitter"); +// TODO get rid of retro mode in bug 1160313 +loader.lazyRequireGetter(this, "Services"); + /** * For line graphs */ @@ -165,6 +168,24 @@ const GRAPH_DEFINITIONS = { } }; +// TODO get rid of retro mode in bug 1160313 +const GRAPH_DEFINITIONS_RETRO = { + memory: { + constructor: MemoryGraph, + selector: "#memory-overview", + }, + framerate: { + constructor: FramerateGraph, + selector: "#time-framerate", + needsBlueprints: true, + primaryLink: true + }, + timeline: { + constructor: TimelineGraph, + selector: "#markers-overview", + } +}; + /** * A controller for orchestrating the performance's tool overview graphs. Constructs, * syncs, toggles displays and defines the memory, framerate and timeline view. @@ -177,7 +198,9 @@ const GRAPH_DEFINITIONS = { function GraphsController ({ definition, root, getBlueprint, getTheme }) { this._graphs = {}; this._enabled = new Set(); - this._definition = definition || GRAPH_DEFINITIONS; + // TODO get rid of retro mode in bug 1160313 + let RETRO_MODE = Services.prefs.getBoolPref("devtools.performance.ui.retro-mode"); + this._definition = definition || (RETRO_MODE ? GRAPH_DEFINITIONS_RETRO : GRAPH_DEFINITIONS); this._root = root; this._getBlueprint = getBlueprint; this._getTheme = getTheme; diff --git a/browser/devtools/performance/performance-controller.js b/browser/devtools/performance/performance-controller.js index b3a6629e6619..3a5e8864e574 100644 --- a/browser/devtools/performance/performance-controller.js +++ b/browser/devtools/performance/performance-controller.js @@ -284,11 +284,16 @@ let PerformanceController = { * when the front has started to record. */ startRecording: Task.async(function *() { + // Store retro-mode here so we can easily list true/false + // values for reverting. + // TODO bug 1160313 + let superMode = !this.getOption("retro-mode"); + let options = { - withMarkers: true, - withMemory: this.getOption("enable-memory"), + withMarkers: superMode ? true : false, + withMemory: superMode ? this.getOption("enable-memory") : false, withTicks: this.getOption("enable-framerate"), - withAllocations: this.getOption("enable-memory"), + withAllocations: superMode ? this.getOption("enable-memory") : false, allocationsSampleProbability: this.getPref("memory-sample-probability"), allocationsMaxLogLength: this.getPref("memory-max-log-length"), bufferSize: this.getPref("profiler-buffer-size"), diff --git a/browser/devtools/performance/test/browser.ini b/browser/devtools/performance/test/browser.ini index e090b38a27e7..a4dcae350106 100644 --- a/browser/devtools/performance/test/browser.ini +++ b/browser/devtools/performance/test/browser.ini @@ -124,3 +124,5 @@ support-files = [browser_profiler_tree-view-08.js] [browser_timeline_blueprint.js] [browser_timeline_filters.js] +# remove in bug 1160313 +[browser_retro-test.js] diff --git a/browser/devtools/performance/test/browser_retro-test.js b/browser/devtools/performance/test/browser_retro-test.js new file mode 100644 index 000000000000..ad8265eca4fa --- /dev/null +++ b/browser/devtools/performance/test/browser_retro-test.js @@ -0,0 +1,49 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Tests that only js-calltree view is on, default, and many things are hidden + * when in retro mode. + */ +const HIDDEN_OPTIONS = ["option-enable-memory", "option-invert-flame-graph", "option-show-jit-optimizations", "option-flatten-tree-recursion"]; + +Services.prefs.setBoolPref("devtools.performance.ui.retro-mode", true); + +function spawnTest () { + let { panel } = yield initPerformance(SIMPLE_URL); + let { EVENTS, DetailsView, PerformanceController, $, $$, JsCallTreeView } = panel.panelWin; + + yield startRecording(panel); + yield stopRecording(panel); + + let model = PerformanceController.getCurrentRecording(); + + ok(model.getMemory().length === 0, "model did not record memory."); + ok(model.getTicks().length !== 0, "model did get ticks."); + ok(model.getAllocations().sites.length === 0, "model did get allocation data."); + ok(model.getAllocations().timestamps.length === 0, "model did get allocation data."); + ok(model.getAllocations().frames.length === 0, "model did get allocation data."); + ok(model.getAllocations().counts.length === 0, "model did get allocation data."); + + ok(DetailsView.isViewSelected(JsCallTreeView), + "The jscalltree view is selected by default"); + + for (let option of $$("#performance-options-menupopup > menuitem")) { + if (HIDDEN_OPTIONS.indexOf(option.id) !== -1) { + ok(option.hidden === true, `${option.id} should be hidden.`); + } else { + ok(option.hidden === false, `${option.id} should be visible.`); + } + } + + for (let viewbutton of $$("#performance-toolbar-controls-detail-views > toolbarbutton")) { + ok (viewbutton.hidden === true, `${viewbutton.id} should be hidden.`); + } + + ok($("#markers-overview").hidden, "markers overview should be hidden."); + ok($("#memory-overview").hidden, "memory overview should be hidden."); + ok(!$("#time-framerate").hidden, "framerate should be shown."); + + yield teardown(panel); + finish(); +} diff --git a/browser/devtools/performance/test/head.js b/browser/devtools/performance/test/head.js index b255c6a6238d..871d2b126b84 100644 --- a/browser/devtools/performance/test/head.js +++ b/browser/devtools/performance/test/head.js @@ -56,6 +56,7 @@ let DEFAULT_PREFS = [ "devtools.performance.memory.max-log-length", "devtools.performance.profiler.buffer-size", "devtools.performance.profiler.sample-frequency-khz", + "devtools.performance.ui.retro-mode", ].reduce((prefs, pref) => { prefs[pref] = Preferences.get(pref); return prefs; @@ -67,6 +68,10 @@ Services.prefs.setBoolPref("devtools.performance.enabled", true); // be affected by this pref. Services.prefs.setBoolPref("devtools.debugger.log", false); +// Disable retro mode. +// TODO bug 1160313 +Services.prefs.setBoolPref("devtools.performance.ui.retro-mode", false); + /** * Call manually in tests that use frame script utils after initializing * the tool. Must be called after initializing so we can detect diff --git a/browser/devtools/performance/views/details.js b/browser/devtools/performance/views/details.js index 0ce182594a5d..35c13534031d 100644 --- a/browser/devtools/performance/views/details.js +++ b/browser/devtools/performance/views/details.js @@ -94,9 +94,12 @@ let DetailsView = { let invalidCurrentView = false; for (let [name, { view }] of Iterator(this.components)) { - let isSupported = this._isViewSupported(name, false); + // TODO bug 1160313 get rid of retro mode checks. + let isRetro = PerformanceController.getOption("retro-mode"); + let isSupported = isRetro ? name === "js-calltree" : this._isViewSupported(name, false); - $(`toolbarbutton[data-view=${name}]`).hidden = !isSupported; + // TODO bug 1160313 hide all view buttons, but let js-calltree still be "supported" + $(`toolbarbutton[data-view=${name}]`).hidden = isRetro ? true : !isSupported; // If the view is currently selected and not supported, go back to the // default view. diff --git a/browser/devtools/performance/views/toolbar.js b/browser/devtools/performance/views/toolbar.js index 4df132297bbb..05770b89d5df 100644 --- a/browser/devtools/performance/views/toolbar.js +++ b/browser/devtools/performance/views/toolbar.js @@ -21,6 +21,19 @@ let ToolbarView = { menupopup: $("#performance-options-menupopup") }); + // TODO bug 1160313 get rid of retro mode checks + // hide option buttons here, and any other buttons in the toolbar + // (details.js takes care of view buttons) + if (PerformanceController.getOption("retro-mode")) { + let RETRO_ELEMENTS = [ + "#option-flatten-tree-recursion", "#option-enable-memory", "#option-invert-flame-graph", + "#option-show-jit-optimizations", "#filter-button" + ]; + for (let selector of RETRO_ELEMENTS) { + $(selector).hidden = true; + } + } + yield this.optionsView.initialize(); this.optionsView.on("pref-changed", this._onPrefChanged);