mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 22:32:51 +00:00
Bug 1162583 - Disable realtime rendering in performance tools when e10s is not on. r=vp
This commit is contained in:
parent
8e5b85f9d2
commit
dbdca9a2e9
@ -100,6 +100,7 @@ browser.jar:
|
||||
content/browser/devtools/webaudioeditor/views/properties.js (webaudioeditor/views/properties.js)
|
||||
content/browser/devtools/webaudioeditor/views/automation.js (webaudioeditor/views/automation.js)
|
||||
content/browser/devtools/performance.xul (performance/performance.xul)
|
||||
* content/browser/devtools/performance/system.js (performance/system.js)
|
||||
content/browser/devtools/performance/performance-controller.js (performance/performance-controller.js)
|
||||
content/browser/devtools/performance/performance-view.js (performance/performance-view.js)
|
||||
content/browser/devtools/performance/views/overview.js (performance/views/overview.js)
|
||||
|
@ -191,6 +191,11 @@ let PerformanceController = {
|
||||
this._onRecordingStateChange = this._onRecordingStateChange.bind(this);
|
||||
this._onProfilerStatusUpdated = this._onProfilerStatusUpdated.bind(this);
|
||||
|
||||
// Store data regarding if e10s is enabled.
|
||||
this._e10s = Services.appinfo.browserTabsRemoteAutostart;
|
||||
|
||||
this._setMultiprocessAttributes();
|
||||
|
||||
// All boolean prefs should be handled via the OptionsView in the
|
||||
// ToolbarView, so that they may be accessible via the "gear" menu.
|
||||
// Every other pref should be registered here.
|
||||
@ -513,6 +518,44 @@ let PerformanceController = {
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns an object with `supported` and `enabled` properties indicating
|
||||
* whether or not the platform is capable of turning on e10s and whether or not
|
||||
* it's already enabled, respectively.
|
||||
*
|
||||
* @return {object}
|
||||
*/
|
||||
getMultiprocessStatus: function () {
|
||||
// If testing, set both supported and enabled to true so we
|
||||
// have realtime rendering tests in non-e10s. This function is
|
||||
// overridden wholesale in tests when we want to test multiprocess support
|
||||
// specifically.
|
||||
if (gDevTools.testing) {
|
||||
return { supported: true, enabled: true };
|
||||
}
|
||||
let supported = SYSTEM.MULTIPROCESS_SUPPORTED;
|
||||
// This is only checked on tool startup -- requires a restart if
|
||||
// e10s subsequently enabled.
|
||||
let enabled = this._e10s;
|
||||
return { supported, enabled };
|
||||
},
|
||||
|
||||
/**
|
||||
* Called on init, sets an `e10s` attribute on the main view container with
|
||||
* "disabled" if e10s is possible on the platform and just not on, or "unsupported"
|
||||
* if e10s is not possible on the platform. If e10s is on, no attribute is set.
|
||||
*/
|
||||
_setMultiprocessAttributes: function () {
|
||||
let { enabled, supported } = this.getMultiprocessStatus();
|
||||
if (!enabled && supported) {
|
||||
$("#performance-view").setAttribute("e10s", "disabled");
|
||||
}
|
||||
// Could be a chance where the directive goes away yet e10s is still on
|
||||
else if (!enabled && !supported) {
|
||||
$("#performance-view").setAttribute("e10s", "unsupported");
|
||||
}
|
||||
},
|
||||
|
||||
toString: () => "[object PerformanceController]"
|
||||
};
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script src="chrome://browser/content/devtools/theme-switching.js"/>
|
||||
<script type="application/javascript" src="performance/system.js"/>
|
||||
<script type="application/javascript" src="performance/performance-controller.js"/>
|
||||
<script type="application/javascript" src="performance/performance-view.js"/>
|
||||
<script type="application/javascript" src="performance/recording-model.js"/>
|
||||
@ -173,6 +174,10 @@
|
||||
<toolbarbutton class="devtools-toolbarbutton record-button"
|
||||
label="&profilerUI.stopRecording;" />
|
||||
</hbox>
|
||||
<label class="realtime-disabled-message"
|
||||
value="Realtime recording data disabled on non-multiprocess Firefox."/>
|
||||
<label class="realtime-disabled-on-e10s-message"
|
||||
value="Enable multiprocess Firefox in preferences for rendering recording data in realtime."/>
|
||||
<label class="buffer-status-message"
|
||||
tooltiptext="&profilerUI.bufferStatusTooltip;"/>
|
||||
<label class="buffer-status-message-full"
|
||||
@ -195,6 +200,10 @@
|
||||
<label class="console-profile-command" />
|
||||
<label value="&profilerUI.console.stopCommandEnd;" />
|
||||
</hbox>
|
||||
<label class="realtime-disabled-message"
|
||||
value="Realtime recording data disabled on non-multiprocess Firefox."/>
|
||||
<label class="realtime-disabled-on-e10s-message"
|
||||
value="Enable multiprocess Firefox in preferences for rendering recording data in realtime."/>
|
||||
<label class="buffer-status-message"
|
||||
tooltiptext="&profilerUI.bufferStatusTooltip;"/>
|
||||
<label class="buffer-status-message-full"
|
||||
|
16
browser/devtools/performance/system.js
Normal file
16
browser/devtools/performance/system.js
Normal file
@ -0,0 +1,16 @@
|
||||
/* 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/. */
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* A dump file to attach preprocessing directives consumable to the controller
|
||||
* without littering our code with directives.
|
||||
*/
|
||||
|
||||
const SYSTEM = {};
|
||||
|
||||
// If e10s is possible on the platform.
|
||||
#ifdef E10S_TESTING_ONLY
|
||||
SYSTEM.MULTIPROCESS_SUPPORTED = true;
|
||||
#endif
|
@ -89,6 +89,7 @@ support-files =
|
||||
[browser_perf-overview-render-01.js]
|
||||
[browser_perf-overview-render-02.js]
|
||||
[browser_perf-overview-render-03.js]
|
||||
[browser_perf-overview-render-04.js]
|
||||
[browser_perf-overview-selection-01.js]
|
||||
[browser_perf-overview-selection-02.js]
|
||||
[browser_perf-overview-selection-03.js]
|
||||
@ -104,6 +105,7 @@ support-files =
|
||||
[browser_perf-recording-notices-02.js]
|
||||
[browser_perf-recording-notices-03.js]
|
||||
[browser_perf-recording-notices-04.js]
|
||||
[browser_perf-recording-notices-05.js]
|
||||
[browser_perf_recordings-io-01.js]
|
||||
[browser_perf_recordings-io-02.js]
|
||||
[browser_perf_recordings-io-03.js]
|
||||
|
@ -0,0 +1,52 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Tests that the overview graphs do not render when realtime rendering is off
|
||||
* due to lack of e10s.
|
||||
*/
|
||||
function spawnTest () {
|
||||
let { panel } = yield initPerformance(SIMPLE_URL);
|
||||
let { $, EVENTS, PerformanceController, OverviewView, RecordingsView } = panel.panelWin;
|
||||
|
||||
let updated = 0;
|
||||
OverviewView.on(EVENTS.OVERVIEW_RENDERED, () => updated++);
|
||||
OverviewView.OVERVIEW_UPDATE_INTERVAL = 1;
|
||||
|
||||
// Set realtime rendering off.
|
||||
OverviewView.isRealtimeRenderingEnabled = () => false;
|
||||
|
||||
yield startRecording(panel, { waitForOverview: false, waitForStateChange: true });
|
||||
is($("#overview-pane").hidden, true, "overview graphs hidden");
|
||||
is(updated, 0, "Overview graphs have still not been updated");
|
||||
yield waitUntil(() => PerformanceController.getCurrentRecording().getMarkers().length);
|
||||
yield waitUntil(() => PerformanceController.getCurrentRecording().getTicks().length);
|
||||
is(updated, 0, "Overview graphs have still not been updated");
|
||||
|
||||
yield stopRecording(panel);
|
||||
|
||||
let markers = OverviewView.graphs.get("timeline");
|
||||
let framerate = OverviewView.graphs.get("framerate");
|
||||
|
||||
ok(markers.width > 0,
|
||||
"The overview's markers graph has a width.");
|
||||
ok(framerate.width > 0,
|
||||
"The overview's framerate graph has a width.");
|
||||
|
||||
is(updated, 1, "Overview graphs rendered upon completion.");
|
||||
is($("#overview-pane").hidden, false, "overview graphs no longer hidden");
|
||||
|
||||
yield startRecording(panel, { waitForOverview: false, waitForStateChange: true });
|
||||
is($("#overview-pane").hidden, true, "overview graphs hidden again when starting new recording");
|
||||
|
||||
RecordingsView.selectedIndex = 0;
|
||||
is($("#overview-pane").hidden, false, "overview graphs no longer hidden when switching back to complete recording.");
|
||||
RecordingsView.selectedIndex = 1;
|
||||
is($("#overview-pane").hidden, true, "overview graphs hidden again when going back to inprogress recording.");
|
||||
|
||||
yield stopRecording(panel);
|
||||
is($("#overview-pane").hidden, false, "overview graphs no longer hidden when recording finishes");
|
||||
|
||||
yield teardown(panel);
|
||||
finish();
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Tests that when a recording overlaps the circular buffer, that
|
||||
* a class is assigned to the recording notices.
|
||||
*/
|
||||
function spawnTest () {
|
||||
let { panel } = yield initPerformance(SIMPLE_URL, void 0, { TEST_MOCK_PROFILER_CHECK_TIMER: 10 });
|
||||
let { EVENTS, $, PerformanceController, PerformanceView } = panel.panelWin;
|
||||
|
||||
let supported = false;
|
||||
let enabled = false;
|
||||
|
||||
PerformanceController.getMultiprocessStatus = () => {
|
||||
return { supported, enabled };
|
||||
};
|
||||
|
||||
PerformanceController._setMultiprocessAttributes();
|
||||
ok($("#performance-view").getAttribute("e10s"), "unsupported",
|
||||
"when e10s is disabled and no option to turn on, container has [e10s=unsupported]");
|
||||
|
||||
supported = true;
|
||||
enabled = false;
|
||||
PerformanceController._setMultiprocessAttributes();
|
||||
ok($("#performance-view").getAttribute("e10s"), "disabled",
|
||||
"when e10s is disabled and but is supported, container has [e10s=disabled]");
|
||||
|
||||
supported = false;
|
||||
enabled = true;
|
||||
PerformanceController._setMultiprocessAttributes();
|
||||
ok($("#performance-view").getAttribute("e10s"), "",
|
||||
"when e10s is enabled, but not supported, this probably means we no longer have E10S_TESTING_ONLY, and we have no e10s attribute.");
|
||||
|
||||
supported = true;
|
||||
enabled = true;
|
||||
PerformanceController._setMultiprocessAttributes();
|
||||
ok($("#performance-view").getAttribute("e10s"), "",
|
||||
"when e10s is enabled and supported, there should be no e10s attribute.");
|
||||
|
||||
yield teardown(panel);
|
||||
finish();
|
||||
}
|
@ -30,6 +30,12 @@ const GRAPH_REQUIREMENTS = {
|
||||
*/
|
||||
let OverviewView = {
|
||||
|
||||
/**
|
||||
* How frequently we attempt to render the graphs. Overridden
|
||||
* in tests.
|
||||
*/
|
||||
OVERVIEW_UPDATE_INTERVAL: OVERVIEW_UPDATE_INTERVAL,
|
||||
|
||||
/**
|
||||
* Sets up the view with event binding.
|
||||
*/
|
||||
@ -46,6 +52,9 @@ let OverviewView = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Store info on multiprocess support.
|
||||
this._multiprocessData = PerformanceController.getMultiprocessStatus();
|
||||
|
||||
this._onRecordingWillStart = this._onRecordingWillStart.bind(this);
|
||||
this._onRecordingStarted = this._onRecordingStarted.bind(this);
|
||||
this._onRecordingWillStop = this._onRecordingWillStop.bind(this);
|
||||
@ -173,6 +182,7 @@ let OverviewView = {
|
||||
if (this.isDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let recording = PerformanceController.getCurrentRecording();
|
||||
yield this.graphs.render(recording.getAllData(), resolution);
|
||||
|
||||
@ -197,7 +207,7 @@ let OverviewView = {
|
||||
// Check here to see if there's still a _timeoutId, incase
|
||||
// `stop` was called before the _prepareNextTick call was executed.
|
||||
if (this.isRendering()) {
|
||||
this._timeoutId = setTimeout(this._onRecordingTick, OVERVIEW_UPDATE_INTERVAL);
|
||||
this._timeoutId = setTimeout(this._onRecordingTick, this.OVERVIEW_UPDATE_INTERVAL);
|
||||
}
|
||||
},
|
||||
|
||||
@ -255,7 +265,7 @@ let OverviewView = {
|
||||
* Start the polling for rendering the overview graph.
|
||||
*/
|
||||
_startPolling: function () {
|
||||
this._timeoutId = setTimeout(this._onRecordingTick, OVERVIEW_UPDATE_INTERVAL);
|
||||
this._timeoutId = setTimeout(this._onRecordingTick, this.OVERVIEW_UPDATE_INTERVAL);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -340,6 +350,35 @@ let OverviewView = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Fetch the multiprocess status and if e10s is not currently on, disable
|
||||
* realtime rendering.
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
isRealtimeRenderingEnabled: function () {
|
||||
return this._multiprocessData.enabled;
|
||||
},
|
||||
|
||||
/**
|
||||
* Show the graphs overview panel when a recording is finished
|
||||
* when non-realtime graphs are enabled. Also set the graph visibility
|
||||
* so the performance graphs know which graphs to render.
|
||||
*
|
||||
* @param {RecordingModel} recording
|
||||
*/
|
||||
_showGraphsPanel: function (recording) {
|
||||
this._setGraphVisibilityFromRecordingFeatures(recording);
|
||||
$("#overview-pane").hidden = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Hide the graphs container completely.
|
||||
*/
|
||||
_hideGraphsPanel: function () {
|
||||
$("#overview-pane").hidden = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when `devtools.theme` changes.
|
||||
*/
|
||||
@ -361,14 +400,28 @@ let OverviewView = {
|
||||
* @return {function}
|
||||
*/
|
||||
function OverviewViewOnStateChange (fn) {
|
||||
return function _onRecordingStateChange () {
|
||||
return function _onRecordingStateChange (eventName, recording) {
|
||||
let currentRecording = PerformanceController.getCurrentRecording();
|
||||
|
||||
// All these methods require a recording to exist.
|
||||
if (!currentRecording) {
|
||||
// All these methods require a recording to exist selected and
|
||||
// from the event name, since there is a delay between starting
|
||||
// a recording and changing the selection.
|
||||
if (!currentRecording || !recording) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If realtime rendering is not enabed (e10s not on), then
|
||||
// show the disabled message, or the full graphs if the recording is completed
|
||||
if (!this.isRealtimeRenderingEnabled()) {
|
||||
if (recording.isRecording()) {
|
||||
this._hideGraphsPanel();
|
||||
// Abort, as we do not want to change polling status.
|
||||
return;
|
||||
} else {
|
||||
this._showGraphsPanel(recording);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isRendering() && !currentRecording.isRecording()) {
|
||||
this._stopPolling();
|
||||
} else if (currentRecording.isRecording() && !this.isRendering()) {
|
||||
|
@ -101,12 +101,32 @@
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
#performance-view .realtime-message {
|
||||
opacity: 0.5;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#performance-view toolbarbutton.record-button[checked],
|
||||
#performance-view toolbarbutton.record-button[checked] {
|
||||
color: var(--theme-selection-color);
|
||||
background: var(--theme-selection-background);
|
||||
}
|
||||
|
||||
#performance-view .realtime-disabled-message,
|
||||
#performance-view .realtime-disabled-on-e10s-message {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#performance-view[e10s="disabled"] .realtime-disabled-on-e10s-message {
|
||||
display: block;
|
||||
opacity: 0.5;
|
||||
|
||||
}
|
||||
#performance-view[e10s="unsupported"] .realtime-disabled-message {
|
||||
display: block;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
#details-pane-container .buffer-status-message,
|
||||
#details-pane-container .buffer-status-message-full {
|
||||
display: none;
|
||||
|
Loading…
x
Reference in New Issue
Block a user